From 83a137ea168d8884a4c7864b34a1d6269d97ed23 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:12:36 -0500 Subject: [PATCH 01/28] Add dotnet-api product slug to sample metadata script (#34706) Co-authored-by: Anne Thompson --- eng/common/scripts/Test-SampleMetadata.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/common/scripts/Test-SampleMetadata.ps1 b/eng/common/scripts/Test-SampleMetadata.ps1 index 4a0000220fde..9e50fa1dce03 100644 --- a/eng/common/scripts/Test-SampleMetadata.ps1 +++ b/eng/common/scripts/Test-SampleMetadata.ps1 @@ -330,6 +330,7 @@ begin { "blazor-webassembly", "common-data-service", "customer-voice", + "dotnet-api", "dotnet-core", "dotnet-standard", "document-intelligence", From 1923e0ddee0d4bbe233a750c1efc35a231f76655 Mon Sep 17 00:00:00 2001 From: swathipil <76007337+swathipil@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:29:51 -0600 Subject: [PATCH 02/28] [Perf] corehttp - updating async stream upload httpx test (#34674) * add async iterator random stream for async httpx * update perf tests with same args for easier comparison of perf * pauls comments * update asynciterator comment to iterable --- sdk/core/azure-core/perf-tests.yml | 6 +-- sdk/core/corehttp/perf-tests.yml | 6 +-- .../tests/perf_tests/upload_binary.py | 11 ++++- .../perfstress_tests/__init__.py | 3 +- .../perfstress_tests/_async_random_stream.py | 44 +++++++++++++++++++ 5 files changed, 61 insertions(+), 9 deletions(-) diff --git a/sdk/core/azure-core/perf-tests.yml b/sdk/core/azure-core/perf-tests.yml index a20e66ab2ac5..6a50b1d710d0 100644 --- a/sdk/core/azure-core/perf-tests.yml +++ b/sdk/core/azure-core/perf-tests.yml @@ -14,8 +14,8 @@ Tests: Arguments: - --size 1024 --parallel 64 --duration 60 --policies all - --size 1024 --parallel 64 --duration 60 --policies all --use-entra-id - - --size 10240 --parallel 32 --duration 60 - - --size 10240 --parallel 32 --duration 60 --transport requests + - --size 10240 --parallel 64 --duration 60 + - --size 10240 --parallel 64 --duration 60 --transport requests - Test: download-binary Class: DownloadBinaryDataTest @@ -23,7 +23,7 @@ Tests: - --size 1024 --parallel 64 --duration 60 - --size 1024 --parallel 64 --duration 60 --transport requests - --size 1024 --parallel 64 --duration 60 --use-entra-id - - --size 10240 --parallel 32 --duration 60 --policies all + - --size 10240 --parallel 64 --duration 60 --policies all - Test: update-entity Class: UpdateEntityJSONTest diff --git a/sdk/core/corehttp/perf-tests.yml b/sdk/core/corehttp/perf-tests.yml index 0a4b09aa61b9..e3a6ba376b4c 100644 --- a/sdk/core/corehttp/perf-tests.yml +++ b/sdk/core/corehttp/perf-tests.yml @@ -14,8 +14,8 @@ Tests: Arguments: - --size 1024 --parallel 64 --duration 60 --policies all - --size 1024 --parallel 64 --duration 60 --policies all --use-entra-id - - --size 10240 --parallel 32 --duration 60 - - --size 10240 --parallel 32 --duration 60 --transport httpx + - --size 10240 --parallel 64 --duration 60 + - --size 10240 --parallel 64 --duration 60 --transport httpx - Test: download-binary Class: DownloadBinaryDataTest @@ -23,7 +23,7 @@ Tests: - --size 1024 --parallel 64 --duration 60 - --size 1024 --parallel 64 --duration 60 --transport httpx - --size 1024 --parallel 64 --duration 60 --use-entra-id - - --size 10240 --parallel 32 --duration 60 --policies all + - --size 10240 --parallel 64 --duration 60 --policies all - Test: update-entity Class: UpdateEntityJSONTest diff --git a/sdk/core/corehttp/tests/perf_tests/upload_binary.py b/sdk/core/corehttp/tests/perf_tests/upload_binary.py index 2603af67b310..2bd341ff15a1 100644 --- a/sdk/core/corehttp/tests/perf_tests/upload_binary.py +++ b/sdk/core/corehttp/tests/perf_tests/upload_binary.py @@ -5,7 +5,7 @@ from time import time from wsgiref.handlers import format_date_time -from devtools_testutils.perfstress_tests import RandomStream, AsyncRandomStream +from devtools_testutils.perfstress_tests import RandomStream, AsyncRandomStream, AsyncIteratorRandomStream from corehttp.rest import HttpRequest from corehttp.exceptions import ( @@ -29,7 +29,14 @@ def __init__(self, arguments): blob_name = "uploadtest" self.blob_endpoint = f"{self.account_endpoint}{self.container_name}/{blob_name}" self.upload_stream = RandomStream(self.args.size) - self.upload_stream_async = AsyncRandomStream(self.args.size) + + # The AsyncIteratorRandomStream is used for upload stream scenario, since the + # async httpx transport requires the request body stream to be type AsyncIterable (i.e. have an __aiter__ method rather than __iter__). + # Specific check in httpx here: https://github.com/encode/httpx/blob/7df47ce4d93a06f2c3310cd692b4c2336d7663ba/httpx/_content.py#L116. + if self.args.transport == "httpx": + self.upload_stream_async = AsyncIteratorRandomStream(self.args.size) + else: + self.upload_stream_async = AsyncRandomStream(self.args.size) def run_sync(self): self.upload_stream.reset() diff --git a/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/__init__.py b/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/__init__.py index fc62d8e08df8..2556fca820a2 100644 --- a/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/__init__.py +++ b/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/__init__.py @@ -9,7 +9,7 @@ from ._perf_stress_runner import _PerfStressRunner from ._perf_stress_test import PerfStressTest from ._random_stream import RandomStream, WriteStream, get_random_bytes -from ._async_random_stream import AsyncRandomStream +from ._async_random_stream import AsyncRandomStream, AsyncIteratorRandomStream from ._batch_perf_test import BatchPerfTest from ._event_perf_test import EventPerfTest @@ -19,6 +19,7 @@ "EventPerfTest", "RandomStream", "WriteStream", + "AsyncIteratorRandomStream", "AsyncRandomStream", "get_random_bytes" ] diff --git a/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/_async_random_stream.py b/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/_async_random_stream.py index ce8be60731df..ee9e2ab8e0ac 100644 --- a/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/_async_random_stream.py +++ b/tools/azure-sdk-tools/devtools_testutils/perfstress_tests/_async_random_stream.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +from typing import AsyncIterator from io import BytesIO from ._random_stream import get_random_bytes, _DEFAULT_LENGTH @@ -58,3 +59,46 @@ def remaining(self): def close(self): self._closed = True + + +class AsyncIteratorRandomStream(AsyncIterator[bytes]): + """ + Async random stream of bytes for methods that accept AsyncIterator as input. + """ + def __init__(self, length, initial_buffer_length=_DEFAULT_LENGTH): + self._base_data = get_random_bytes(initial_buffer_length) + self._data_length = length + self._base_buffer_length = initial_buffer_length + self._position = 0 + self._remaining = length + + def __len__(self): + return self._remaining + + def __aiter__(self): + return self + + async def __anext__(self): + if self._remaining == 0: + raise StopAsyncIteration + return self.read() + + def reset(self): + self._position = 0 + self._remaining = self._data_length + + def read(self, size=None): + if self._remaining == 0: + return b"" + + if size is None: + e = self._base_buffer_length + else: + e = size + e = min(e, self._remaining) + if e > self._base_buffer_length: + self._base_data = get_random_bytes(e) + self._base_buffer_length = e + self._remaining = self._remaining - e + self._position += e + return self._base_data[:e] From 9b96ce578d6f6afe073d5950b99abfe305065449 Mon Sep 17 00:00:00 2001 From: James Suplizio Date: Fri, 8 Mar 2024 10:39:23 -0800 Subject: [PATCH 03/28] Remove defunct user from CODEOWNERS (#34707) --- .github/CODEOWNERS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ff35971d512c..a7a19f9cb3f2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -241,9 +241,9 @@ /sdk/ml/azure-ai-ml/azure/ai/ml/_local_endpoints/ @NonStatic2014 @arunsu @stanley-msft @JustinFirsching # PRLabel: %ML-Jobs -/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job* @DouglasXiaoMS @TonyJ1 @wangchao1230 -/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/ @DouglasXiaoMS @TonyJ1 @wangchao1230 -/sdk/ml/training-experiences.tests.yml @DouglasXiaoMS @TonyJ1 +/sdk/ml/azure-ai-ml/azure/ai/ml/_schema/job* @TonyJ1 @wangchao1230 +/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/ @TonyJ1 @wangchao1230 +/sdk/ml/training-experiences.tests.yml @TonyJ1 # PRLabel: %ML-AutoML /sdk/ml/azure-ai-ml/azure/ai/ml/_schema/automl/ @skasturi @rtanase @raduk @PhaniShekhar @sharma-riti @jialiu103 @nick863 @yuanzhuangyuanzhuang @anupsms @MaurisLucis @novaturient95 @@ -951,7 +951,7 @@ #// @shivanissambare # ServiceLabel: %ML-Jobs -#// @DouglasXiaoMS @TonyJ1 @wangchao1230 +#// @TonyJ1 @wangchao1230 # ServiceLabel: %ML-Local Endpoints #// @NonStatic2014 @arunsu @stanley-msft @JustinFirsching From 256e7830904da85a4af57e147d58a078981b48a4 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:06:35 -0500 Subject: [PATCH 04/28] Sync .github/workflows directory with azure-sdk-tools for PR 7845 (#34709) * Create a separate job for events requiring Az CLI * Update .github/workflows/event-processor.yml Co-authored-by: Wes Haggard --------- Co-authored-by: James Suplizio Co-authored-by: Wes Haggard --- .github/workflows/event-processor.yml | 68 +++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 649b211e9254..66442232c93b 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -17,26 +17,29 @@ on: permissions: {} jobs: - event-handler: + # This event requires the Azure CLI to get the LABEL_SERVICE_API_KEY from the vault. + # Because the azure/login step adds time costly pre/post Az CLI commands to any every job + # it's used in, split this into its own job so only the event that needs the Az CLI pays + # the cost. + event-handler-with-azure: permissions: issues: write pull-requests: write # For OIDC auth id-token: write contents: read - name: Handle ${{ github.event_name }} ${{ github.event.action }} event + name: Handle ${{ github.event_name }} ${{ github.event.action }} event with azure login runs-on: ubuntu-latest + if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }} steps: - name: 'Az CLI login' - if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }} - uses: azure/login@v1.5.1 + uses: azure/login@v1 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - name: 'Run Azure CLI commands' - if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }} run: | LABEL_SERVICE_API_KEY=$(az keyvault secret show \ --vault-name issue-labeler \ @@ -94,3 +97,58 @@ jobs: # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} LABEL_SERVICE_API_KEY: ${{ env.LABEL_SERVICE_API_KEY }} + + event-handler: + permissions: + issues: write + pull-requests: write + name: Handle ${{ github.event_name }} ${{ github.event.action }} event + runs-on: ubuntu-latest + if: ${{ github.event_name != 'issues' || github.event.action != 'opened' }} + steps: + # To run github-event-processor built from source, for testing purposes, uncomment everything + # in between the Start/End-Build From Source comments and comment everything in between the + # Start/End-Install comments + # Start-Install + - name: Install GitHub Event Processor + run: > + dotnet tool install + Azure.Sdk.Tools.GitHubEventProcessor + --version 1.0.0-dev.20240229.2 + --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json + --global + shell: bash + # End-Install + + # Testing checkout of sources from the Azure/azure-sdk-tools repository + # The ref: is the SHA from the pull request in that repository or the + # refs/pull//merge for the latest on any given PR. If the repository + # is a fork eg. /azure-sdk-tools then the repository down below will + # need to point to that fork + # Start-Build + # - name: Checkout tools repo for GitHub Event Processor sources + # uses: actions/checkout@v3 + # with: + # repository: Azure/azure-sdk-tools + # path: azure-sdk-tools + # ref: /merge> or + + # - name: Build and install GitHubEventProcessor from sources + # run: | + # dotnet pack + # dotnet tool install --global --prerelease --add-source ../../../artifacts/packages/Debug Azure.Sdk.Tools.GitHubEventProcessor + # shell: bash + # working-directory: azure-sdk-tools/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor + # End-Build + + - name: Process Action Event + run: | + cat > payload.json << 'EOF' + ${{ toJson(github.event) }} + EOF + github-event-processor ${{ github.event_name }} payload.json + shell: bash + env: + # This is a temporary secret generated by github + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ee767c2bdf4b59ac3637ce3ef7c7f69e295b3897 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:07:51 -0500 Subject: [PATCH 05/28] Update Prepare-Release.ps1 to handle only one previous release (#34708) In the case there is exactly one previous release PS will return the single object and thus the Count property will not exist. Instead this change ensures that we always have a list. Co-authored-by: Wes Haggard --- eng/common/scripts/Prepare-Release.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index 269fd113fd69..e82c5982ac96 100644 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -116,7 +116,7 @@ $month = $ParsedReleaseDate.ToString("MMMM") Write-Host "Assuming release is in $month with release date $releaseDateString" -ForegroundColor Green if (Test-Path "Function:GetExistingPackageVersions") { - $releasedVersions = GetExistingPackageVersions -PackageName $packageProperties.Name -GroupId $packageProperties.Group + $releasedVersions = @(GetExistingPackageVersions -PackageName $packageProperties.Name -GroupId $packageProperties.Group) if ($null -ne $releasedVersions -and $releasedVersions.Count -gt 0) { $latestReleasedVersion = $releasedVersions[$releasedVersions.Count - 1] From 87bca574c7e602a7a32d52333604714d6a475477 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 8 Mar 2024 12:48:46 -0800 Subject: [PATCH 06/28] remove upper bound in setup.py (#34402) * remove upper bound in setup.py * update * update * update * revert change for monitor * update --- .../azure-appconfiguration-provider/setup.py | 6 +++--- sdk/appconfiguration/azure-appconfiguration/setup.py | 2 +- .../azure-ai-language-conversations/setup.py | 7 +++---- .../azure-ai-language-questionanswering/setup.py | 7 +++---- .../azure-communication-callautomation/setup.py | 7 ++++--- sdk/communication/azure-communication-chat/setup.py | 7 +++---- sdk/communication/azure-communication-email/setup.py | 8 ++++---- .../azure-communication-identity/setup.py | 2 +- .../azure-communication-jobrouter/setup.py | 4 ++-- .../azure-communication-networktraversal/setup.py | 9 ++++++--- .../azure-communication-phonenumbers/setup.py | 9 ++++++--- sdk/communication/azure-communication-rooms/setup.py | 7 ++++--- sdk/communication/azure-communication-sms/setup.py | 9 ++++++--- sdk/communication/azure-mgmt-communication/setup.py | 6 +++--- sdk/core/azure-core-experimental/setup.py | 6 +++--- sdk/core/azure-core-tracing-opencensus/setup.py | 6 +++--- sdk/core/azure-core-tracing-opentelemetry/setup.py | 8 ++++---- sdk/core/azure-mgmt-core/setup.py | 6 +++--- sdk/cosmos/azure-cosmos/setup.py | 2 +- sdk/eventgrid/azure-eventgrid/setup.py | 5 +++-- .../azure-eventhub-checkpointstoreblob-aio/setup.py | 11 ++++++----- .../azure-eventhub-checkpointstoreblob/setup.py | 9 +++++---- sdk/eventhub/azure-eventhub/setup.py | 3 ++- sdk/formrecognizer/azure-ai-formrecognizer/setup.py | 4 ++-- sdk/identity/azure-identity/setup.py | 6 +++--- sdk/keyvault/azure-keyvault-administration/setup.py | 2 +- sdk/keyvault/azure-keyvault-certificates/setup.py | 2 +- sdk/keyvault/azure-keyvault-keys/setup.py | 2 +- sdk/keyvault/azure-keyvault-secrets/setup.py | 2 +- sdk/keyvault/azure-keyvault/setup.py | 3 ++- sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py | 7 ++++--- sdk/monitor/azure-monitor-ingestion/setup.py | 7 ++++--- sdk/monitor/azure-monitor-query/setup.py | 3 ++- .../azure-schemaregistry-avroencoder/setup.py | 8 +++++--- sdk/schemaregistry/azure-schemaregistry/setup.py | 8 ++++---- sdk/search/azure-search-documents/setup.py | 4 ++-- sdk/servicebus/azure-servicebus/setup.py | 3 ++- sdk/storage/azure-storage-blob/setup.py | 4 ++-- sdk/storage/azure-storage-file-datalake/setup.py | 6 +++--- sdk/storage/azure-storage-file-share/setup.py | 4 ++-- sdk/storage/azure-storage-queue/setup.py | 4 ++-- sdk/tables/azure-data-tables/setup.py | 6 +++--- sdk/textanalytics/azure-ai-textanalytics/setup.py | 10 +++++----- .../azure-ai-translation-document/setup.py | 8 ++++---- sdk/translation/azure-ai-translation-text/setup.py | 4 ++-- .../templates/packaging_files/setup.py | 10 +++++----- 46 files changed, 141 insertions(+), 122 deletions(-) diff --git a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py index 5fa03d474441..49ec53b9952c 100644 --- a/sdk/appconfiguration/azure-appconfiguration-provider/setup.py +++ b/sdk/appconfiguration/azure-appconfiguration-provider/setup.py @@ -73,8 +73,8 @@ python_requires=">=3.6", install_requires=[ "msrest>=0.6.21", - "azure-core<2.0.0,>=1.28.0", - "azure-appconfiguration<2.0.0,>=1.5.0", - "azure-keyvault-secrets<5.0.0,>=4.3.0", + "azure-core>=1.28.0", + "azure-appconfiguration>=1.5.0", + "azure-keyvault-secrets>=4.3.0", ], ) diff --git a/sdk/appconfiguration/azure-appconfiguration/setup.py b/sdk/appconfiguration/azure-appconfiguration/setup.py index eaa5aebaf03c..f4a0bfb6dde7 100644 --- a/sdk/appconfiguration/azure-appconfiguration/setup.py +++ b/sdk/appconfiguration/azure-appconfiguration/setup.py @@ -68,7 +68,7 @@ packages=find_packages(exclude=exclude_packages), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", + "azure-core>=1.28.0", "isodate>=0.6.0", ], ) diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py index 5018c2142305..3785dae5cb7c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py +++ b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py @@ -51,7 +51,6 @@ "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", @@ -59,7 +58,7 @@ "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_packages(exclude=[ 'tests', @@ -75,8 +74,8 @@ 'azure.ai.language.conversations': ['py.typed'], }, install_requires=[ - "azure-core<2.0.0,>=1.28.0", - "isodate<1.0.0,>=0.6.1", + "azure-core>=1.28.0", + "isodate>=0.6.1", "typing-extensions>=4.0.1", ], project_urls={ diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py index 1b1a527e2b65..4e14c96fc277 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py @@ -41,7 +41,6 @@ "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", @@ -49,7 +48,7 @@ "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_packages(exclude=[ 'tests', @@ -66,8 +65,8 @@ 'azure.ai.language.questionanswering': ['py.typed'], }, install_requires=[ - "azure-core<2.0.0,>=1.28.0", - "isodate<1.0.0,>=0.6.1", + "azure-core>=1.28.0", + "isodate>=0.6.1", "typing-extensions>=4.0.1", ], project_urls={ diff --git a/sdk/communication/azure-communication-callautomation/setup.py b/sdk/communication/azure-communication-callautomation/setup.py index dadf91094373..8df3c705ceef 100644 --- a/sdk/communication/azure-communication-callautomation/setup.py +++ b/sdk/communication/azure-communication-callautomation/setup.py @@ -44,10 +44,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -57,14 +58,14 @@ 'azure', 'azure.communication' ]), - python_requires=">=3.7", + python_requires=">=3.8", include_package_data=True, package_data={ 'pytyped': ['py.typed'], }, install_requires=[ "msrest>=0.7.1", - "azure-core<2.0.0,>=1.29.5", + "azure-core>=1.29.5", "typing-extensions>=4.3.0", ], project_urls = { diff --git a/sdk/communication/azure-communication-chat/setup.py b/sdk/communication/azure-communication-chat/setup.py index b8879dc365cb..977faf887492 100644 --- a/sdk/communication/azure-communication-chat/setup.py +++ b/sdk/communication/azure-communication-chat/setup.py @@ -44,7 +44,6 @@ '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', @@ -59,14 +58,14 @@ 'azure', 'azure.communication' ]), - python_requires=">=3.7", + python_requires=">=3.8", include_package_data=True, package_data={ 'pytyped': ['py.typed'], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-core<2.0.0,>=1.29.5", + "isodate>=0.6.1", + "azure-core>=1.29.5", "typing-extensions>=4.3.0", ] ) diff --git a/sdk/communication/azure-communication-email/setup.py b/sdk/communication/azure-communication-email/setup.py index 7b9aac2fd155..b5db5e23cf4b 100644 --- a/sdk/communication/azure-communication-email/setup.py +++ b/sdk/communication/azure-communication-email/setup.py @@ -51,11 +51,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -71,8 +71,8 @@ }, install_requires=[ 'msrest>=0.7.1', - 'azure-common~=1.1', - 'azure-mgmt-core>=1.3.2,<2.0.0', + 'azure-common>=1.1', + 'azure-mgmt-core>=1.3.2', ], - python_requires=">=3.7" + python_requires=">=3.8" ) diff --git a/sdk/communication/azure-communication-identity/setup.py b/sdk/communication/azure-communication-identity/setup.py index 4476c4463a02..e18c4e042e7d 100644 --- a/sdk/communication/azure-communication-identity/setup.py +++ b/sdk/communication/azure-communication-identity/setup.py @@ -69,7 +69,7 @@ "pytyped": ["py.typed"], }, python_requires=">=3.8", - install_requires=["msrest>=0.7.1", "azure-core<2.0.0,>=1.24.0"], + install_requires=["msrest>=0.7.1", "azure-core>=1.24.0"], extras_require={":python_version<'3.8'": ["typing-extensions"]}, project_urls={ "Bug Reports": "https://github.com/Azure/azure-sdk-for-python/issues", diff --git a/sdk/communication/azure-communication-jobrouter/setup.py b/sdk/communication/azure-communication-jobrouter/setup.py index 02e082ea74ff..98cb6119670a 100644 --- a/sdk/communication/azure-communication-jobrouter/setup.py +++ b/sdk/communication/azure-communication-jobrouter/setup.py @@ -63,8 +63,8 @@ "azure.communication.jobrouter": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-core<2.0.0,>=1.30.0", + "isodate>=0.6.1", + "azure-core>=1.30.0", "typing-extensions>=4.6.0", ], python_requires=">=3.8", diff --git a/sdk/communication/azure-communication-networktraversal/setup.py b/sdk/communication/azure-communication-networktraversal/setup.py index 1c9d58849263..578425379ff8 100644 --- a/sdk/communication/azure-communication-networktraversal/setup.py +++ b/sdk/communication/azure-communication-networktraversal/setup.py @@ -50,8 +50,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], packages=find_packages(exclude=[ @@ -64,10 +67,10 @@ package_data={ 'pytyped': ['py.typed'], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ "msrest>=0.7.1", - "azure-core<2.0.0,>=1.24.0" + "azure-core>=1.24.0" ], extras_require={ ":python_version<'3.8'": ["typing-extensions"] diff --git a/sdk/communication/azure-communication-phonenumbers/setup.py b/sdk/communication/azure-communication-phonenumbers/setup.py index 310d2c5e3473..0c8171f86964 100644 --- a/sdk/communication/azure-communication-phonenumbers/setup.py +++ b/sdk/communication/azure-communication-phonenumbers/setup.py @@ -49,8 +49,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], packages=find_packages(exclude=[ @@ -63,10 +66,10 @@ package_data={ 'pytyped': ['py.typed'], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ "msrest>=0.7.1", - 'azure-core<2.0.0,>=1.24.0', + 'azure-core>=1.24.0', ], extras_require={ ":python_version<'3.8'": ["typing-extensions"] diff --git a/sdk/communication/azure-communication-rooms/setup.py b/sdk/communication/azure-communication-rooms/setup.py index fba15e73d76c..bc98da3b7631 100644 --- a/sdk/communication/azure-communication-rooms/setup.py +++ b/sdk/communication/azure-communication-rooms/setup.py @@ -48,10 +48,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -64,10 +65,10 @@ ] ), install_requires=[ - "azure-core<2.0.0,>=1.24.0", + "azure-core>=1.24.0", "msrest>=0.7.1", ], - python_requires=">=3.7", + python_requires=">=3.8", include_package_data=True, extras_require={ ":python_version<'3.8'": ["typing-extensions"] diff --git a/sdk/communication/azure-communication-sms/setup.py b/sdk/communication/azure-communication-sms/setup.py index 70ddbd11dda9..184fc3ce3830 100644 --- a/sdk/communication/azure-communication-sms/setup.py +++ b/sdk/communication/azure-communication-sms/setup.py @@ -49,8 +49,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], packages=find_packages(exclude=[ @@ -63,9 +66,9 @@ package_data={ 'pytyped': ['py.typed'], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - 'azure-core<2.0.0,>=1.24.0', + 'azure-core>=1.24.0', 'msrest>=0.7.1', ], extras_require={ diff --git a/sdk/communication/azure-mgmt-communication/setup.py b/sdk/communication/azure-mgmt-communication/setup.py index 63def4ec4dd6..ce572ed4ecda 100644 --- a/sdk/communication/azure-mgmt-communication/setup.py +++ b/sdk/communication/azure-mgmt-communication/setup.py @@ -53,11 +53,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -76,8 +76,8 @@ install_requires=[ "isodate<1.0.0,>=0.6.1", "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "azure-mgmt-core>=1.3.2", "typing-extensions>=4.3.0; python_version<'3.8.0'", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/core/azure-core-experimental/setup.py b/sdk/core/azure-core-experimental/setup.py index cf84dce380ba..c53095664e7a 100644 --- a/sdk/core/azure-core-experimental/setup.py +++ b/sdk/core/azure-core-experimental/setup.py @@ -45,11 +45,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -60,8 +60,8 @@ package_data={ "pytyped": ["py.typed"], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.25.0", + "azure-core>=1.25.0", ], ) diff --git a/sdk/core/azure-core-tracing-opencensus/setup.py b/sdk/core/azure-core-tracing-opencensus/setup.py index f153e9865a41..54974f66047f 100644 --- a/sdk/core/azure-core-tracing-opencensus/setup.py +++ b/sdk/core/azure-core-tracing-opencensus/setup.py @@ -45,11 +45,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -60,11 +60,11 @@ package_data={ "pytyped": ["py.typed"], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ "opencensus>=0.6.0", "opencensus-ext-azure>=0.3.1", "opencensus-ext-threading", - "azure-core<2.0.0,>=1.13.0", + "azure-core>=1.13.0", ], ) diff --git a/sdk/core/azure-core-tracing-opentelemetry/setup.py b/sdk/core/azure-core-tracing-opentelemetry/setup.py index 99c667e5c9a1..ae0a5baf512a 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/setup.py +++ b/sdk/core/azure-core-tracing-opentelemetry/setup.py @@ -45,11 +45,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -60,9 +60,9 @@ package_data={ "pytyped": ["py.typed"], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - "opentelemetry-api<2.0.0,>=1.12.0", - "azure-core<2.0.0,>=1.24.0", + "opentelemetry-api>=1.12.0", + "azure-core>=1.24.0", ], ) diff --git a/sdk/core/azure-mgmt-core/setup.py b/sdk/core/azure-mgmt-core/setup.py index 61c55fd325f3..f89e829c6a42 100644 --- a/sdk/core/azure-mgmt-core/setup.py +++ b/sdk/core/azure-mgmt-core/setup.py @@ -49,11 +49,11 @@ "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", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -69,7 +69,7 @@ "pytyped": ["py.typed"], }, install_requires=[ - "azure-core<2.0.0,>=1.29.0", + "azure-core>=1.29.0", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/cosmos/azure-cosmos/setup.py b/sdk/cosmos/azure-cosmos/setup.py index 9ab7a1dffdda..d2045ab67abb 100644 --- a/sdk/cosmos/azure-cosmos/setup.py +++ b/sdk/cosmos/azure-cosmos/setup.py @@ -73,7 +73,7 @@ packages=find_packages(exclude=exclude_packages), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.25.1", + "azure-core>=1.25.1", "typing-extensions>=4.6.0", ], ) diff --git a/sdk/eventgrid/azure-eventgrid/setup.py b/sdk/eventgrid/azure-eventgrid/setup.py index 6b301741f639..3a1acfc1aea8 100644 --- a/sdk/eventgrid/azure-eventgrid/setup.py +++ b/sdk/eventgrid/azure-eventgrid/setup.py @@ -51,6 +51,7 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -67,7 +68,7 @@ 'azure', ]), install_requires=[ - "isodate<1.0.0,>=0.6.1", - 'azure-core<2.0.0,>=1.24.0', + "isodate>=0.6.1", + 'azure-core>=1.24.0', ], ) diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py index 131137d06dd7..f6df420e3e0e 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py @@ -57,11 +57,12 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -70,14 +71,14 @@ package_data={ 'pytyped': ['py.typed'], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ # dependencies for the vendored storage blob - "azure-core<2.0.0,>=1.20.1", + "azure-core>=1.20.1", "msrest>=0.6.18", "cryptography>=2.1.4", # end of dependencies for the vendored storage blob - 'azure-eventhub<6.0.0,>=5.0.0', - 'aiohttp<5.0,>=3.8.3', + 'azure-eventhub>=5.0.0', + 'aiohttp>=3.8.3', ] ) diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py index d73f1c806f7f..f39b19007481 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py @@ -57,14 +57,15 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_packages(exclude=exclude_packages), include_package_data=True, @@ -73,10 +74,10 @@ }, install_requires=[ # dependencies for the vendored storage blob - "azure-core<2.0.0,>=1.20.1", + "azure-core>=1.20.1", "msrest>=0.6.18", "cryptography>=2.1.4", # end of dependencies for the vendored storage blob - 'azure-eventhub<6.0.0,>=5.0.0', + 'azure-eventhub>=5.0.0', ] ) diff --git a/sdk/eventhub/azure-eventhub/setup.py b/sdk/eventhub/azure-eventhub/setup.py index 58d29a94a1bb..a8fd87775648 100644 --- a/sdk/eventhub/azure-eventhub/setup.py +++ b/sdk/eventhub/azure-eventhub/setup.py @@ -59,6 +59,7 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -70,7 +71,7 @@ zip_safe=False, packages=find_packages(exclude=exclude_packages), install_requires=[ - "azure-core<2.0.0,>=1.14.0", + "azure-core>=1.14.0", "typing-extensions>=4.0.1", ] ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/setup.py b/sdk/formrecognizer/azure-ai-formrecognizer/setup.py index 20561ba79c2f..3ef46c4c6a35 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/setup.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/setup.py @@ -69,9 +69,9 @@ }, python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.23.0", + "azure-core>=1.23.0", "msrest>=0.6.21", - 'azure-common~=1.1', + 'azure-common>=1.1', "typing-extensions>=4.0.1", ] ) diff --git a/sdk/identity/azure-identity/setup.py b/sdk/identity/azure-identity/setup.py index 45f26f68f12c..563b5433e04c 100644 --- a/sdk/identity/azure-identity/setup.py +++ b/sdk/identity/azure-identity/setup.py @@ -59,9 +59,9 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.23.0", + "azure-core>=1.23.0", "cryptography>=2.5", - "msal<2.0.0,>=1.24.0", - "msal-extensions<2.0.0,>=0.3.0", + "msal>=1.24.0", + "msal-extensions>=0.3.0", ], ) diff --git a/sdk/keyvault/azure-keyvault-administration/setup.py b/sdk/keyvault/azure-keyvault-administration/setup.py index 9cae36c420ab..7a067e2fb7f6 100644 --- a/sdk/keyvault/azure-keyvault-administration/setup.py +++ b/sdk/keyvault/azure-keyvault-administration/setup.py @@ -68,7 +68,7 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.29.5", + "azure-core>=1.29.5", "isodate>=0.6.1", "typing-extensions>=4.0.1", ], diff --git a/sdk/keyvault/azure-keyvault-certificates/setup.py b/sdk/keyvault/azure-keyvault-certificates/setup.py index 46f30dbca275..3f853ae290c4 100644 --- a/sdk/keyvault/azure-keyvault-certificates/setup.py +++ b/sdk/keyvault/azure-keyvault-certificates/setup.py @@ -68,7 +68,7 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.29.5", + "azure-core>=1.29.5", "isodate>=0.6.1", "typing-extensions>=4.0.1", ], diff --git a/sdk/keyvault/azure-keyvault-keys/setup.py b/sdk/keyvault/azure-keyvault-keys/setup.py index 39332069b8c5..e678cb47a8b7 100644 --- a/sdk/keyvault/azure-keyvault-keys/setup.py +++ b/sdk/keyvault/azure-keyvault-keys/setup.py @@ -68,7 +68,7 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.29.5", + "azure-core>=1.29.5", "cryptography>=2.1.4", "isodate>=0.6.1", "typing-extensions>=4.0.1", diff --git a/sdk/keyvault/azure-keyvault-secrets/setup.py b/sdk/keyvault/azure-keyvault-secrets/setup.py index ecb34606f9c4..7b752e2cc118 100644 --- a/sdk/keyvault/azure-keyvault-secrets/setup.py +++ b/sdk/keyvault/azure-keyvault-secrets/setup.py @@ -68,7 +68,7 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.29.5", + "azure-core>=1.29.5", "isodate>=0.6.1", "typing-extensions>=4.0.1", ], diff --git a/sdk/keyvault/azure-keyvault/setup.py b/sdk/keyvault/azure-keyvault/setup.py index 85d7884bd7ef..89d152d56650 100644 --- a/sdk/keyvault/azure-keyvault/setup.py +++ b/sdk/keyvault/azure-keyvault/setup.py @@ -30,10 +30,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py b/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py index d3622473baec..b580eb841b36 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/setup.py @@ -50,10 +50,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -63,9 +64,9 @@ 'azure', 'azure.ai', ]), - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.23.0", + "azure-core>=1.23.0", "msrest>=0.6.21", ], ) diff --git a/sdk/monitor/azure-monitor-ingestion/setup.py b/sdk/monitor/azure-monitor-ingestion/setup.py index 49b1489f99f1..ba017184ce6a 100644 --- a/sdk/monitor/azure-monitor-ingestion/setup.py +++ b/sdk/monitor/azure-monitor-ingestion/setup.py @@ -65,14 +65,15 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_packages(exclude=[ 'tests', @@ -83,7 +84,7 @@ ]), include_package_data=True, install_requires=[ - 'azure-core<2.0.0,>=1.28.0', + 'azure-core>=1.28.0', 'isodate>=0.6.0', "typing-extensions>=4.0.1" ] diff --git a/sdk/monitor/azure-monitor-query/setup.py b/sdk/monitor/azure-monitor-query/setup.py index b478e41d6023..1354d38a54ba 100644 --- a/sdk/monitor/azure-monitor-query/setup.py +++ b/sdk/monitor/azure-monitor-query/setup.py @@ -65,6 +65,7 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -86,7 +87,7 @@ 'pytyped': ['py.typed'], }, install_requires=[ - 'azure-core<2.0.0,>=1.28.0', + 'azure-core>=1.28.0', 'isodate>=0.6.0', "typing-extensions>=4.0.1" ] diff --git a/sdk/schemaregistry/azure-schemaregistry-avroencoder/setup.py b/sdk/schemaregistry/azure-schemaregistry-avroencoder/setup.py index 0d88ad8116e5..f159bd638c1f 100644 --- a/sdk/schemaregistry/azure-schemaregistry-avroencoder/setup.py +++ b/sdk/schemaregistry/azure-schemaregistry-avroencoder/setup.py @@ -33,7 +33,7 @@ changelog = f.read() install_packages = [ - 'azure-schemaregistry>=1.0.0,<2.0.0', + 'azure-schemaregistry>=1.0.0', 'avro>=1.11.0', "typing-extensions>=4.0.1", ] @@ -53,13 +53,15 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_namespace_packages( include=['azure.schemaregistry.encoder.*'] # Exclude packages that will be covered by PEP420 or nspkg diff --git a/sdk/schemaregistry/azure-schemaregistry/setup.py b/sdk/schemaregistry/azure-schemaregistry/setup.py index ffbb1a99d73d..978f1d1cde7d 100644 --- a/sdk/schemaregistry/azure-schemaregistry/setup.py +++ b/sdk/schemaregistry/azure-schemaregistry/setup.py @@ -57,7 +57,7 @@ "Development Status :: 4 - Beta", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -65,16 +65,16 @@ 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], - python_requires=">=3.7", + python_requires=">=3.8", zip_safe=False, packages=find_packages(exclude=exclude_packages), install_requires=[ 'msrest>=0.6.21', - 'azure-core<2.0.0,>=1.24.0' + 'azure-core>=1.24.0' ], extras_require={ "jsonencoder": [ - "jsonschema<5.0.0,>=4.10.3", + "jsonschema>=4.10.3", ], }, ) diff --git a/sdk/search/azure-search-documents/setup.py b/sdk/search/azure-search-documents/setup.py index 9106e6c2f3a3..209df146e7a8 100644 --- a/sdk/search/azure-search-documents/setup.py +++ b/sdk/search/azure-search-documents/setup.py @@ -64,8 +64,8 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", - "azure-common~=1.1", + "azure-core>=1.28.0", + "azure-common>=1.1", "isodate>=0.6.0", ], ) diff --git a/sdk/servicebus/azure-servicebus/setup.py b/sdk/servicebus/azure-servicebus/setup.py index e96bddbc9845..36da79dcf476 100644 --- a/sdk/servicebus/azure-servicebus/setup.py +++ b/sdk/servicebus/azure-servicebus/setup.py @@ -49,6 +49,7 @@ "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -65,7 +66,7 @@ 'azure', ]), install_requires=[ - "azure-core<2.0.0,>=1.28.0", + "azure-core>=1.28.0", "isodate>=0.6.0", "typing-extensions>=4.0.1", ] diff --git a/sdk/storage/azure-storage-blob/setup.py b/sdk/storage/azure-storage-blob/setup.py index d53ccbd095f2..c22e1a5bdb13 100644 --- a/sdk/storage/azure-storage-blob/setup.py +++ b/sdk/storage/azure-storage-blob/setup.py @@ -78,14 +78,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", + "azure-core>=1.28.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]<2.0.0,>=1.28.0", + "azure-core[aio]>=1.28.0", ], }, ) diff --git a/sdk/storage/azure-storage-file-datalake/setup.py b/sdk/storage/azure-storage-file-datalake/setup.py index c71f3d97d788..cfd219335616 100644 --- a/sdk/storage/azure-storage-file-datalake/setup.py +++ b/sdk/storage/azure-storage-file-datalake/setup.py @@ -77,14 +77,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", - "azure-storage-blob<13.0.0,>=12.20.0b1", + "azure-core>=1.28.0", + "azure-storage-blob>=12.20.0b1", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]<2.0.0,>=1.28.0", + "azure-core[aio]>=1.28.0", ], }, ) diff --git a/sdk/storage/azure-storage-file-share/setup.py b/sdk/storage/azure-storage-file-share/setup.py index 06135d4616f3..fef43a9b1927 100644 --- a/sdk/storage/azure-storage-file-share/setup.py +++ b/sdk/storage/azure-storage-file-share/setup.py @@ -65,14 +65,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", + "azure-core>=1.28.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]<2.0.0,>=1.28.0", + "azure-core[aio]>=1.28.0", ], }, ) diff --git a/sdk/storage/azure-storage-queue/setup.py b/sdk/storage/azure-storage-queue/setup.py index e1dce723431b..8130656427c5 100644 --- a/sdk/storage/azure-storage-queue/setup.py +++ b/sdk/storage/azure-storage-queue/setup.py @@ -68,14 +68,14 @@ ]), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.28.0", + "azure-core>=1.28.0", "cryptography>=2.1.4", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], extras_require={ "aio": [ - "azure-core[aio]<2.0.0,>=1.28.0", + "azure-core[aio]>=1.28.0", ], }, ) diff --git a/sdk/tables/azure-data-tables/setup.py b/sdk/tables/azure-data-tables/setup.py index 2396b2e9ab20..905b3740a101 100644 --- a/sdk/tables/azure-data-tables/setup.py +++ b/sdk/tables/azure-data-tables/setup.py @@ -67,9 +67,9 @@ ), python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.29.4", - "yarl<2.0,>=1.0", - "isodate<1.0.0,>=0.6.1", + "azure-core>=1.29.4", + "yarl>=1.0", + "isodate>=0.6.1", "typing-extensions>=4.3.0", ], ) diff --git a/sdk/textanalytics/azure-ai-textanalytics/setup.py b/sdk/textanalytics/azure-ai-textanalytics/setup.py index 175099ab13ec..3391b4bae3c8 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/setup.py +++ b/sdk/textanalytics/azure-ai-textanalytics/setup.py @@ -49,11 +49,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], zip_safe=False, @@ -67,11 +67,11 @@ package_data={ 'azure.ai.textanalytics': ['py.typed'], }, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.24.0", - 'azure-common~=1.1', - "isodate<1.0.0,>=0.6.1", + "azure-core>=1.24.0", + 'azure-common>=1.1', + "isodate>=0.6.1", "typing-extensions>=4.0.1", ], ) diff --git a/sdk/translation/azure-ai-translation-document/setup.py b/sdk/translation/azure-ai-translation-document/setup.py index b23c38385d03..ec620aee8a48 100644 --- a/sdk/translation/azure-ai-translation-document/setup.py +++ b/sdk/translation/azure-ai-translation-document/setup.py @@ -40,11 +40,11 @@ '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', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], packages=find_packages(exclude=[ @@ -54,10 +54,10 @@ 'azure.ai', 'azure.ai.translation' ]), - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - "azure-core<2.0.0,>=1.24.0", - "isodate<1.0.0,>=0.6.1", + "azure-core>=1.24.0", + "isodate>=0.6.1", ], project_urls={ 'Bug Reports': 'https://github.com/Azure/azure-sdk-for-python/issues', diff --git a/sdk/translation/azure-ai-translation-text/setup.py b/sdk/translation/azure-ai-translation-text/setup.py index 144e339908e7..0188bfb2d400 100644 --- a/sdk/translation/azure-ai-translation-text/setup.py +++ b/sdk/translation/azure-ai-translation-text/setup.py @@ -64,8 +64,8 @@ "azure.ai.translation.text": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-core<2.0.0,>=1.30.0", + "isodate>=0.6.1", + "azure-core>=1.30.0", "typing-extensions>=4.6.0", ], python_requires=">=3.8", diff --git a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py index 389d0bc8d5c6..6ae6f9077080 100644 --- a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py +++ b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py @@ -78,16 +78,16 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", + "isodate>=0.6.1", {%- if need_msrestazure %} - "msrestazure>=0.4.32,<2.0.0", + "msrestazure>=0.4.32", {%- endif %} - "azure-common~=1.1", + "azure-common>=1.1", {%- if need_azurecore %} - "azure-core>=1.24.0,<2.0.0", + "azure-core>=1.24.0", {%- endif %} {%- if need_azuremgmtcore %} - "azure-mgmt-core>=1.3.2,<2.0.0", + "azure-mgmt-core>=1.3.2", {%- endif %} ], python_requires=">=3.8", From 23121a583108b6a09f2d45e3c7d1e99e70c365da Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:12:16 -0800 Subject: [PATCH 07/28] Add myself/mccoy to the tools directory codeowners (#34524) * add myself to tools/ directory * add mccoy --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a7a19f9cb3f2..b11b1fdd00cc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1013,6 +1013,8 @@ ########### /eng/ @scbedd @weshaggard @benbp +/tools/ @scbedd @mccoyp + # Add owners for notifications for specific pipelines /eng/pipelines/templates/jobs/tests-nightly-python.yml @lmazuel @mccoyp /eng/pipelines/aggregate-reports.yml @lmazuel @mccoyp @YalinLi0312 From b4a18bc34288a8cd02dbe86acbffd5163bcea97a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:22:58 -0400 Subject: [PATCH 08/28] Update github-event-processor version (#34720) Co-authored-by: James Suplizio --- .github/workflows/event-processor.yml | 4 ++-- .github/workflows/scheduled-event-processor.yml | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 66442232c93b..27c7433294ac 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -58,7 +58,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240229.2 + --version 1.0.0-dev.20240308.3 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash @@ -114,7 +114,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240229.2 + --version 1.0.0-dev.20240308.3 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash diff --git a/.github/workflows/scheduled-event-processor.yml b/.github/workflows/scheduled-event-processor.yml index 361c959bc82d..0829800a3729 100644 --- a/.github/workflows/scheduled-event-processor.yml +++ b/.github/workflows/scheduled-event-processor.yml @@ -2,6 +2,7 @@ name: GitHub Scheduled Event Processor on: schedule: + # These are generated/confirmed using https://crontab.cronhub.io/ # Close stale issues, runs every day at 1am - CloseStaleIssues - cron: '0 1 * * *' # Identify stale pull requests, every Friday at 5am - IdentifyStalePullRequests @@ -14,9 +15,10 @@ on: - cron: '30 4,10,16,22 * * *' # Lock closed issues, every 6 hours at 05:30 AM, 11:30 AM, 05:30 PM and 11:30 PM - LockClosedIssues - cron: '30 5,11,17,23 * * *' - # Enforce max life of issues, every Monday at 10:00 AM - EnforceMaxLifeOfIssues + # Enforce max life of issues, every M,W,F at 10:00 AM PST - EnforceMaxLifeOfIssues # Note: GitHub uses UTC, to run at 10am PST, the cron task needs to be 6pm (1800 hours) UTC - - cron: '0 18 * * MON' + # When scheduling for multiple days the numeric days 0-6 (0=Sunday) must be used. + - cron: '0 18 * * 1,3,5' # This removes all unnecessary permissions, the ones needed will be set below. # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token permissions: {} @@ -37,7 +39,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240229.2 + --version 1.0.0-dev.20240308.3 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash @@ -131,7 +133,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enforce Max Life of Issues Scheduled Event - if: github.event.schedule == '0 18 * * MON' + if: github.event.schedule == '0 18 * * 1,3,5' run: | cat > payload.json << 'EOF' ${{ toJson(github.event) }} From 9edbe4a83293d63d1ff3f8c3d0fdce209a650239 Mon Sep 17 00:00:00 2001 From: David Wu Date: Mon, 11 Mar 2024 09:05:15 -0700 Subject: [PATCH 09/28] Add date for release 1.14.0 (#34710) * Add release date * Change to next Monday as the team won't release SDK at Friday --- sdk/ml/azure-ai-ml/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/ml/azure-ai-ml/CHANGELOG.md b/sdk/ml/azure-ai-ml/CHANGELOG.md index fd3bd4ee19d8..261e2f23ca48 100644 --- a/sdk/ml/azure-ai-ml/CHANGELOG.md +++ b/sdk/ml/azure-ai-ml/CHANGELOG.md @@ -10,7 +10,7 @@ ### Other Changes -## 1.14.0 (unreleased) +## 1.14.0 (2024-03-11) ### Features Added - Remove `experimental` tag for `ml_client.jobs.validate`. From f2cb087d849ae51d2861586d264c187a6c456c07 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:51:32 -0400 Subject: [PATCH 10/28] Update GitHubEventProcessor to 20240311.2 (#34723) Co-authored-by: James Suplizio --- .github/workflows/event-processor.yml | 4 ++-- .github/workflows/scheduled-event-processor.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 27c7433294ac..c913b90cca8a 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -58,7 +58,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240308.3 + --version 1.0.0-dev.20240311.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash @@ -114,7 +114,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240308.3 + --version 1.0.0-dev.20240311.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash diff --git a/.github/workflows/scheduled-event-processor.yml b/.github/workflows/scheduled-event-processor.yml index 0829800a3729..120531ac3d5b 100644 --- a/.github/workflows/scheduled-event-processor.yml +++ b/.github/workflows/scheduled-event-processor.yml @@ -39,7 +39,7 @@ jobs: run: > dotnet tool install Azure.Sdk.Tools.GitHubEventProcessor - --version 1.0.0-dev.20240308.3 + --version 1.0.0-dev.20240311.2 --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json --global shell: bash From 3e3d34b54a641eddc718b5f6cbe68dbb51a14ea7 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Mon, 11 Mar 2024 11:29:01 -0700 Subject: [PATCH 11/28] [Monitor] Pylint updates (#34429) - Updates for next-pylint. - Added changelog entry for a previous release that was released from another branch. Signed-off-by: Paul Van Eck --- sdk/monitor/azure-monitor-query/CHANGELOG.md | 11 +++++++++++ .../monitor/query/aio/_metrics_query_client_async.py | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md index 554e3e691a59..c4f267ac827d 100644 --- a/sdk/monitor/azure-monitor-query/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md @@ -17,6 +17,17 @@ ### Other Changes +## 1.2.1 (2024-01-31) + +### Bugs Fixed + +- Fixed certain keyword arguments from not being propagated when using `MetricsQueryClient`. + +### Other Changes + +- Internal updates to generated code. +- Bumped minimum dependency on `azure-core` to `>=1.28.0`. + ## 1.3.0b2 (2023-11-20) ### Other Changes diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py index 657659065191..48115e494b19 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py @@ -154,7 +154,7 @@ def list_metric_namespaces( namespaces. This should be provided as a datetime object. :paramtype start_time: Optional[~datetime.datetime] :return: An iterator like instance of either MetricNamespace or the result of cls(response) - :rtype: ~azure.core.paging.AsyncItemPaged[:class: `~azure.monitor.query.MetricNamespace`] + :rtype: ~azure.core.paging.AsyncItemPaged[~azure.monitor.query.MetricNamespace] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -188,7 +188,7 @@ def list_metric_definitions( :keyword namespace: Metric namespace to query metric definitions for. :paramtype namespace: Optional[str] :return: An iterator like instance of either MetricDefinition or the result of cls(response) - :rtype: ~azure.core.paging.AsyncItemPaged[:class: `~azure.monitor.query.MetricDefinition`] + :rtype: ~azure.core.paging.AsyncItemPaged[~azure.monitor.query.MetricDefinition] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: From 51b9eabca2dab1bd14a0045a41bdacfd67b31f98 Mon Sep 17 00:00:00 2001 From: Simon Moreno <30335873+simorenoh@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:53:55 -0700 Subject: [PATCH 12/28] [Cosmos] fixing bug with not passing kwargs/ response_hook in `create_container_if_not_exists` (#34286) * fixes * Update CHANGELOG.md * fixed missing kwargs * using PR to remove these wrongly-marked limitations --- sdk/cosmos/azure-cosmos/CHANGELOG.md | 1 + sdk/cosmos/azure-cosmos/README.md | 3 --- sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py | 7 ++++++- sdk/cosmos/azure-cosmos/azure/cosmos/database.py | 7 ++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 5f378094c42c..b775baf81794 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -7,6 +7,7 @@ #### Breaking Changes #### Bugs Fixed +* Keyword arguments were not being passed down for `create_container_if_not_exists()` methods. See [PR 34286](https://github.com/Azure/azure-sdk-for-python/pull/34286). #### Other Changes diff --git a/sdk/cosmos/azure-cosmos/README.md b/sdk/cosmos/azure-cosmos/README.md index 663209b674d0..4bd8666c682b 100644 --- a/sdk/cosmos/azure-cosmos/README.md +++ b/sdk/cosmos/azure-cosmos/README.md @@ -153,15 +153,12 @@ Currently, the features below are **not supported**. For alternatives options, c * Group By queries * Queries with COUNT from a DISTINCT subquery: SELECT COUNT (1) FROM (SELECT DISTINCT C.ID FROM C) -* Transactional batch processing * Direct TCP Mode access * Continuation token support for aggregate cross-partition queries like sorting, counting, and distinct. Streamable queries like `SELECT * FROM WHERE` *do* support continuation tokens. * Change Feed: Processor * Change Feed: Read multiple partitions key values * Change Feed: Read specific time -* Change Feed: Read from the beginning -* Change Feed: Pull model * Cross-partition ORDER BY for mixed types * Enabling diagnostics for async query-type methods diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py index 1ec4a443c68d..cc9d1ecfa2a1 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py @@ -310,6 +310,8 @@ async def create_container_if_not_exists( analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None) offer_throughput = kwargs.pop('offer_throughput', None) computed_properties = kwargs.pop("computed_properties", None) + etag = kwargs.pop("etag", None) + match_condition = kwargs.pop("match_condition", None) try: container_proxy = self.get_container_client(id) await container_proxy.read(**kwargs) @@ -324,7 +326,10 @@ async def create_container_if_not_exists( unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, analytical_storage_ttl=analytical_storage_ttl, - computed_properties=computed_properties + computed_properties=computed_properties, + etag=etag, + match_condition=match_condition, + **kwargs ) def get_container_client(self, container: Union[str, ContainerProxy, Dict[str, Any]]) -> ContainerProxy: diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py index b923864aa20f..707c6f03e039 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py @@ -309,6 +309,8 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param """ analytical_storage_ttl = kwargs.pop("analytical_storage_ttl", None) computed_properties = kwargs.pop("computed_properties", None) + etag = kwargs.pop("etag", None) + match_condition = kwargs.pop("match_condition", None) try: container_proxy = self.get_container_client(id) container_proxy.read( @@ -327,7 +329,10 @@ def create_container_if_not_exists( # pylint:disable=docstring-missing-param unique_key_policy=unique_key_policy, conflict_resolution_policy=conflict_resolution_policy, analytical_storage_ttl=analytical_storage_ttl, - computed_properties=computed_properties + computed_properties=computed_properties, + etag=etag, + match_condition=match_condition, + **kwargs ) @distributed_trace From 91fc86f0a35d2344b5454f843ec7a8e09301b2f1 Mon Sep 17 00:00:00 2001 From: Fred Li <51424245+fredms@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:54:07 -0700 Subject: [PATCH 13/28] Remove experimental annotation from provision network (#34690) * Remove experimental annotation from provision network * remove unused import --- .../azure/ai/ml/operations/_feature_store_operations.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_operations.py index fdadea599e2a..25c29bfc7472 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_operations.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/operations/_feature_store_operations.py @@ -14,7 +14,6 @@ from azure.ai.ml._restclient.v2023_08_01_preview.models import ManagedNetworkProvisionOptions 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._experimental import experimental from azure.ai.ml._utils._logger_utils import OpsLogger from azure.ai.ml._utils.utils import camel_to_snake from azure.ai.ml.constants import ManagedServiceIdentityType @@ -505,7 +504,6 @@ def begin_delete(self, name: str, *, delete_dependent_resources: bool = False, * @distributed_trace @monitor_with_activity(ops_logger, "FeatureStore.BeginProvisionNetwork", ActivityType.PUBLICAPI) - @experimental def begin_provision_network( self, *, From 36e3080732bb4340c15a761531072aef24d3d59e Mon Sep 17 00:00:00 2001 From: Jacob Lauzon <96087589+jalauzon-msft@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:13:37 -0700 Subject: [PATCH 14/28] [Storage] Add Peter as Storage CODEOWNER (#34701) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b11b1fdd00cc..32939512c10b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -62,7 +62,7 @@ # ServiceLabel: %Storage # PRLabel: %Storage -/sdk/storage/ @annatisch @jalauzon-msft @vincenttran-msft +/sdk/storage/ @annatisch @jalauzon-msft @vincenttran-msft @weirongw23-msft # AzureSdkOwners: @YalinLi0312 # ServiceLabel: %App Configuration From 428c2b64bba01d33b4e2f5a8486c76832f8dd9e2 Mon Sep 17 00:00:00 2001 From: Leighton Chen Date: Mon, 11 Mar 2024 13:31:32 -0700 Subject: [PATCH 15/28] Add live metrics collection of requests/dependencies/exceptions (#34673) --- .../CHANGELOG.md | 3 + .../README.md | 2 +- .../exporter/_quickpulse/_constants.py | 16 ++ .../exporter/_quickpulse/_exporter.py | 116 +++------- .../exporter/_quickpulse/_live_metrics.py | 107 ++++++++- .../exporter/_quickpulse/_processor.py | 33 +++ .../exporter/_quickpulse/_state.py | 69 ++++++ .../exporter/_quickpulse/_utils.py | 156 ++++++++++++++ .../monitor/opentelemetry/exporter/_utils.py | 2 +- .../tests/quickpulse/test_exporter.py | 14 +- .../tests/quickpulse/test_live_metrics.py | 129 +++++++++++ .../tests/quickpulse/test_processor.py | 44 ++++ .../tests/quickpulse/test_utils.py | 204 ++++++++++++++++++ 13 files changed, 799 insertions(+), 96 deletions(-) create mode 100644 sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_processor.py create mode 100644 sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_state.py create mode 100644 sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_utils.py create mode 100644 sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_processor.py create mode 100644 sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_utils.py diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index 8ca743f46635..d589309891ac 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -4,6 +4,9 @@ ### Features Added +- Add live metrics collection of requests/dependencies/exceptions + ([#34673](https://github.com/Azure/azure-sdk-for-python/pull/34673)) + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md index 5be012c891d6..e5f360932f58 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/README.md @@ -1,6 +1,6 @@ # Microsoft OpenTelemetry exporter for Azure Monitor -The exporter for Azure Monitor allows Python applications to export data from the OpenTelemetry SDK to Azure Monitor. The exporter is intended for users who require advanced configuration or has more complicated telemetry needs that require all of distributed tracing, logging and metrics. If you have simpler configuration requirements, we recommend using the [Azure Monitor OpenTelemetry Distro](https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-enable?tabs=python) instead for a simpler one-line setup. +The exporter for Azure Monitor allows Python applications to export data from the OpenTelemetry SDK to Azure Monitor. The exporter is intended for users who require advanced configuration or have more complicated telemetry needs that require all of distributed tracing, logging and metrics. If you have simpler configuration requirements, we recommend using the [Azure Monitor OpenTelemetry Distro](https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-enable?tabs=python) instead for a simpler one-line setup. Prior to using this SDK, please read and understand [Data Collection Basics](https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-overview?tabs=python), especially the section on [telemetry types](https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-overview?tabs=python#telemetry-types). OpenTelemetry terminology differs from Application Insights terminology so it is important to understand the way the telemetry types map to each other. diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py index b591258f2ee0..94155b73f32c 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py @@ -1,5 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +from enum import Enum + # cSpell:disable # (OpenTelemetry metric name, Quickpulse metric name) @@ -33,4 +35,18 @@ ] ) +# Quickpulse intervals +_SHORT_PING_INTERVAL_SECONDS = 5 +_POST_INTERVAL_SECONDS = 1 +_LONG_PING_INTERVAL_SECONDS = 60 +_POST_CANCEL_INTERVAL_SECONDS = 20 + +# Live metrics data types +class _DocumentIngressDocumentType(Enum): + Request = "Request" + RemoteDependency = "RemoteDependency" + Exception = "Exception" + Event = "Event" + Trace = "Trace" + # cSpell:disable diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py index ffcfb33312d0..630294218ee6 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_exporter.py @@ -1,8 +1,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. -from datetime import datetime, timezone -from enum import Enum -from typing import Any, List, Optional +from typing import Any, Optional from opentelemetry.context import ( _SUPPRESS_INSTRUMENTATION_KEY, @@ -13,16 +11,8 @@ from opentelemetry.sdk.metrics import ( Counter, Histogram, - ObservableCounter, - ObservableGauge, - ObservableUpDownCounter, - UpDownCounter, -) -from opentelemetry.sdk.metrics._internal.point import ( - NumberDataPoint, - HistogramDataPoint, - MetricsData, ) +from opentelemetry.sdk.metrics._internal.point import MetricsData from opentelemetry.sdk.metrics.export import ( AggregationTemporality, MetricExporter, @@ -32,31 +22,33 @@ ) from azure.core.exceptions import HttpResponseError -from azure.monitor.opentelemetry.exporter._quickpulse._constants import _QUICKPULSE_METRIC_NAME_MAPPINGS +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _LONG_PING_INTERVAL_SECONDS, + _POST_CANCEL_INTERVAL_SECONDS, + _POST_INTERVAL_SECONDS, +) from azure.monitor.opentelemetry.exporter._quickpulse._generated._client import QuickpulseClient -from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import ( - DocumentIngress, - MetricPoint, - MonitoringDataPoint, +from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import MonitoringDataPoint +from azure.monitor.opentelemetry.exporter._quickpulse._state import ( + _get_global_quickpulse_state, + _is_ping_state, + _set_global_quickpulse_state, + _get_and_clear_quickpulse_documents, + _QuickpulseState, +) +from azure.monitor.opentelemetry.exporter._quickpulse._utils import ( + _metric_to_quick_pulse_data_points, ) from azure.monitor.opentelemetry.exporter._connection_string_parser import ConnectionStringParser from azure.monitor.opentelemetry.exporter._utils import _ticks_since_dot_net_epoch, PeriodicTask -_APPLICATION_INSIGHTS_METRIC_TEMPORALITIES = { +_QUICKPULSE_METRIC_TEMPORALITIES = { + # Use DELTA temporalities because we want to reset the counts every collection interval Counter: AggregationTemporality.DELTA, Histogram: AggregationTemporality.DELTA, - ObservableCounter: AggregationTemporality.DELTA, - ObservableGauge: AggregationTemporality.CUMULATIVE, - ObservableUpDownCounter: AggregationTemporality.CUMULATIVE, - UpDownCounter: AggregationTemporality.CUMULATIVE, } -_SHORT_PING_INTERVAL_SECONDS = 5 -_POST_INTERVAL_SECONDS = 1 -_LONG_PING_INTERVAL_SECONDS = 60 -_POST_CANCEL_INTERVAL_SECONDS = 20 - class _Response: """Response that encapsulates pipeline response and response headers from @@ -91,7 +83,7 @@ def __init__(self, connection_string: Optional[str]) -> None: MetricExporter.__init__( self, - preferred_temporality=_APPLICATION_INSIGHTS_METRIC_TEMPORALITIES, # type: ignore + preferred_temporality=_QUICKPULSE_METRIC_TEMPORALITIES, # type: ignore ) def export( @@ -116,7 +108,7 @@ def export( data_points = _metric_to_quick_pulse_data_points( metrics_data, base_monitoring_data_point=base_monitoring_data_point, - documents=kwargs.get("documents"), + documents=_get_and_clear_quickpulse_documents(), ) token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True)) @@ -190,16 +182,6 @@ def _ping(self, monitoring_data_point) -> Optional[_Response]: return ping_response -class _QuickpulseState(Enum): - """Current state of quickpulse service. - The numerical value represents the ping/post interval in ms for those states. - """ - - PING_SHORT = _SHORT_PING_INTERVAL_SECONDS - PING_LONG = _LONG_PING_INTERVAL_SECONDS - POST_SHORT = _POST_INTERVAL_SECONDS - - class _QuickpulseMetricReader(MetricReader): def __init__( @@ -208,7 +190,6 @@ def __init__( base_monitoring_data_point: MonitoringDataPoint, ) -> None: self._exporter = exporter - self._quick_pulse_state = _QuickpulseState.PING_SHORT self._base_monitoring_data_point = base_monitoring_data_point self._elapsed_num_seconds = 0 self._worker = PeriodicTask( @@ -224,9 +205,9 @@ def __init__( self._worker.start() def _ticker(self) -> None: - if self._is_ping_state(): + if _is_ping_state(): # Send a ping if elapsed number of request meets the threshold - if self._elapsed_num_seconds % int(self._quick_pulse_state.value) == 0: + if self._elapsed_num_seconds % _get_global_quickpulse_state().value == 0: print("pinging...") ping_response = self._exporter._ping( # pylint: disable=protected-access self._base_monitoring_data_point, @@ -236,22 +217,22 @@ def _ticker(self) -> None: if header and header == "true": print("ping succeeded: switching to post") # Switch state to post if subscribed - self._quick_pulse_state = _QuickpulseState.POST_SHORT + _set_global_quickpulse_state(_QuickpulseState.POST_SHORT) self._elapsed_num_seconds = 0 else: # Backoff after _LONG_PING_INTERVAL_SECONDS (60s) of no successful requests - if self._quick_pulse_state is _QuickpulseState.PING_SHORT and \ + if _get_global_quickpulse_state() is _QuickpulseState.PING_SHORT and \ self._elapsed_num_seconds >= _LONG_PING_INTERVAL_SECONDS: print("ping failed for 60s, switching to pinging every 60s") - self._quick_pulse_state = _QuickpulseState.PING_LONG + _set_global_quickpulse_state(_QuickpulseState.PING_LONG) # TODO: Implement redirect else: # Erroneous ping responses instigate backoff logic # Backoff after _LONG_PING_INTERVAL_SECONDS (60s) of no successful requests - if self._quick_pulse_state is _QuickpulseState.PING_SHORT and \ + if _get_global_quickpulse_state() is _QuickpulseState.PING_SHORT and \ self._elapsed_num_seconds >= _LONG_PING_INTERVAL_SECONDS: print("ping failed for 60s, switching to pinging every 60s") - self._quick_pulse_state = _QuickpulseState.PING_LONG + _set_global_quickpulse_state(_QuickpulseState.PING_LONG) else: print("posting...") try: @@ -262,7 +243,7 @@ def _ticker(self) -> None: # And resume pinging if self._elapsed_num_seconds >= _POST_CANCEL_INTERVAL_SECONDS: print("post failed for 20s, switching to pinging") - self._quick_pulse_state = _QuickpulseState.PING_SHORT + _set_global_quickpulse_state(_QuickpulseState.PING_SHORT) self._elapsed_num_seconds = 0 self._elapsed_num_seconds += 1 @@ -277,7 +258,6 @@ def _receive_metrics( metrics_data, timeout_millis=timeout_millis, base_monitoring_data_point=self._base_monitoring_data_point, - documents=[], ) if result is MetricExportResult.FAILURE: # There is currently no way to propagate unsuccessful metric post so @@ -288,41 +268,3 @@ def _receive_metrics( def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: self._worker.cancel() self._worker.join() - - def _is_ping_state(self): - return self._quick_pulse_state in (_QuickpulseState.PING_SHORT, _QuickpulseState.PING_LONG) - -def _metric_to_quick_pulse_data_points( # pylint: disable=too-many-nested-blocks - metrics_data: OTMetricsData, - base_monitoring_data_point: MonitoringDataPoint, - documents: Optional[List[DocumentIngress]], -) -> List[MonitoringDataPoint]: - metric_points = [] - for resource_metric in metrics_data.resource_metrics: - for scope_metric in resource_metric.scope_metrics: - for metric in scope_metric.metrics: - for point in metric.data.data_points: - if point is not None: - metric_point = MetricPoint( - name=_QUICKPULSE_METRIC_NAME_MAPPINGS[metric.name.lower()], - weight=1, - ) - if isinstance(point, HistogramDataPoint): - metric_point.value = point.sum - elif isinstance(point, NumberDataPoint): - metric_point.value = point.value - else: - metric_point.value = 0 - metric_points.append(metric_point) - return [ - MonitoringDataPoint( - version=base_monitoring_data_point.version, - instance=base_monitoring_data_point.instance, - role_name=base_monitoring_data_point.role_name, - machine_name=base_monitoring_data_point.machine_name, - stream_id=base_monitoring_data_point.stream_id, - timestamp=datetime.now(tz=timezone.utc), - metrics=metric_points, - documents=documents, - ) - ] diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py index 83bb3e073e3d..c84ae7b2a906 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py @@ -3,15 +3,39 @@ import platform from typing import Any, Optional +from opentelemetry.sdk._logs import LogData from opentelemetry.sdk.metrics import MeterProvider -from opentelemetry.sdk.trace.id_generator import RandomIdGenerator from opentelemetry.sdk.resources import Resource +from opentelemetry.sdk.trace import ReadableSpan +from opentelemetry.sdk.trace.id_generator import RandomIdGenerator +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.trace import SpanKind + from azure.monitor.opentelemetry.exporter._generated.models import ContextTagKeys +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _DEPENDENCY_DURATION_NAME, + _DEPENDENCY_FAILURE_RATE_NAME, + _DEPENDENCY_RATE_NAME, + _EXCEPTION_RATE_NAME, + _REQUEST_DURATION_NAME, + _REQUEST_FAILURE_RATE_NAME, + _REQUEST_RATE_NAME, +) from azure.monitor.opentelemetry.exporter._quickpulse._exporter import ( _QuickpulseExporter, _QuickpulseMetricReader, ) from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import MonitoringDataPoint +from azure.monitor.opentelemetry.exporter._quickpulse._state import ( + _QuickpulseState, + _is_post_state, + _append_quickpulse_document, + _set_global_quickpulse_state, +) +from azure.monitor.opentelemetry.exporter._quickpulse._utils import ( + _get_log_record_document, + _get_span_document, +) from azure.monitor.opentelemetry.exporter._utils import ( _get_sdk_version, _populate_part_a_fields, @@ -20,7 +44,7 @@ def enable_live_metrics(**kwargs: Any) -> None: - """Azure Monitor base exporter for OpenTelemetry. + """Live metrics entry point. :keyword str connection_string: The connection string used for your Application Insights resource. :keyword Resource resource: The OpenTelemetry Resource used for this Python application. @@ -29,9 +53,11 @@ def enable_live_metrics(**kwargs: Any) -> None: _QuickpulseManager(kwargs.get('connection_string'), kwargs.get('resource')) +# pylint: disable=protected-access,too-many-instance-attributes class _QuickpulseManager(metaclass=Singleton): def __init__(self, connection_string: Optional[str], resource: Optional[Resource]) -> None: + _set_global_quickpulse_state(_QuickpulseState.PING_SHORT) self._exporter = _QuickpulseExporter(connection_string) part_a_fields = {} if resource: @@ -47,3 +73,80 @@ def __init__(self, connection_string: Optional[str], resource: Optional[Resource ) self._reader = _QuickpulseMetricReader(self._exporter, self._base_monitoring_data_point) self._meter_provider = MeterProvider([self._reader]) + self._meter = self._meter_provider.get_meter("azure_monitor_live_metrics") + + self._request_duration = self._meter.create_histogram( + _REQUEST_DURATION_NAME[0], + "ms", + "live metrics avg request duration in ms" + ) + self._dependency_duration = self._meter.create_histogram( + _DEPENDENCY_DURATION_NAME[0], + "ms", + "live metrics avg dependency duration in ms" + ) + # We use a counter to represent rates per second because collection + # interval is one second so we simply need the number of requests + # within the collection interval + self._request_rate_counter = self._meter.create_counter( + _REQUEST_RATE_NAME[0], + "req/sec", + "live metrics request rate per second" + ) + self._request_failed_rate_counter = self._meter.create_counter( + _REQUEST_FAILURE_RATE_NAME[0], + "req/sec", + "live metrics request failed rate per second" + ) + self._dependency_rate_counter = self._meter.create_counter( + _DEPENDENCY_RATE_NAME[0], + "dep/sec", + "live metrics dependency rate per second" + ) + self._dependency_failure_rate_counter = self._meter.create_counter( + _DEPENDENCY_FAILURE_RATE_NAME[0], + "dep/sec", + "live metrics dependency failure rate per second" + ) + self._exception_rate_counter = self._meter.create_counter( + _EXCEPTION_RATE_NAME[0], + "exc/sec", + "live metrics exception rate per second" + ) + + def _record_span(self, span: ReadableSpan) -> None: + # Only record if in post state + if _is_post_state(): + document = _get_span_document(span) + _append_quickpulse_document(document) + duration_ms = 0 + if span.end_time and span.start_time: + duration_ms = (span.end_time - span.start_time) / 1e9 # type: ignore + # TODO: Spec out what "success" is + success = span.status.is_ok + + if span.kind in (SpanKind.SERVER, SpanKind.CONSUMER): + if success: + self._request_rate_counter.add(1) + else: + self._request_failed_rate_counter.add(1) + self._request_duration.record(duration_ms) + else: + if success: + self._dependency_rate_counter.add(1) + else: + self._dependency_failure_rate_counter.add(1) + self._dependency_duration.record(duration_ms) + + def _record_log_record(self, log_data: LogData) -> None: + # Only record if in post state + if _is_post_state(): + if log_data.log_record: + log_record = log_data.log_record + if log_record.attributes: + document = _get_log_record_document(log_data) + _append_quickpulse_document(document) + exc_type = log_record.attributes.get(SpanAttributes.EXCEPTION_TYPE) + exc_message = log_record.attributes.get(SpanAttributes.EXCEPTION_MESSAGE) + if exc_type is not None or exc_message is not None: + self._exception_rate_counter.add(1) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_processor.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_processor.py new file mode 100644 index 000000000000..2e18253976fb --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_processor.py @@ -0,0 +1,33 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from opentelemetry.sdk._logs import LogData, LogRecordProcessor +from opentelemetry.sdk.trace import ReadableSpan, SpanProcessor + +from azure.monitor.opentelemetry.exporter._quickpulse._live_metrics import _QuickpulseManager + + +# pylint: disable=protected-access +class _QuickpulseLogRecordProcessor(LogRecordProcessor): + + def emit(self, log_data: LogData) -> None: + qpm = _QuickpulseManager._instance + if qpm: + qpm._record_log_record(log_data) + super().emit(log_data) + + def shutdown(self): + pass + + def force_flush(self, timeout_millis: int = 30000): + super().force_flush(timeout_millis=timeout_millis) + + +# pylint: disable=protected-access +class _QuickpulseSpanProcessor(SpanProcessor): + + def on_end(self, span: ReadableSpan) -> None: + qpm = _QuickpulseManager._instance + if qpm: + qpm._record_span(span) + return super().on_end(span) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_state.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_state.py new file mode 100644 index 000000000000..05c78c72ebb5 --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_state.py @@ -0,0 +1,69 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +from enum import Enum +from typing import List + +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _LONG_PING_INTERVAL_SECONDS, + _POST_INTERVAL_SECONDS, + _SHORT_PING_INTERVAL_SECONDS, +) +from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import DocumentIngress + + +class _QuickpulseState(Enum): + """Current state of quickpulse service. + The numerical value represents the ping/post interval in ms for those states. + """ + OFFLINE = 0 + PING_SHORT = _SHORT_PING_INTERVAL_SECONDS + PING_LONG = _LONG_PING_INTERVAL_SECONDS + POST_SHORT = _POST_INTERVAL_SECONDS + + +_GLOBAL_QUICKPULSE_STATE = _QuickpulseState.OFFLINE +_QUICKPULSE_DOCUMENTS: List[DocumentIngress] = [] + +def _set_global_quickpulse_state(state: _QuickpulseState): + # pylint: disable=global-statement + global _GLOBAL_QUICKPULSE_STATE + _GLOBAL_QUICKPULSE_STATE = state + + +def _get_global_quickpulse_state() -> _QuickpulseState: + return _GLOBAL_QUICKPULSE_STATE + + +def is_quickpulse_enabled() -> bool: + return _get_global_quickpulse_state() is not _QuickpulseState.OFFLINE + + +def _is_ping_state() -> bool: + return _get_global_quickpulse_state() in ( + _QuickpulseState.PING_SHORT, + _QuickpulseState.PING_LONG + ) + + +def _is_post_state(): + return _get_global_quickpulse_state() is _QuickpulseState.POST_SHORT + + +def _append_quickpulse_document(document: DocumentIngress): + # pylint: disable=global-statement,global-variable-not-assigned + global _QUICKPULSE_DOCUMENTS + # Limit risk of memory leak by limiting doc length to something manageable + if len(_QUICKPULSE_DOCUMENTS) > 20: + try: + _QUICKPULSE_DOCUMENTS.pop(0) + except IndexError: + pass + _QUICKPULSE_DOCUMENTS.append(document) + + +def _get_and_clear_quickpulse_documents() -> List[DocumentIngress]: + # pylint: disable=global-statement + global _QUICKPULSE_DOCUMENTS + documents = list(_QUICKPULSE_DOCUMENTS) + _QUICKPULSE_DOCUMENTS = [] + return documents diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_utils.py new file mode 100644 index 000000000000..204b47d2ed01 --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_utils.py @@ -0,0 +1,156 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +from datetime import datetime, timedelta, timezone +from typing import List, Optional, Union + +from opentelemetry.sdk._logs import LogData +from opentelemetry.sdk.metrics._internal.point import ( + NumberDataPoint, + HistogramDataPoint, +) +from opentelemetry.sdk.metrics.export import MetricsData as OTMetricsData +from opentelemetry.sdk.trace import ReadableSpan +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.trace import SpanKind +from opentelemetry.util.types import Attributes + +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _DocumentIngressDocumentType, + _QUICKPULSE_METRIC_NAME_MAPPINGS, +) +from azure.monitor.opentelemetry.exporter._quickpulse._generated.models import ( + DocumentIngress, + Exception as ExceptionDocument, + MetricPoint, + MonitoringDataPoint, + RemoteDependency as RemoteDependencyDocument, + Request as RequestDocument, + Trace as TraceDocument, +) +def _metric_to_quick_pulse_data_points( # pylint: disable=too-many-nested-blocks + metrics_data: OTMetricsData, + base_monitoring_data_point: MonitoringDataPoint, + documents: Optional[List[DocumentIngress]], +) -> List[MonitoringDataPoint]: + metric_points = [] + for resource_metric in metrics_data.resource_metrics: + for scope_metric in resource_metric.scope_metrics: + for metric in scope_metric.metrics: + for point in metric.data.data_points: + if point is not None: + metric_point = MetricPoint( + name=_QUICKPULSE_METRIC_NAME_MAPPINGS[metric.name.lower()], + weight=1, + ) + if isinstance(point, HistogramDataPoint): + if point.count > 0: + metric_point.value = point.sum / point.count + else: + metric_point.value = 0 + elif isinstance(point, NumberDataPoint): + metric_point.value = point.value + else: + metric_point.value = 0 + metric_points.append(metric_point) + return [ + MonitoringDataPoint( + version=base_monitoring_data_point.version, + instance=base_monitoring_data_point.instance, + role_name=base_monitoring_data_point.role_name, + machine_name=base_monitoring_data_point.machine_name, + stream_id=base_monitoring_data_point.stream_id, + timestamp=datetime.now(tz=timezone.utc), + metrics=metric_points, + documents=documents, + ) + ] + +# mypy: disable-error-code="assignment,union-attr" +def _get_span_document(span: ReadableSpan) -> Union[RemoteDependencyDocument, RequestDocument]: + duration = 0 + if span.end_time and span.start_time: + duration = span.end_time - span.start_time + status_code = span.attributes.get(SpanAttributes.HTTP_STATUS_CODE, "") # type: ignore + grpc_status_code = span.attributes.get(SpanAttributes.RPC_GRPC_STATUS_CODE, "") # type: ignore + span_kind = span.kind + url = _get_url(span_kind, span.attributes) + if span_kind in (SpanKind.CLIENT, SpanKind.PRODUCER, SpanKind.INTERNAL): + document = RemoteDependencyDocument( + document_type=_DocumentIngressDocumentType.RemoteDependency.value, + name=span.name, + command_name=url, + result_code=str(status_code), + duration=_ns_to_iso8601_string(duration), + ) + else: + if status_code: + code = str(status_code) + else: + code = str(grpc_status_code) + document = RequestDocument( + document_type=_DocumentIngressDocumentType.Request.value, + name=span.name, + url=url, + response_code=code, + duration=_ns_to_iso8601_string(duration), + ) + return document + +# mypy: disable-error-code="assignment" +def _get_log_record_document(log_data: LogData) -> Union[ExceptionDocument, TraceDocument]: + exc_type = log_data.log_record.attributes.get(SpanAttributes.EXCEPTION_TYPE) # type: ignore + exc_message = log_data.log_record.attributes.get(SpanAttributes.EXCEPTION_MESSAGE) # type: ignore + if exc_type is not None or exc_message is not None: + document = ExceptionDocument( + document_type=_DocumentIngressDocumentType.Exception.value, + exception_type=str(exc_type), + exception_message=str(exc_message), + ) + else: + document = TraceDocument( + document_type=_DocumentIngressDocumentType.Trace.value, + message=log_data.log_record.body, + ) + return document + + +# mypy: disable-error-code="assignment" +# pylint: disable=no-else-return +def _get_url(span_kind: SpanKind, attributes: Attributes) -> str: + if not attributes: + return "" + http_method = attributes.get(SpanAttributes.HTTP_METHOD) + if http_method: + http_scheme = attributes.get(SpanAttributes.HTTP_SCHEME) + # Client + if span_kind in (SpanKind.CLIENT, SpanKind.PRODUCER): + http_url = attributes.get(SpanAttributes.HTTP_URL) + if http_url: + return str(http_url) + + host = attributes.get(SpanAttributes.NET_PEER_NAME) + port = attributes.get(SpanAttributes.NET_PEER_PORT, "") + ip = attributes.get(SpanAttributes.NET_PEER_IP) + if http_scheme: + if host: + return f"{http_scheme}://{host}:{port}" + else: + return f"{http_scheme}://{ip}:{port}" + else: # Server + host = attributes.get(SpanAttributes.NET_HOST_NAME) + port = attributes.get(SpanAttributes.NET_HOST_PORT) + http_target = attributes.get(SpanAttributes.HTTP_TARGET, "") + if http_scheme and host: + http_host = attributes.get(SpanAttributes.HTTP_HOST) + if http_host: + return f"{http_scheme}://{http_host}:{port}{http_target}" + return "" + + +def _ns_to_iso8601_string(nanoseconds: int) -> str: + seconds, nanoseconds_remainder = divmod(nanoseconds, 1e9) + microseconds = nanoseconds_remainder // 1000 # Convert nanoseconds to microseconds + dt = datetime.utcfromtimestamp(seconds) + dt_microseconds = timedelta(microseconds=microseconds) + dt_with_microseconds = dt + dt_microseconds + return dt_with_microseconds.isoformat() diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py index a1510d736290..9ef51c6202f5 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py @@ -116,7 +116,7 @@ def _getlocale(): } -def ns_to_duration(nanoseconds: int): +def ns_to_duration(nanoseconds: int) -> str: value = (nanoseconds + 500000) // 1000000 # duration in milliseconds value, microseconds = divmod(value, 1000) value, seconds = divmod(value, 60) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_exporter.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_exporter.py index d053b3da4e59..18f40e87c303 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_exporter.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_exporter.py @@ -27,6 +27,11 @@ _Response, _UnsuccessfulQuickPulsePostError, ) +from azure.monitor.opentelemetry.exporter._quickpulse._state import ( + _get_global_quickpulse_state, + _set_global_quickpulse_state, + _QuickpulseState, +) def throw(exc_type, *args, **kwargs): @@ -39,6 +44,7 @@ def func(*_args, **_kwargs): class TestQuickpulse(unittest.TestCase): @classmethod def setUpClass(cls): + _set_global_quickpulse_state(_QuickpulseState.PING_SHORT) cls._resource = Resource.create( { ResourceAttributes.SERVICE_INSTANCE_ID: "test_instance", @@ -209,10 +215,9 @@ def test_quickpulsereader_init(self, task_mock): self._data_point, ) self.assertEqual(reader._exporter, self._exporter) - self.assertEqual(reader._quick_pulse_state, _QuickpulseState.PING_SHORT) + self.assertEqual(_get_global_quickpulse_state(), _QuickpulseState.PING_SHORT) self.assertEqual(reader._base_monitoring_data_point, self._data_point) self.assertEqual(reader._elapsed_num_seconds, 0) - self.assertEqual(reader._elapsed_num_seconds, 0) self.assertEqual(reader._worker, task_inst_mock) task_mock.assert_called_with( interval=_POST_INTERVAL_SECONDS, @@ -231,7 +236,7 @@ def test_quickpulsereader_ticker_ping_true(self, task_mock, ping_mock): self._exporter, self._data_point, ) - reader._quick_pulse_state = _QuickpulseState.PING_SHORT + _set_global_quickpulse_state(_QuickpulseState.PING_SHORT) reader._elapsed_num_seconds = _QuickpulseState.PING_SHORT.value ping_mock.return_value = _Response( None, @@ -244,7 +249,7 @@ def test_quickpulsereader_ticker_ping_true(self, task_mock, ping_mock): ping_mock.assert_called_once_with( self._data_point, ) - self.assertEqual(reader._quick_pulse_state, _QuickpulseState.POST_SHORT) + self.assertEqual(_get_global_quickpulse_state(), _QuickpulseState.POST_SHORT) self.assertEqual(reader._elapsed_num_seconds, 1) # TODO: Other ticker cases @@ -267,7 +272,6 @@ def test_quickpulsereader_receive_metrics(self, task_mock, export_mock): self._metrics_data, timeout_millis=20_000, base_monitoring_data_point=self._data_point, - documents=[], ) @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._exporter._QuickpulseExporter.export") diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py index 0b0f512865bf..f1699bd6beb7 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py @@ -7,6 +7,8 @@ from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.resources import Resource, ResourceAttributes +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.trace import SpanKind from azure.monitor.opentelemetry.exporter._generated.models import ContextTagKeys from azure.monitor.opentelemetry.exporter._quickpulse._exporter import ( @@ -17,6 +19,11 @@ enable_live_metrics, _QuickpulseManager, ) +from azure.monitor.opentelemetry.exporter._quickpulse._state import ( + _get_global_quickpulse_state, + _set_global_quickpulse_state, + _QuickpulseState, +) from azure.monitor.opentelemetry.exporter._utils import ( _get_sdk_version, _populate_part_a_fields, @@ -36,6 +43,13 @@ def test_enable_live_metrics(self, manager_mock): class TestQuickpulseManager(unittest.TestCase): + @classmethod + def setUpClass(cls): + _set_global_quickpulse_state(_QuickpulseState.PING_SHORT) + + @classmethod + def tearDownClass(cls): + _set_global_quickpulse_state(_QuickpulseState.OFFLINE) @mock.patch("opentelemetry.sdk.trace.id_generator.RandomIdGenerator.generate_trace_id") def test_init(self, generator_mock): @@ -51,6 +65,7 @@ def test_init(self, generator_mock): connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", resource=resource, ) + self.assertEqual(_get_global_quickpulse_state(), _QuickpulseState.PING_SHORT) self.assertTrue(isinstance(qpm._exporter, _QuickpulseExporter)) self.assertEqual( qpm._exporter._live_endpoint, @@ -118,3 +133,117 @@ def test_singleton(self): qpm2._base_monitoring_data_point.role_name, part_a_fields.get(ContextTagKeys.AI_CLOUD_ROLE, "") ) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._append_quickpulse_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._get_span_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._is_post_state") + def test_record_span_server_success(self, post_state_mock, span_doc_mock, append_doc_mock): + post_state_mock.return_value = True + span_doc = mock.Mock() + span_doc_mock.return_value = span_doc + span_mock = mock.Mock() + span_mock.end_time = 10 + span_mock.start_time = 5 + span_mock.status.is_ok = True + span_mock.kind = SpanKind.SERVER + qpm = _QuickpulseManager( + connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", + resource=Resource.create(), + ) + qpm._request_rate_counter = mock.Mock() + qpm._request_duration = mock.Mock() + qpm._record_span(span_mock) + append_doc_mock.assert_called_once_with(span_doc) + qpm._request_rate_counter.add.assert_called_once_with(1) + qpm._request_duration.record.assert_called_once_with(5 / 1e9) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._append_quickpulse_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._get_span_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._is_post_state") + def test_record_span_server_failure(self, post_state_mock, span_doc_mock, append_doc_mock): + post_state_mock.return_value = True + span_doc = mock.Mock() + span_doc_mock.return_value = span_doc + span_mock = mock.Mock() + span_mock.end_time = 10 + span_mock.start_time = 5 + span_mock.status.is_ok = False + span_mock.kind = SpanKind.SERVER + qpm = _QuickpulseManager( + connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", + resource=Resource.create(), + ) + qpm._request_failed_rate_counter = mock.Mock() + qpm._request_duration = mock.Mock() + qpm._record_span(span_mock) + append_doc_mock.assert_called_once_with(span_doc) + qpm._request_failed_rate_counter.add.assert_called_once_with(1) + qpm._request_duration.record.assert_called_once_with(5 / 1e9) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._append_quickpulse_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._get_span_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._is_post_state") + def test_record_span_dep_success(self, post_state_mock, span_doc_mock, append_doc_mock): + post_state_mock.return_value = True + span_doc = mock.Mock() + span_doc_mock.return_value = span_doc + span_mock = mock.Mock() + span_mock.end_time = 10 + span_mock.start_time = 5 + span_mock.status.is_ok = True + span_mock.kind = SpanKind.CLIENT + qpm = _QuickpulseManager( + connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", + resource=Resource.create(), + ) + qpm._dependency_rate_counter = mock.Mock() + qpm._dependency_duration = mock.Mock() + qpm._record_span(span_mock) + append_doc_mock.assert_called_once_with(span_doc) + qpm._dependency_rate_counter.add.assert_called_once_with(1) + qpm._dependency_duration.record.assert_called_once_with(5 / 1e9) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._append_quickpulse_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._get_span_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._is_post_state") + def test_record_span_dep_failure(self, post_state_mock, span_doc_mock, append_doc_mock): + post_state_mock.return_value = True + span_doc = mock.Mock() + span_doc_mock.return_value = span_doc + span_mock = mock.Mock() + span_mock.end_time = 10 + span_mock.start_time = 5 + span_mock.status.is_ok = False + span_mock.kind = SpanKind.CLIENT + qpm = _QuickpulseManager( + connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", + resource=Resource.create(), + ) + qpm._dependency_failure_rate_counter = mock.Mock() + qpm._dependency_duration = mock.Mock() + qpm._record_span(span_mock) + append_doc_mock.assert_called_once_with(span_doc) + qpm._dependency_failure_rate_counter.add.assert_called_once_with(1) + qpm._dependency_duration.record.assert_called_once_with(5 / 1e9) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._append_quickpulse_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._get_log_record_document") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics._is_post_state") + def test_record_log_exception(self, post_state_mock, log_doc_mock, append_doc_mock): + post_state_mock.return_value = True + log_record_doc = mock.Mock() + log_doc_mock.return_value = log_record_doc + log_data_mock = mock.Mock() + attributes = { + SpanAttributes.EXCEPTION_TYPE: "exc_type", + SpanAttributes.EXCEPTION_MESSAGE: "exc_msg", + } + log_data_mock.log_record.attributes = attributes + qpm = _QuickpulseManager( + connection_string="InstrumentationKey=4321abcd-5678-4efa-8abc-1234567890ac;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/", + resource=Resource.create(), + ) + qpm._exception_rate_counter = mock.Mock() + qpm._record_log_record(log_data_mock) + append_doc_mock.assert_called_once_with(log_record_doc) + qpm._exception_rate_counter.add.assert_called_once_with(1) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_processor.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_processor.py new file mode 100644 index 000000000000..f3948b31e593 --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_processor.py @@ -0,0 +1,44 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +import unittest +from unittest import mock + +from azure.monitor.opentelemetry.exporter._quickpulse._processor import ( + _QuickpulseLogRecordProcessor, + _QuickpulseSpanProcessor, +) +from azure.monitor.opentelemetry.exporter._quickpulse._live_metrics import _QuickpulseManager + + +class TestQuickpulseLogRecordProcessor(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.qpm = mock.Mock() + _QuickpulseManager._instance = cls.qpm + + @classmethod + def tearDownClass(cls) -> None: + _QuickpulseManager._instance = None + + def test_emit(self): + processor = _QuickpulseLogRecordProcessor() + log_data = mock.Mock() + processor.emit(log_data) + self.qpm._record_log_record.assert_called_once_with(log_data) + + +class TestQuickpulseSpanProcessor(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.qpm = mock.Mock() + _QuickpulseManager._instance = cls.qpm + + @classmethod + def tearDownClass(cls) -> None: + _QuickpulseManager._instance = None + + def test_on_end(self): + processor = _QuickpulseSpanProcessor() + span = mock.Mock() + processor.on_end(span) + self.qpm._record_span.assert_called_once_with(span) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_utils.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_utils.py new file mode 100644 index 000000000000..ea03e61f5a7d --- /dev/null +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_utils.py @@ -0,0 +1,204 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +from datetime import datetime +import unittest +from unittest import mock + +from opentelemetry.sdk.metrics.export import HistogramDataPoint, NumberDataPoint +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.trace import SpanKind + +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _COMMITTED_BYTES_NAME, + _DocumentIngressDocumentType, +) +from azure.monitor.opentelemetry.exporter._quickpulse._generated.models._models import ( + Exception, + MetricPoint, + MonitoringDataPoint, + RemoteDependency, + Request, + Trace, +) +from azure.monitor.opentelemetry.exporter._quickpulse._utils import ( + _get_span_document, + _get_log_record_document, + _metric_to_quick_pulse_data_points, +) + + +class TestUtils(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.base_mdp = MonitoringDataPoint( + version=1.0, + instance="test_instance", + role_name="test_role_name", + machine_name="test_machine_name", + stream_id="test_stream_id" + ) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils.datetime") + def test_metric_to_qp_data_point_hist(self, datetime_mock): + point = HistogramDataPoint( + {}, + 0, + 0, + 2, + 10, + [1,1,0], + [0,10,20], + 0, + 5, + ) + metric = mock.Mock() + metric.name = _COMMITTED_BYTES_NAME[0] + metric.data.data_points = [point] + scope_metric = mock.Mock() + scope_metric.metrics = [metric] + resource_metric = mock.Mock() + resource_metric.scope_metrics = [scope_metric] + metric_data = mock.Mock() + metric_data.resource_metrics = [resource_metric] + metric_point = MetricPoint( + name=_COMMITTED_BYTES_NAME[1], + weight=1, + value=5 + ) + documents = [mock.Mock()] + date_now = datetime.now() + datetime_mock.now.return_value = date_now + mdp = _metric_to_quick_pulse_data_points(metric_data, self.base_mdp, documents)[0] + self.assertEqual(mdp.version, self.base_mdp.version) + self.assertEqual(mdp.instance, self.base_mdp.instance) + self.assertEqual(mdp.role_name, self.base_mdp.role_name) + self.assertEqual(mdp.machine_name, self.base_mdp.machine_name) + self.assertEqual(mdp.stream_id, self.base_mdp.stream_id) + self.assertEqual(mdp.timestamp, date_now) + self.assertEqual(mdp.metrics, [metric_point]) + self.assertEqual(mdp.documents, documents) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils.datetime") + def test_metric_to_qp_data_point_num(self, datetime_mock): + point = NumberDataPoint( + {}, + 0, + 0, + 7, + ) + metric = mock.Mock() + metric.name = _COMMITTED_BYTES_NAME[0] + metric.data.data_points = [point] + scope_metric = mock.Mock() + scope_metric.metrics = [metric] + resource_metric = mock.Mock() + resource_metric.scope_metrics = [scope_metric] + metric_data = mock.Mock() + metric_data.resource_metrics = [resource_metric] + metric_point = MetricPoint( + name=_COMMITTED_BYTES_NAME[1], + weight=1, + value=7 + ) + documents = [mock.Mock()] + date_now = datetime.now() + datetime_mock.now.return_value = date_now + mdp = _metric_to_quick_pulse_data_points(metric_data, self.base_mdp, documents)[0] + self.assertEqual(mdp.version, self.base_mdp.version) + self.assertEqual(mdp.instance, self.base_mdp.instance) + self.assertEqual(mdp.role_name, self.base_mdp.role_name) + self.assertEqual(mdp.machine_name, self.base_mdp.machine_name) + self.assertEqual(mdp.stream_id, self.base_mdp.stream_id) + self.assertEqual(mdp.timestamp, date_now) + self.assertEqual(mdp.metrics, [metric_point]) + self.assertEqual(mdp.documents, documents) + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._ns_to_iso8601_string") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._get_url") + def test_get_span_document_client(self, url_mock, iso_mock): + span_mock = mock.Mock() + span_mock.name = "test_span" + span_mock.end_time = 10 + span_mock.start_time = 4 + span_mock.attributes = { + SpanAttributes.HTTP_STATUS_CODE: "200", + SpanAttributes.RPC_GRPC_STATUS_CODE: "400", + } + span_mock.kind = SpanKind.CLIENT + url_mock.return_value = "test_url" + iso_mock.return_value = "1000" + doc = _get_span_document(span_mock) + self.assertTrue(isinstance(doc, RemoteDependency)) + self.assertEqual(doc.document_type, _DocumentIngressDocumentType.RemoteDependency.value) + self.assertEqual(doc.name, "test_span") + self.assertEqual(doc.command_name, "test_url") + self.assertEqual(doc.result_code, "200") + self.assertEqual(doc.duration, "1000") + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._ns_to_iso8601_string") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._get_url") + def test_get_span_document_server(self, url_mock, iso_mock): + span_mock = mock.Mock() + span_mock.name = "test_span" + span_mock.end_time = 10 + span_mock.start_time = 4 + span_mock.attributes = { + SpanAttributes.HTTP_STATUS_CODE: "200", + SpanAttributes.RPC_GRPC_STATUS_CODE: "400", + } + span_mock.kind = SpanKind.SERVER + url_mock.return_value = "test_url" + iso_mock.return_value = "1000" + doc = _get_span_document(span_mock) + self.assertTrue(isinstance(doc, Request)) + self.assertEqual(doc.document_type, _DocumentIngressDocumentType.Request.value) + self.assertEqual(doc.name, "test_span") + self.assertEqual(doc.url, "test_url") + self.assertEqual(doc.response_code, "200") + self.assertEqual(doc.duration, "1000") + + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._ns_to_iso8601_string") + @mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._utils._get_url") + def test_get_span_document_server_grpc_status(self, url_mock, iso_mock): + span_mock = mock.Mock() + span_mock.name = "test_span" + span_mock.end_time = 10 + span_mock.start_time = 4 + span_mock.attributes = { + SpanAttributes.RPC_GRPC_STATUS_CODE: "400", + } + span_mock.kind = SpanKind.SERVER + url_mock.return_value = "test_url" + iso_mock.return_value = "1000" + doc = _get_span_document(span_mock) + self.assertTrue(isinstance(doc, Request)) + self.assertEqual(doc.document_type, _DocumentIngressDocumentType.Request.value) + self.assertEqual(doc.name, "test_span") + self.assertEqual(doc.url, "test_url") + self.assertEqual(doc.response_code, "400") + self.assertEqual(doc.duration, "1000") + + def test_get_log_record_document_server_exc(self): + log_record = mock.Mock() + log_record.attributes = { + SpanAttributes.EXCEPTION_TYPE: "exc_type", + SpanAttributes.EXCEPTION_MESSAGE: "exc_message", + } + log_data = mock.Mock() + log_data.log_record = log_record + doc = _get_log_record_document(log_data) + self.assertTrue(isinstance(doc, Exception)) + self.assertEqual(doc.document_type, _DocumentIngressDocumentType.Exception.value) + self.assertEqual(doc.exception_type, "exc_type") + self.assertEqual(doc.exception_message, "exc_message") + + def test_get_log_record_document_server_exc(self): + log_record = mock.Mock() + log_record.attributes = {} + log_record.body = "body" + log_data = mock.Mock() + log_data.log_record = log_record + doc = _get_log_record_document(log_data) + self.assertTrue(isinstance(doc, Trace)) + self.assertEqual(doc.document_type, _DocumentIngressDocumentType.Trace.value) + self.assertEqual(doc.message, "body") From 5170e10c70b7f0ec630918863942f1d78a2b30ce Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:07:45 -0400 Subject: [PATCH 16/28] Skip env processing on matrix import step (#34728) Co-authored-by: Ben Broderick Phillips --- .../scripts/job-matrix/job-matrix-functions.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 index 198d68f00f7f..f20dbe5281b0 100644 --- a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 +++ b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 @@ -96,7 +96,8 @@ function GenerateMatrix( [String]$displayNameFilter = ".*", [Array]$filters = @(), [Array]$replace = @(), - [Array]$nonSparseParameters = @() + [Array]$nonSparseParameters = @(), + [Switch]$skipEnvironmentVariables ) { $matrixParameters, $importedMatrix, $combinedDisplayNameLookup = ` ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup @@ -124,7 +125,9 @@ function GenerateMatrix( $matrix = FilterMatrix $matrix $filters $matrix = ProcessReplace $matrix $replace $combinedDisplayNameLookup - $matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup + if (!$skipEnvironmentVariables) { + $matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup + } $matrix = FilterMatrixDisplayName $matrix $displayNameFilter return $matrix } @@ -427,10 +430,14 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n exit 1 } $importedMatrixConfig = GetMatrixConfigFromFile (Get-Content -Raw $importPath) + # Add skipEnvironmentVariables so we don't process environment variables on import + # because we want top level filters to work against the the env key, not the value. + # The environment variables will get resolved after the import. $importedMatrix = GenerateMatrix ` -config $importedMatrixConfig ` -selectFromMatrixType $selection ` - -nonSparseParameters $nonSparseParameters + -nonSparseParameters $nonSparseParameters ` + -skipEnvironmentVariables $combinedDisplayNameLookup = $importedMatrixConfig.displayNamesLookup foreach ($lookup in $displayNamesLookup.GetEnumerator()) { From 4207b9f110dceb06adf7cd285e5c264ff2245a33 Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:19:26 -0700 Subject: [PATCH 17/28] Remaining livetest matrices, `ci.yml` uses `image.yml` variables (#34727) * ensure that image.yml is populated everywhere * update ci.yml to also use the variables as provided by image.yml * update gitignore so that our updates don't break anyone's analyze * ensure analyze weekly runs on the correct job --- .vscode/cspell.json | 3 ++ eng/pipelines/templates/jobs/ci.yml | 28 +++++++++---------- eng/pipelines/templates/jobs/live.tests.yml | 1 + .../templates/stages/archetype-sdk-client.yml | 1 + .../templates/stages/platform-matrix-ai.json | 10 +++---- .../stages/python-analyze-weekly.yml | 9 ++++-- .../phonenumbers-livetest-matrix.json | 20 ++++++------- sdk/cosmos/cosmos-emulator-matrix.json | 2 +- sdk/identity/platform-matrix-integration.json | 4 +-- sdk/identity/platform-matrix.json | 4 +-- .../azure-keyvault-keys/platform-matrix.json | 4 +-- sdk/storage/platform-matrix-all-versions.json | 10 +++---- 12 files changed, 52 insertions(+), 44 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index ca21e5ade2ac..2fc6fd283d29 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -454,6 +454,9 @@ "amltemp", "deserializers", "dicom", + "WINDOWSVMIMAGE", + "LINUXVMIMAGE", + "MACVMIMAGE" ], "overrides": [ { diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index f30d5b0a9ed3..1cf52e53ce43 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -72,8 +72,8 @@ jobs: timeoutInMinutes: 90 pool: - name: azsdk-pool-mms-ubuntu-2004-general - image: azsdk-pool-mms-ubuntu-2004-1espt + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) os: linux steps: @@ -93,8 +93,8 @@ jobs: timeoutInMinutes: 90 pool: - name: azsdk-pool-mms-ubuntu-2004-general - image: azsdk-pool-mms-ubuntu-2004-1espt + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) os: linux steps: @@ -114,8 +114,8 @@ jobs: timeoutInMinutes: 90 pool: - name: azsdk-pool-mms-win-2022-general - image: azsdk-pool-mms-win-2022-1espt + name: $(WINDOWSPOOL) + image: $(WINDOWSVMIMAGE) os: windows steps: @@ -135,8 +135,8 @@ jobs: timeoutInMinutes: 90 pool: - name: 'Azure Pipelines' - vmImage: macos-11 + name: $(MACPOOL) + vmImage: $(MACVMIMAGE) os: macOS steps: @@ -161,8 +161,8 @@ jobs: timeoutInMinutes: 90 pool: - name: azsdk-pool-mms-ubuntu-2004-general - image: azsdk-pool-mms-ubuntu-2004-1espt + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) os: linux steps: @@ -197,8 +197,8 @@ jobs: timeoutInMinutes: 90 pool: - name: azsdk-pool-mms-ubuntu-2004-general - image: azsdk-pool-mms-ubuntu-2004-1espt + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) os: linux steps: @@ -223,8 +223,8 @@ jobs: - 'Build_Extended' pool: - name: azsdk-pool-mms-ubuntu-2004-general - image: azsdk-pool-mms-ubuntu-2004-1espt + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) os: linux steps: diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index fb8fc5acee78..ac41fda33243 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -74,6 +74,7 @@ jobs: variables: - template: ../variables/globals.yml + - template: ../variables/image.yml - name: skipComponentGovernanceDetection value: true diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 08be0b672594..b38a73fc6c5b 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -146,6 +146,7 @@ extends: variables: - template: /eng/pipelines/templates/variables/globals.yml@self + - template: /eng/pipelines/templates/variables/image.yml@self # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. - ${{if and(in(variables['Build.Reason'], 'Manual', ''), eq(variables['System.TeamProject'], 'internal'))}}: diff --git a/eng/pipelines/templates/stages/platform-matrix-ai.json b/eng/pipelines/templates/stages/platform-matrix-ai.json index f46b166ac1af..6a056ce2280b 100644 --- a/eng/pipelines/templates/stages/platform-matrix-ai.json +++ b/eng/pipelines/templates/stages/platform-matrix-ai.json @@ -6,9 +6,9 @@ }, "matrix": { "Agent": { - "windows-2022": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general" }, - "ubuntu-20.04": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" }, - "macos-11": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines" } + "windows-2022": { "OSVmImage": "env:WINDOWSVMIMAGE", "Pool": "env:WINDOWSPOOL" }, + "ubuntu-20.04": { "OSVmImage": "env:LINUXVMIMAGE", "Pool": "env:LINUXPOOL" }, + "macos-11": { "OSVmImage": "env:MACVMIMAGE", "Pool": "env:MACPOOL" } }, "PythonVersion": ["3.8", "3.10", "3.11" ], "CoverageArg": "--disablecov", @@ -18,8 +18,8 @@ { "CoverageConfig": { "ubuntu2004_39_coverage": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "PythonVersion": "3.9", "CoverageArg": "", "TestSamples": "false" diff --git a/eng/pipelines/templates/stages/python-analyze-weekly.yml b/eng/pipelines/templates/stages/python-analyze-weekly.yml index 674a517352f8..aafcdd8ec38b 100644 --- a/eng/pipelines/templates/stages/python-analyze-weekly.yml +++ b/eng/pipelines/templates/stages/python-analyze-weekly.yml @@ -19,11 +19,14 @@ stages: timeoutInMinutes: 90 variables: - PythonVersion: '3.8' + - template: /eng/pipelines/templates/variables/image.yml + - name: PythonVersion + value: '3.8' pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: MMSUbuntu20.04 + name: $(LINUXPOOL) + vmImage: $(LINUXVMIMAGE) + os: linux steps: - task: UsePythonVersion@0 diff --git a/sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json b/sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json index 49064e5cc032..3a21c84b93ad 100644 --- a/sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json +++ b/sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json @@ -7,19 +7,19 @@ "matrix": { "Agent": { "ubuntu-20.04": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "true" }, "windows-2022": { - "OSVmImage": "MMS2022", - "Pool": "azsdk-pool-mms-win-2022-general", + "OSVmImage": "env:WINDOWSVMIMAGE", + "Pool": "env:WINDOWSPOOL", "AZURE_TEST_AGENT": "WINDOWS_2019_PYTHON36", "COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false" }, "macos-11": { - "OSVmImage": "macos-11", - "Pool": "Azure Pipelines", + "OSVmImage": "env:MACVMIMAGE", + "Pool": "env:MACPOOL", "AZURE_TEST_AGENT": "MACOS_1015_PYTHON37", "COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false" } @@ -32,8 +32,8 @@ { "CoverageConfig": { "ubuntu2004_39_coverage": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "PythonVersion": "3.9", "CoverageArg": "", "TestSamples": "false", @@ -45,8 +45,8 @@ { "Config": { "Ubuntu2004_3120": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "PythonVersion": "3.12", "CoverageArg": "--disablecov", "TestSamples": "false", diff --git a/sdk/cosmos/cosmos-emulator-matrix.json b/sdk/cosmos/cosmos-emulator-matrix.json index f6e22cd8d376..72daff0c3855 100644 --- a/sdk/cosmos/cosmos-emulator-matrix.json +++ b/sdk/cosmos/cosmos-emulator-matrix.json @@ -6,7 +6,7 @@ }, "matrix": { "Agent": { - "windows-2022": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general" } + "windows-2022": { "OSVmImage": "env:WINDOWSVMIMAGE", "Pool": "env:WINDOWSPOOL" } }, "EmulatorConfig": { "Emulator Tests Python 3.8": { diff --git a/sdk/identity/platform-matrix-integration.json b/sdk/identity/platform-matrix-integration.json index 3f096b3c7b96..54959d7ab218 100644 --- a/sdk/identity/platform-matrix-integration.json +++ b/sdk/identity/platform-matrix-integration.json @@ -3,8 +3,8 @@ { "Agent": { "identity-integration": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "ArmTemplateParameters": "@{ ProvisionLiveResources = $true }" } }, diff --git a/sdk/identity/platform-matrix.json b/sdk/identity/platform-matrix.json index cf9119ab271f..32243683c9c4 100644 --- a/sdk/identity/platform-matrix.json +++ b/sdk/identity/platform-matrix.json @@ -9,8 +9,8 @@ { "Config": { "ubuntu_20.04_3.8_msal": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "PythonVersion": "3.8", "CoverageArg": "--disablecov", "InjectedPackages": "git+https://github.com/AzureAD/microsoft-authentication-library-for-python@dev", diff --git a/sdk/keyvault/azure-keyvault-keys/platform-matrix.json b/sdk/keyvault/azure-keyvault-keys/platform-matrix.json index 4a4601c5b693..7f0a01ac0315 100644 --- a/sdk/keyvault/azure-keyvault-keys/platform-matrix.json +++ b/sdk/keyvault/azure-keyvault-keys/platform-matrix.json @@ -3,8 +3,8 @@ { "Agent": { "ubuntu-20.04_ManagedHSM": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "ArmTemplateParameters": "@{ enableHsm = $true }" } }, diff --git a/sdk/storage/platform-matrix-all-versions.json b/sdk/storage/platform-matrix-all-versions.json index 41bfe0869a02..3ffc9af1c078 100644 --- a/sdk/storage/platform-matrix-all-versions.json +++ b/sdk/storage/platform-matrix-all-versions.json @@ -6,9 +6,9 @@ }, "matrix": { "Agent": { - "Ubuntu-20.04": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" }, - "windows-2022": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general" }, - "macos-11": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines" } + "Ubuntu-20.04": { "OSVmImage": "env:LINUXVMIMAGE", "Pool": "env:LINUXPOOL" }, + "windows-2022": { "OSVmImage": "env:WINDOWSVMIMAGE", "Pool": "env:WINDOWSPOOL" }, + "macos-11": { "OSVmImage": "env:MACVMIMAGE", "Pool": "env:MACPOOL" } }, "PythonVersion": [ "3.8", "3.9", "3.10", "3.11" ], "CoverageArg": "--disablecov", @@ -27,8 +27,8 @@ { "CoverageConfig": { "ubuntu2004_pypy39": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "env:LINUXVMIMAGE", + "Pool": "env:LINUXPOOL", "PythonVersion": "pypy3.9", "CoverageArg": "--disablecov", "TestSamples": "false" From 8f8ec650f068fac608f6ed3eb847a4d855fa8380 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Mon, 11 Mar 2024 18:06:26 -0700 Subject: [PATCH 18/28] [Monitor Query] Update swagger (#34614) The swagger file are updated and the code is regenerated. Signed-off-by: Paul Van Eck --- sdk/monitor/azure-monitor-query/assets.json | 2 +- .../query/_generated/_serialization.py | 31 +++++------- .../_generated/aio/operations/_operations.py | 12 ----- .../query/_generated/metrics/_client.py | 3 ++ .../_generated/metrics/_configuration.py | 6 +++ .../_generated/metrics/_serialization.py | 31 +++++------- .../query/_generated/metrics/aio/_client.py | 3 ++ .../_generated/metrics/aio/_configuration.py | 6 +++ .../metrics/aio/operations/_operations.py | 42 +++++++++++----- .../query/_generated/metrics/batch/_client.py | 2 +- .../metrics/batch/_configuration.py | 4 +- .../metrics/batch/_serialization.py | 31 +++++------- .../_generated/metrics/batch/aio/_client.py | 2 +- .../metrics/batch/aio/_configuration.py | 4 +- .../batch/aio/operations/_operations.py | 3 -- .../metrics/batch/operations/_operations.py | 5 +- .../metrics/operations/_operations.py | 48 +++++++++++++------ .../_generated/operations/_operations.py | 12 ----- .../azure-monitor-query/swagger/README.md | 10 ++-- 19 files changed, 132 insertions(+), 125 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/assets.json b/sdk/monitor/azure-monitor-query/assets.json index 91bc7a37f44c..0dc4dd023e8e 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_152690fb22" + "Tag": "python/monitor/azure-monitor-query_8640f7c705" } diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_serialization.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_serialization.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): 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: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): 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"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_operations.py index 46a3b69d6b6c..9bfabb9251ea 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_operations.py @@ -384,9 +384,6 @@ async def execute( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -829,9 +826,6 @@ async def resource_execute( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1182,9 +1176,6 @@ async def batch(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: :param body: The batch request body. Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1669,9 +1660,6 @@ async def resource_execute_xms( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_client.py index 55fc0a6c71e6..888ad95aaf75 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_client.py @@ -29,6 +29,9 @@ class MonitorMetricsClient: # pylint: disable=client-accepts-api-version-keywor :vartype metric_namespaces: monitor_metrics_client.operations.MetricNamespacesOperations :keyword endpoint: Service URL. Default value is "https://management.azure.com". :paramtype endpoint: str + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_configuration.py index 9e2649da7073..4fb1b263e1ea 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_configuration.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_configuration.py @@ -18,10 +18,16 @@ class MonitorMetricsClientConfiguration: # pylint: disable=too-many-instance-at Note that all parameters used to create this instance are saved as instance attributes. + + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__(self, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-01") + self.api_version = api_version kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_serialization.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_serialization.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): 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: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): 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"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_client.py index 482781e9a6ed..fefa6363e0ac 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_client.py @@ -29,6 +29,9 @@ class MonitorMetricsClient: # pylint: disable=client-accepts-api-version-keywor :vartype metric_namespaces: monitor_metrics_client.aio.operations.MetricNamespacesOperations :keyword endpoint: Service URL. Default value is "https://management.azure.com". :paramtype endpoint: str + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_configuration.py index 0c7eae382445..ef23b1ac5e5d 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_configuration.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/_configuration.py @@ -18,10 +18,16 @@ class MonitorMetricsClientConfiguration: # pylint: disable=too-many-instance-at Note that all parameters used to create this instance are saved as instance attributes. + + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__(self, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-02-01") + self.api_version = api_version kwargs.setdefault("sdk_moniker", "monitor-query/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/operations/_operations.py index 184799a008cd..b04625e97eec 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/aio/operations/_operations.py @@ -9,6 +9,7 @@ import datetime import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, cast +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -121,9 +122,8 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw } """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { @@ -140,14 +140,25 @@ def prepare_request(next_link=None): _request = build_metric_definitions_list_request( resource_uri=resource_uri, metricnamespace=metricnamespace, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) return _request @@ -365,9 +376,8 @@ async def list( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) cls: ClsType[JSON] = kwargs.pop("cls", None) _request = build_metrics_list_request( @@ -384,7 +394,7 @@ async def list( auto_adjust_timegrain=auto_adjust_timegrain, validate_dimensions=validate_dimensions, rollupby=rollupby, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -460,9 +470,8 @@ def list(self, resource_uri: str, *, start_time: Optional[str] = None, **kwargs: } """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview")) cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { @@ -479,14 +488,25 @@ def prepare_request(next_link=None): _request = build_metric_namespaces_list_request( resource_uri=resource_uri, start_time=start_time, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) return _request diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_client.py index 413b9eaad160..3574817422ed 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_client.py @@ -27,7 +27,7 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'. Required. :type endpoint: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_configuration.py index 12b7d76ce904..16ba9df5b287 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_configuration.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_configuration.py @@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'. Required. :type endpoint: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-01") + api_version: str = kwargs.pop("api_version", "2024-02-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_serialization.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_serialization.py index baa661cb82d2..2f781d740827 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_serialization.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs): 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: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1370,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): 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"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_client.py index 872d94ad0099..eb91181245ef 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_client.py @@ -27,7 +27,7 @@ class MonitorBatchMetricsClient: # pylint: disable=client-accepts-api-version-k https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'. Required. :type endpoint: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_configuration.py index 1fe0508b3c5e..579e30041e20 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_configuration.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/_configuration.py @@ -23,13 +23,13 @@ class MonitorBatchMetricsClientConfiguration: # pylint: disable=too-many-instan https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'. Required. :type endpoint: str - :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-01") + api_version: str = kwargs.pop("api_version", "2024-02-01") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/operations/_operations.py index 91827da37205..93d9e0df9386 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/aio/operations/_operations.py @@ -465,9 +465,6 @@ async def batch( separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. Default value is None. :paramtype rollupby: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/operations/_operations.py index fb1f0dcdec44..9b29ea972939 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/batch/operations/_operations.py @@ -57,7 +57,7 @@ def build_metrics_batch_batch_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -527,9 +527,6 @@ def batch( separate values for each city, you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. Default value is None. :paramtype rollupby: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/operations/_operations.py index 609b991f0ac0..065052297ecc 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/metrics/operations/_operations.py @@ -9,6 +9,7 @@ import datetime import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, cast +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -44,7 +45,7 @@ def build_metric_definitions_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +87,7 @@ def build_metrics_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +137,7 @@ def build_metric_namespaces_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,9 +240,8 @@ def list(self, resource_uri: str, *, metricnamespace: Optional[str] = None, **kw } """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { @@ -258,14 +258,25 @@ def prepare_request(next_link=None): _request = build_metric_definitions_list_request( resource_uri=resource_uri, metricnamespace=metricnamespace, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) return _request @@ -483,9 +494,8 @@ def list( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) cls: ClsType[JSON] = kwargs.pop("cls", None) _request = build_metrics_list_request( @@ -502,7 +512,7 @@ def list( auto_adjust_timegrain=auto_adjust_timegrain, validate_dimensions=validate_dimensions, rollupby=rollupby, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -578,9 +588,8 @@ def list(self, resource_uri: str, *, start_time: Optional[str] = None, **kwargs: } """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-12-01-preview")) cls: ClsType[JSON] = kwargs.pop("cls", None) error_map = { @@ -597,14 +606,25 @@ def prepare_request(next_link=None): _request = build_metric_namespaces_list_request( resource_uri=resource_uri, start_time=start_time, - api_version=api_version, + api_version=self._config.api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) return _request diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_operations.py index 8251268ac118..996cd0f82cbd 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_operations.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_operations.py @@ -589,9 +589,6 @@ def execute( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1034,9 +1031,6 @@ def resource_execute( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1387,9 +1381,6 @@ def batch(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: :param body: The batch request body. Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1874,9 +1865,6 @@ def resource_execute_xms( :keyword prefer: Optional. The prefer header to set server timeout, query statistics and visualization information. Default value is None. :paramtype prefer: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: diff --git a/sdk/monitor/azure-monitor-query/swagger/README.md b/sdk/monitor/azure-monitor-query/swagger/README.md index 48798bb57067..4ee5183ca20f 100644 --- a/sdk/monitor/azure-monitor-query/swagger/README.md +++ b/sdk/monitor/azure-monitor-query/swagger/README.md @@ -35,7 +35,7 @@ These settings apply only when `--tag=release_query` is specified on the command ```yaml $(tag) == 'release_query' input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/stable/2022-10-27/OperationalInsights.json + - https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/stable/2022-10-27/OperationalInsights.json output-folder: ../azure/monitor/query/_generated title: MonitorQueryClient description: Azure Monitor Query Python Client @@ -47,9 +47,9 @@ These settings apply only when `--tag=release_metrics` is specified on the comma ```yaml $(tag) == 'release_metrics' input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-10-01/metricDefinitions_API.json - - https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-10-01/metrics_API.json - - https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metricDefinitions_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metrics_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/resource-manager/Microsoft.Insights/stable/2024-02-01/metricNamespaces_API.json output-folder: ../azure/monitor/query/_generated/metrics title: MonitorMetricsClient description: Azure Monitor Metrics Python Client @@ -61,7 +61,7 @@ These settings apply only when `--tag=release_metrics` is specified on the comma ```yaml $(tag) == 'release_metrics_batch' input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/0373f0edc4414fd402603fac51d0df93f1f70507/specification/monitor/data-plane/Microsoft.Insights/stable/2023-10-01/metricBatch.json + - https://github.com/Azure/azure-rest-api-specs/blob/0b64ca7cbe3af8cd13228dfb783a16b8272b8be2/specification/monitor/data-plane/Microsoft.Insights/stable/2024-02-01/metricBatch.json output-folder: ../azure/monitor/query/_generated/metrics/batch title: MonitorBatchMetricsClient description: Azure Monitor Batch Metrics Python Client From 07995c5c82e03f99eead44ceda56c55ae76f5bce Mon Sep 17 00:00:00 2001 From: Libba Lawrence Date: Tue, 12 Mar 2024 10:32:27 -0700 Subject: [PATCH 19/28] [EventGrid] api events (#34514) * api events * api center * update version * Update sdk/eventgrid/azure-eventgrid/CHANGELOG.md --- sdk/eventgrid/azure-eventgrid/CHANGELOG.md | 8 ++------ .../azure-eventgrid/azure/eventgrid/_event_mappings.py | 4 ++++ sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py | 2 +- sdk/eventgrid/azure-eventgrid/swagger/_constants.py | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md index 09ea6e7e9c87..7ee72a7c585e 100644 --- a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 4.17.1 (Unreleased) +## 4.18.0 (2024-03-12) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Added new enum values to `SystemEventNames` related to Azure Api Center. ## 4.17.0 (2024-02-08) This version and all future versions will require Python 3.8+. diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_event_mappings.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_event_mappings.py index 516fdb358ce7..ccd304497bac 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_event_mappings.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_event_mappings.py @@ -144,6 +144,10 @@ class SystemEventNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): AcsUserDisconnectedEventName = 'Microsoft.Communication.UserDisconnected' + ApiCenterApiDefinitionAddedEventName = 'Microsoft.ApiCenter.ApiDefinitionAdded' + + ApiCenterApiDefinitionUpdatedEventName = 'Microsoft.ApiCenter.ApiDefinitionUpdated' + ApiManagementApiCreatedEventName = 'Microsoft.ApiManagement.APICreated' ApiManagementApiDeletedEventName = 'Microsoft.ApiManagement.APIDeleted' diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py index f28004b217fb..7fc3c50a052f 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "4.17.1" +VERSION = "4.18.0" diff --git a/sdk/eventgrid/azure-eventgrid/swagger/_constants.py b/sdk/eventgrid/azure-eventgrid/swagger/_constants.py index 6e8ac5a857f9..a999463fb32f 100644 --- a/sdk/eventgrid/azure-eventgrid/swagger/_constants.py +++ b/sdk/eventgrid/azure-eventgrid/swagger/_constants.py @@ -28,6 +28,7 @@ "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/Storage.json", "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/eventgrid/data-plane/Microsoft.Web/stable/2018-01-01/Web.json", "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/eventgrid/data-plane/Microsoft.HealthcareApis/stable/2018-01-01/HealthcareApis.json", + "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/eventgrid/data-plane/Microsoft.ApiCenter/stable/2018-01-01/ApiCenter.json", ] From 863ccdd800647d3d168b3ff35d2b3156acc0b41a Mon Sep 17 00:00:00 2001 From: Simon Moreno <30335873+simorenoh@users.noreply.github.com> Date: Tue, 12 Mar 2024 11:07:48 -0700 Subject: [PATCH 20/28] [Cosmos] archboard review item - update batch error description (#34473) * update batch error description * Revert "update batch error description" This reverts commit 9fbe94922d8428278366d3031eea2661da136bf3. * linked sample, updated ivar * Update exceptions.py * Update exceptions.py * Update exceptions.py * Update exceptions.py --- .../azure-cosmos/azure/cosmos/exceptions.py | 30 +++++++++++++------ .../samples/document_management.py | 2 ++ .../samples/document_management_async.py | 2 ++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/exceptions.py b/sdk/cosmos/azure-cosmos/azure/cosmos/exceptions.py index 0c02fe0c2fa3..306d8d0da696 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/exceptions.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/exceptions.py @@ -66,8 +66,27 @@ class CosmosAccessConditionFailedError(CosmosHttpResponseError): class CosmosBatchOperationError(HttpResponseError): - """A transactional batch request to the Azure Cosmos database service has failed.""" - + """A transactional batch request to the Azure Cosmos database service has failed. + + :ivar int error_index: Index of operation within the batch that caused the error. + :ivar headers: Error headers. + :vartype headers: dict[str, Any] + :ivar status_code: HTTP response code. + :vartype status_code: int + :ivar message: Error message. + :vartype message: str + :ivar operation_responses: List of failed operations' responses. + :vartype operation_responses: List[dict[str, Any]] + .. admonition:: Example: + + .. literalinclude:: ../samples/document_management.py + :start-after: [START handle_batch_error] + :end-before: [END handle_batch_error] + :language: python + :dedent: 0 + :caption: Handle a CosmosBatchOperationError: + :name: handle_batch_error + """ def __init__( self, error_index=None, @@ -76,13 +95,6 @@ def __init__( message=None, operation_responses=None, **kwargs): - """ - :param int error_index: Index of operation within the batch that caused the error. - :param dict[str, Any] headers: Error headers. - :param int status_code: HTTP response code. - :param str message: Error message. - :param list operation_responses: List of failed operations' responses. - """ self.error_index = error_index self.headers = headers self.sub_status = None diff --git a/sdk/cosmos/azure-cosmos/samples/document_management.py b/sdk/cosmos/azure-cosmos/samples/document_management.py index 464d6e02d278..7399b961cb25 100644 --- a/sdk/cosmos/azure-cosmos/samples/document_management.py +++ b/sdk/cosmos/azure-cosmos/samples/document_management.py @@ -243,6 +243,7 @@ def execute_item_batch(database): # For error handling, you should use try/ except with CosmosBatchOperationError and use the information in the # error returned for your application debugging, making it easy to pinpoint the failing operation + # [START handle_batch_error] batch_operations = [create_item_operation, create_item_operation] try: container.execute_item_batch(batch_operations, partition_key="Account1") @@ -251,6 +252,7 @@ def execute_item_batch(database): error_operation_response = e.operation_responses[error_operation_index] error_operation = batch_operations[error_operation_index] print("\nError operation: {}, error operation response: {}\n".format(error_operation, error_operation_response)) + # [END handle_batch_error] def delete_item(container, doc_id): diff --git a/sdk/cosmos/azure-cosmos/samples/document_management_async.py b/sdk/cosmos/azure-cosmos/samples/document_management_async.py index 3e759e8c00a5..b43629ec2c62 100644 --- a/sdk/cosmos/azure-cosmos/samples/document_management_async.py +++ b/sdk/cosmos/azure-cosmos/samples/document_management_async.py @@ -262,6 +262,7 @@ async def execute_item_batch(database): # For error handling, you should use try/ except with CosmosBatchOperationError and use the information in the # error returned for your application debugging, making it easy to pinpoint the failing operation + # [START handle_batch_error] batch_operations = [create_item_operation, create_item_operation] try: await container.execute_item_batch(batch_operations, partition_key="Account1") @@ -270,6 +271,7 @@ async def execute_item_batch(database): error_operation_response = e.operation_responses[error_operation_index] error_operation = batch_operations[error_operation_index] print("\nError operation: {}, error operation response: {}\n".format(error_operation, error_operation_response)) + # [END handle_batch_error] async def delete_item(container, doc_id): From dc7fc742907a1a5469eee75350d09c469856cdbb Mon Sep 17 00:00:00 2001 From: Diondra <16376603+diondrapeck@users.noreply.github.com> Date: Tue, 12 Mar 2024 11:21:35 -0700 Subject: [PATCH 21/28] [ml] Enable strict sphinx check (#34688) * Remove Optional type annotation from get() methods * Remove duplicate overloads * Fix sphinx errors * Fix indentation * Turn on strict sphinx check * Implicitly expose search_space and _credentials classes to avoid duplicate object exposures * Add deprecation warning message for imports and update CHANGELOG * Update formatting * Ignore mypy error --- sdk/ml/azure-ai-ml/CHANGELOG.md | 16 ++++ sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py | 37 +++++++- .../azure/ai/ml/entities/__init__.py | 84 ++++++++++++++----- .../ml/entities/_job/pipeline/_attr_dict.py | 3 +- .../_job/sweep/parameterized_sweep.py | 17 +++- .../ai/ml/entities/_job/sweep/search_space.py | 1 - .../ai/ml/entities/_job/sweep/sweep_job.py | 14 +++- .../connections/workspace_connection.py | 19 ++--- .../ai/ml/operations/_model_operations.py | 4 +- sdk/ml/azure-ai-ml/pyproject.toml | 2 +- sdk/ml/azure-ai-ml/samples/ml_samples_misc.py | 9 ++ .../ml_samples_pipeline_job_configurations.py | 1 + 12 files changed, 159 insertions(+), 48 deletions(-) diff --git a/sdk/ml/azure-ai-ml/CHANGELOG.md b/sdk/ml/azure-ai-ml/CHANGELOG.md index 261e2f23ca48..64e6e65312ef 100644 --- a/sdk/ml/azure-ai-ml/CHANGELOG.md +++ b/sdk/ml/azure-ai-ml/CHANGELOG.md @@ -10,6 +10,22 @@ ### Other Changes +- The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`. + - `AmlTokenConfiguration` + - `ManagedIdentityConfiguration` + - `UserIdentityConfiguration` +- The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`. + - `Choice` + - `Uniform` + - `LogUniform` + - `QLogUniform` + - `QUniform` + - `QLogNormal` + - `QNormal` + - `LogNormal` + - `Normal` + - `Randint` + ## 1.14.0 (2024-03-11) ### Features Added diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py index e15a64da3329..e50df9de99c3 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/__init__.py @@ -5,6 +5,7 @@ __path__ = __import__("pkgutil").extend_path(__path__, __name__) import logging +from typing import Any, Optional # from .entities._builders.parallel_func import parallel from azure.ai.ml.entities._inputs_outputs import Input, Output @@ -14,7 +15,6 @@ from ._version import VERSION from .entities._builders.command_func import command from .entities._builders.spark_func import spark -from .entities._credentials import AmlTokenConfiguration, ManagedIdentityConfiguration, UserIdentityConfiguration from .entities._job.distribution import MpiDistribution, PyTorchDistribution, RayDistribution, TensorFlowDistribution from .entities._load_functions import ( load_batch_deployment, @@ -52,9 +52,6 @@ "PyTorchDistribution", "TensorFlowDistribution", "RayDistribution", - "ManagedIdentityConfiguration", - "AmlTokenConfiguration", - "UserIdentityConfiguration", "load_batch_deployment", "load_batch_endpoint", "load_component", @@ -77,3 +74,35 @@ ] __version__ = VERSION + + +# Allow importing these types for backwards compatibility + + +def __getattr__(name: str): + requested: Optional[Any] = None + + if name == "AmlTokenConfiguration": + from .entities._credentials import AmlTokenConfiguration + + requested = AmlTokenConfiguration + if name == "ManagedIdentityConfiguration": + from .entities._credentials import ManagedIdentityConfiguration + + requested = ManagedIdentityConfiguration + if name == "UserIdentityConfiguration": + from .entities._credentials import UserIdentityConfiguration + + requested = UserIdentityConfiguration + + if requested: + if not getattr(__getattr__, "warning_issued", False): + logging.warning( + " %s will be removed from the azure.ai.ml namespace in a future release." + " Please use the azure.ai.ml.entities namespace instead.", + name, + ) + __getattr__.warning_issued = True # type: ignore[attr-defined] + return requested + + raise AttributeError(f"module 'azure.ai.ml' has no attribute {name}") 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 efc3858e166d..75c08c62d535 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 @@ -9,6 +9,9 @@ # pylint: disable=naming-mismatch __path__ = __import__("pkgutil").extend_path(__path__, __name__) +import logging +from typing import Any, Optional + from azure.ai.ml._restclient.v2022_10_01.models import CreatedByType from azure.ai.ml._restclient.v2022_10_01_preview.models import UsageUnit @@ -138,18 +141,6 @@ from ._job.spark_job import SparkJob from ._job.spark_job_entry import SparkJobEntry, SparkJobEntryType from ._job.spark_resource_configuration import SparkResourceConfiguration -from ._job.sweep.search_space import ( - Choice, - LogNormal, - LogUniform, - Normal, - QLogNormal, - QLogUniform, - QNormal, - QUniform, - Randint, - Uniform, -) from ._monitoring.alert_notification import AlertNotification from ._monitoring.compute import ServerlessSparkCompute from ._monitoring.definition import MonitorDefinition @@ -325,16 +316,6 @@ "ParallelComponent", "CommandComponent", "SparkComponent", - "Choice", - "Normal", - "LogNormal", - "QNormal", - "QLogNormal", - "Randint", - "Uniform", - "QUniform", - "LogUniform", - "QLogUniform", "ResourceRequirementsSettings", "ResourceSettings", "AssignedUserConfiguration", @@ -472,3 +453,62 @@ "RequestLogging", "NoneCredentialConfiguration", ] + +# Allow importing these types for backwards compatibility + + +def __getattr__(name: str): + requested: Optional[Any] = None + + if name == "Choice": + from ..sweep import Choice + + requested = Choice + if name == "LogNormal": + from ..sweep import LogNormal + + requested = LogNormal + if name == "LogUniform": + from ..sweep import LogUniform + + requested = LogUniform + if name == "Normal": + from ..sweep import Normal + + requested = Normal + if name == "QLogNormal": + from ..sweep import QLogNormal + + requested = QLogNormal + if name == "QLogUniform": + from ..sweep import QLogUniform + + requested = QLogUniform + if name == "QNormal": + from ..sweep import QNormal + + requested = QNormal + if name == "QUniform": + from ..sweep import QUniform + + requested = QUniform + if name == "Randint": + from ..sweep import Randint + + requested = Randint + if name == "Uniform": + from ..sweep import Uniform + + requested = Uniform + + if requested: + if not getattr(__getattr__, "warning_issued", False): + logging.warning( + " %s will be removed from the azure.ai.ml.entities namespace in a future release." + " Please import from the azure.ai.ml.sweep namespace instead.", + name, + ) + __getattr__.warning_issued = True # type: ignore[attr-defined] + return requested + + raise AttributeError(f"module 'azure.ai.ml.entities' has no attribute {name}") diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_attr_dict.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_attr_dict.py index ba92ac8dbaeb..194b0fa10880 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_attr_dict.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/pipeline/_attr_dict.py @@ -12,7 +12,7 @@ V = TypeVar("V") -class _AttrDict(Generic[K, V], dict, ABC): +class _AttrDict(Generic[K, V], Dict, ABC): """This class is used for accessing values with instance.some_key. It supports the following scenarios: 1. Setting arbitrary attribute, eg: obj.resource_layout.node_count = 2 @@ -34,6 +34,7 @@ def __init__(self, allowed_keys: Optional[Dict] = None, **kwargs: Any): :param allowed_keys: A dictionary of keys that allowed to set as arbitrary attributes. None means all keys can be set as arbitrary attributes. + :type dict :param kwargs: A dictionary of additional configuration parameters. :type kwargs: dict diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/parameterized_sweep.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/parameterized_sweep.py index 9bfab59275e3..1d61320ceb7e 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/parameterized_sweep.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/parameterized_sweep.py @@ -66,10 +66,19 @@ def __init__( :param early_termination: Early termination policy for sweep job. :type early_termination: ~azure.ai.ml.entities._job.sweep.early_termination_policy.EarlyTerminationPolicy :param search_space: Search space for sweep job. - :type search_space: Dict[str, Union[~azure.ai.ml.sweep.Choice, ~azure.ai.ml.sweep.LogNormal, - ~azure.ai.ml.sweep.LogUniform, ~azure.ai.ml.sweep.Normal, ~azure.ai.ml.sweep.QLogNormal, - ~azure.ai.ml.sweep.QLogUniform, ~azure.ai.ml.sweep.QNormal, ~azure.ai.ml.sweep.QUniform, - ~azure.ai.ml.sweep.Randint, ~azure.ai.ml.sweep.Uniform]] + :type search_space: Dict[str, Union[ + ~azure.ai.ml.sweep.Choice, + ~azure.ai.ml.sweep.LogNormal, + ~azure.ai.ml.sweep.LogUniform, + ~azure.ai.ml.sweep.Normal, + ~azure.ai.ml.sweep.QLogNormal, + ~azure.ai.ml.sweep.QLogUniform, + ~azure.ai.ml.sweep.QNormal, + ~azure.ai.ml.sweep.QUniform, + ~azure.ai.ml.sweep.Randint, + ~azure.ai.ml.sweep.Uniform + + ]] :param queue_settings: Queue settings for sweep job. :type queue_settings: ~azure.ai.ml.entities.QueueSettings :param resources: Compute Resource configuration for the job. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/search_space.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/search_space.py index 0df06d9539ea..90d02b89a462 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/search_space.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/search_space.py @@ -267,7 +267,6 @@ def _from_rest_object(cls, obj: List) -> "Randint": class Uniform(SweepDistribution): """ - :noindex: Uniform distribution configuration. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py index 5adb05c1fa36..424a23b316a7 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/sweep/sweep_job.py @@ -88,16 +88,21 @@ class SweepJob(Job, ParameterizedSweep, JobIOMixin): :paramtype identity: Union[ ~azure.ai.ml.ManagedIdentityConfiguration, ~azure.ai.ml.AmlTokenConfiguration, - ~azure.ai.ml.UserIdentityConfiguration] + ~azure.ai.ml.UserIdentityConfiguration + + ] + :keyword inputs: Inputs to the command. :paramtype inputs: dict :keyword outputs: Mapping of output data bindings used in the job. :paramtype outputs: dict[str, ~azure.ai.ml.Output] :keyword sampling_algorithm: The hyperparameter sampling algorithm to use over the `search_space`. Defaults to "random". + :paramtype sampling_algorithm: str :keyword search_space: Dictionary of the hyperparameter search space. The key is the name of the hyperparameter and the value is the parameter expression. + :paramtype search_space: Dict :keyword objective: Metric to optimize for. :paramtype objective: Objective @@ -111,12 +116,17 @@ class SweepJob(Job, ParameterizedSweep, JobIOMixin): ~azure.ai.ml.entities.CommandComponent ] + :keyword early_termination: The early termination policy to use. A trial job is canceled when the criteria of the specified policy are met. If omitted, no early termination policy will be applied. + :paramtype early_termination: Union[ ~azure.mgmt.machinelearningservices.models.BanditPolicy, ~azure.mgmt.machinelearningservices.models.MedianStoppingPolicy, - ~azure.mgmt.machinelearningservices.models.TruncationSelectionPolicy] + ~azure.mgmt.machinelearningservices.models.TruncationSelectionPolicy + + ] + :keyword limits: Limits for the sweep job. :paramtype limits: ~azure.ai.ml.entities.SweepJobLimits :keyword queue_settings: Queue settings for the job. diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py index 5469f85d5acb..4aa84ecdc689 100644 --- a/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/entities/_workspace/connections/workspace_connection.py @@ -4,35 +4,31 @@ # pylint: disable=protected-access +import warnings from os import PathLike from pathlib import Path -import warnings from typing import IO, Any, AnyStr, Dict, List, Optional, Type, Union, cast +from azure.ai.ml._restclient.v2023_08_01_preview.models import ( + WorkspaceConnectionPropertiesV2BasicResource as RestWorkspaceConnection, +) from azure.ai.ml._restclient.v2024_01_01_preview.models import ( ConnectionCategory, NoneAuthTypeWorkspaceConnectionProperties, ) -from azure.ai.ml._restclient.v2023_08_01_preview.models import ( - WorkspaceConnectionPropertiesV2BasicResource as RestWorkspaceConnection, -) from azure.ai.ml._schema.workspace.connections.workspace_connection import WorkspaceConnectionSchema from azure.ai.ml._utils._experimental import experimental from azure.ai.ml._utils.utils import _snake_to_camel, camel_to_snake, dump_yaml_to_file -from azure.ai.ml.constants._common import ( - BASE_PATH_CONTEXT_KEY, - PARAMS_OVERRIDE_KEY, - WorkspaceConnectionTypes, -) +from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY, PARAMS_OVERRIDE_KEY, WorkspaceConnectionTypes from azure.ai.ml.entities._credentials import ( AccessKeyConfiguration, ApiKeyConfiguration, ManagedIdentityConfiguration, + NoneCredentialConfiguration, PatTokenConfiguration, SasTokenConfiguration, ServicePrincipalConfiguration, UsernamePasswordConfiguration, - NoneCredentialConfiguration, _BaseIdentityConfiguration, ) from azure.ai.ml.entities._resource import Resource @@ -174,6 +170,7 @@ def credentials( ~azure.ai.ml.entities.ServicePrincipalConfiguration, ~azure.ai.ml.entities.AccessKeyConfiguration, ~azure.ai.ml.entities.ApiKeyConfiguration + ] """ return self._credentials @@ -373,8 +370,8 @@ def _get_entity_class_from_type(cls, conn_type: Optional[str]) -> Type: from .workspace_connection_subtypes import ( AzureAISearchWorkspaceConnection, AzureAIServiceWorkspaceConnection, - AzureOpenAIWorkspaceConnection, AzureBlobStoreWorkspaceConnection, + AzureOpenAIWorkspaceConnection, ) # Connection categories don't perfectly follow perfect camel casing, so lower 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 26f20dbfb46e..cf915de05a64 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 @@ -415,7 +415,7 @@ def archive( :end-before: [END model_operations_archive] :language: python :dedent: 8 - :caption: Archive a model example. + :caption: Archive a model. """ _archive_or_restore( asset_operations=self, @@ -451,7 +451,7 @@ def restore( :end-before: [END model_operations_restore] :language: python :dedent: 8 - :caption: Restore a model example. + :caption: Restore an archived model. """ _archive_or_restore( asset_operations=self, diff --git a/sdk/ml/azure-ai-ml/pyproject.toml b/sdk/ml/azure-ai-ml/pyproject.toml index f3d3c2c92ab7..132dbd1928d1 100644 --- a/sdk/ml/azure-ai-ml/pyproject.toml +++ b/sdk/ml/azure-ai-ml/pyproject.toml @@ -4,7 +4,7 @@ pyright = false type_check_samples = false verifytypes = false pylint = true -strict_sphinx = false +strict_sphinx = true [tool.isort] diff --git a/sdk/ml/azure-ai-ml/samples/ml_samples_misc.py b/sdk/ml/azure-ai-ml/samples/ml_samples_misc.py index 4dcd80c0b42b..10dffcc9f168 100644 --- a/sdk/ml/azure-ai-ml/samples/ml_samples_misc.py +++ b/sdk/ml/azure-ai-ml/samples/ml_samples_misc.py @@ -111,8 +111,17 @@ def ml_misc_config_0(self): }, stage="Production", ) + ml_client.models.create_or_update(model) # [END model_entity_create] + # [START model_operations_archive] + ml_client.models.archive(name="model1", version="5") + # [END model_operations_archive] + + # [START model_operations_restore] + ml_client.models.restore(name="model1", version="5") + # [END model_operations_restore] + # [START model_batch_deployment_settings_entity_create] from azure.ai.ml.entities._deployment.model_batch_deployment_settings import ModelBatchDeploymentSettings diff --git a/sdk/ml/azure-ai-ml/samples/ml_samples_pipeline_job_configurations.py b/sdk/ml/azure-ai-ml/samples/ml_samples_pipeline_job_configurations.py index 284dafe6da2f..e9d7a03c9a18 100644 --- a/sdk/ml/azure-ai-ml/samples/ml_samples_pipeline_job_configurations.py +++ b/sdk/ml/azure-ai-ml/samples/ml_samples_pipeline_job_configurations.py @@ -83,6 +83,7 @@ def sample_pipeline_func(pipeline_input1, pipeline_input2): settings=PipelineJobSettings(force_rerun=True, default_compute="cpu-cluster"), jobs={"component1": component_func(component_in_number=1.0, component_in_path=uri_file_input)}, ) + ml_client.jobs.create_or_update(pipeline_job) # [END configure_pipeline_job_and_settings] From 59e7d2392525faf42a7c6c7c08455787d5687358 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:12:23 -0400 Subject: [PATCH 22/28] update typespec-python (#34736) --- eng/emitter-package-lock.json | 187 ++++++++++++++++++++-------------- eng/emitter-package.json | 18 ++-- 2 files changed, 121 insertions(+), 84 deletions(-) diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 22d75408147b..4136fce1c5aa 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,22 +5,24 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-python": "0.21.1" + "@azure-tools/typespec-python": "0.22.2" }, "devDependencies": { - "@azure-tools/typespec-azure-core": "~0.39.0", - "@azure-tools/typespec-client-generator-core": "0.40.0-dev.15", - "@typespec/compiler": "~0.53.0", - "@typespec/http": "~0.53.0", - "@typespec/openapi": "~0.53.0", - "@typespec/rest": "~0.53.0", - "@typespec/versioning": "~0.53.0" + "@azure-tools/typespec-autorest": "~0.40.0", + "@azure-tools/typespec-azure-core": "~0.40.0", + "@azure-tools/typespec-azure-resource-manager": "~0.40.0", + "@azure-tools/typespec-client-generator-core": "~0.40.0", + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/openapi": "~0.54.0", + "@typespec/rest": "~0.54.0", + "@typespec/versioning": "~0.54.0" } }, "node_modules/@autorest/python": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/@autorest/python/-/python-6.13.2.tgz", - "integrity": "sha512-GUR5B78Vq8nfMB37v+Hfvwb8YlAicZiBihz9/cePPbWLR2yRiumzVmKjLfbuv6wKaq1PwvL73xQfGaqVutJ71Q==", + "version": "6.13.5", + "resolved": "https://registry.npmjs.org/@autorest/python/-/python-6.13.5.tgz", + "integrity": "sha512-ts6BdKyZKbDMAqAOk5D4cmn7/Y47N4XF6rcWgk8TBLQt5SsI1e20KPwmRJQ9GUpQbBadvtiqGfXD1O/Os8vWjw==", "hasInstallScript": true, "dependencies": { "@autorest/system-requirements": "~1.0.2" @@ -39,24 +41,60 @@ "node": ">=12.0.0" } }, + "node_modules/@azure-tools/typespec-autorest": { + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.40.0.tgz", + "integrity": "sha512-aMgJk0pudvg11zs/2dlUWPEsdK920NvTqGkbYhy+4UeJ1hEzMM3btOyujE/irhDlcZeEgDlaXQc+xiK/Vik71A==", + "dev": true, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "@azure-tools/typespec-azure-core": "~0.40.0", + "@azure-tools/typespec-client-generator-core": "~0.40.0", + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/openapi": "~0.54.0", + "@typespec/rest": "~0.54.0", + "@typespec/versioning": "~0.54.0" + } + }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.39.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.39.1.tgz", - "integrity": "sha512-b1cN1HXTcEiKIRpk2EatFK/C4NReDaW2h4N3V4C5dxGeeLAnTa1jsQ6lwobH6Zo39CdrjazNXiSbcEq1UZ7kPw==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.40.0.tgz", + "integrity": "sha512-l5U47zXKYQKFbipRQLpjG4EwvPJg0SogdFEe5a3rRr7mUy8sWPkciHpngLZVOd2cKZQD5m7nqwfWL798I9TJnQ==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.1", - "@typespec/http": "~0.53.0", - "@typespec/rest": "~0.53.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/rest": "~0.54.0" + } + }, + "node_modules/@azure-tools/typespec-azure-resource-manager": { + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.40.0.tgz", + "integrity": "sha512-gjkpVe09ug6ctisbp9wY57G3KX2MuaasjQdU+knJ9lTc4IgUsuLNlP1TM/v0Jso1T5cWo5K/doqkxc+xUIWrvQ==", + "dev": true, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "@azure-tools/typespec-autorest": "~0.40.0", + "@azure-tools/typespec-azure-core": "~0.40.0", + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/openapi": "~0.54.0", + "@typespec/rest": "~0.54.0", + "@typespec/versioning": "~0.54.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.40.0-dev.15", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.40.0-dev.15.tgz", - "integrity": "sha512-NIKf1xLUjE9FMUAW/vS6JhrNIpDFVCRntyTeA5DSLnbEdw5+kJHYwRH8heFuQKBgi+rVfwV9LZqoya55bUkbNw==", + "version": "0.40.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.40.0.tgz", + "integrity": "sha512-Nm/OfDtSWBr1lylISbXR37B9QKWlZHK1j4T8L439Y1v3VcvJsC/0F5PLemY0odHpOYZNwu2uevJjAeM5W56wlw==", "dev": true, "dependencies": { "change-case": "~5.4.2", @@ -66,18 +104,18 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.1 || >=0.54.0-dev <0.54.0", - "@typespec/http": "~0.53.0 || >=0.54.0-dev <0.54.0", - "@typespec/rest": "~0.53.0 || >=0.54.0-dev <0.54.0", - "@typespec/versioning": "~0.53.0 || >=0.54.0-dev <0.54.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/rest": "~0.54.0", + "@typespec/versioning": "~0.54.0" } }, "node_modules/@azure-tools/typespec-python": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.21.1.tgz", - "integrity": "sha512-Pac4wX6O/cBkGUb525cPVk99MSD5m9EE5GZxdXU7hHgiOEFfiAwsXv35I0TZxyu4o09P/aSFMBALIXf7/8u0qw==", + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.22.2.tgz", + "integrity": "sha512-QIyvidxSY7miIMudPUJJqSc6D30MIgybWIYQU7vNpAscnd/L7Nst5/I0aZdlwpeVQTcAOsgJxHpAJV38OQNeuw==", "dependencies": { - "@autorest/python": "^6.13.2", + "@autorest/python": "^6.13.5", "@typespec/openapi3": "latest", "js-yaml": "~4.1.0" }, @@ -85,12 +123,15 @@ "node": ">=14.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.39.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": "0.40.0-dev.15", - "@typespec/compiler": ">=0.53.0 <1.0.0", - "@typespec/http": ">=0.53.0 <1.0.0", - "@typespec/rest": ">=0.53.0 <1.0.0", - "@typespec/versioning": ">=0.53.0 <1.0.0" + "@azure-tools/typespec-autorest": ">=0.40.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.40.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.40.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.40.0 <1.0.0", + "@typespec/compiler": ">=0.54.0 <1.0.0", + "@typespec/http": ">=0.54.0 <1.0.0", + "@typespec/openapi": ">=0.54.0 <1.0.0", + "@typespec/rest": ">=0.54.0 <1.0.0", + "@typespec/versioning": ">=0.54.0 <1.0.0" } }, "node_modules/@azure/logger": { @@ -188,22 +229,22 @@ } }, "node_modules/@typespec/compiler": { - "version": "0.53.1", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.53.1.tgz", - "integrity": "sha512-qneMDvZsLaL8+3PXzwXMAqgE4YtkUPPBg4oXrbreYa5NTccuvgVaO4cfya/SzG4WePUnmDTbbrP5aWd+VzYwYA==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.54.0.tgz", + "integrity": "sha512-lxMqlvUq5m1KZUjg+IoM/gEwY+yeSjjnpUsz6wmzjK4cO9cIY4wPJdrZwe8jUc2UFOoqKXN3AK8N1UWxA+w9Dg==", "dev": true, "dependencies": { "@babel/code-frame": "~7.23.5", "ajv": "~8.12.0", - "change-case": "~5.3.0", + "change-case": "~5.4.2", "globby": "~14.0.0", "mustache": "~4.2.0", "picocolors": "~1.0.0", - "prettier": "~3.1.1", + "prettier": "~3.2.5", "prompts": "~2.4.2", - "semver": "^7.5.4", - "vscode-languageserver": "~9.0.0", - "vscode-languageserver-textdocument": "~1.0.8", + "semver": "^7.6.0", + "vscode-languageserver": "~9.0.1", + "vscode-languageserver-textdocument": "~1.0.11", "yaml": "~2.3.4", "yargs": "~17.7.2" }, @@ -215,41 +256,35 @@ "node": ">=18.0.0" } }, - "node_modules/@typespec/compiler/node_modules/change-case": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.3.0.tgz", - "integrity": "sha512-Eykca0fGS/xYlx2fG5NqnGSnsWauhSGiSXYhB1kO6E909GUfo8S54u4UZNS7lMJmgZumZ2SUpWaoLgAcfQRICg==", - "dev": true - }, "node_modules/@typespec/http": { - "version": "0.53.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.53.0.tgz", - "integrity": "sha512-Hdwbxr6KgzmJdULbbcwWaSSrWlduuMuEVUVdlytxyo9K+aoUCcPl0thR5Ez2VRh02/IJl3xG4n5wXgOwWb3amA==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.54.0.tgz", + "integrity": "sha512-/hZd9pkjJh3ogOekyKzZnpVV2kXzxtWDiTt3Gekc6iHTGk/CE1JpRFts8xwXoI5d3FqYotfb4w5ztVw62WjOcA==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.0" + "@typespec/compiler": "~0.54.0" } }, "node_modules/@typespec/openapi": { - "version": "0.53.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.53.0.tgz", - "integrity": "sha512-FRHb6Wi4Yf1HGm3EnhhXZ0Bw+EIPam6ptxRy7NDRxyMnzHsOphGcv8mDIZk6MPSy8xPasbFNwaRC1TXpxVhQBw==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.54.0.tgz", + "integrity": "sha512-QJkwq3whcqKb29ScMD5IQzqvDmPQyLAubRl82Zj6kVMCqabRwegOX9aN+K0083nci65zt9rflZbv9bKY5GRy/A==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.0", - "@typespec/http": "~0.53.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0" } }, "node_modules/@typespec/openapi3": { - "version": "0.53.2", - "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.53.2.tgz", - "integrity": "sha512-8uwU3iJbt+WN3WlT9VzC7DN8rzB727zr8BMwZ81XN1/sX8dOJB49F5UiK0L+ychvx15RZ96CvYPCFmmnsOeyCQ==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.54.0.tgz", + "integrity": "sha512-ryqa6iNWA3Vb2TcyTUD0NrRecGVY5MGaEuAdBJnnEEPcE6CSQY0j0dFZXzRLBUd4LiR332B4Y7Brkq6MjRdrNg==", "dependencies": { "yaml": "~2.3.4" }, @@ -257,35 +292,35 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.1", - "@typespec/http": "~0.53.0", - "@typespec/openapi": "~0.53.0", - "@typespec/versioning": "~0.53.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/openapi": "~0.54.0", + "@typespec/versioning": "~0.54.0" } }, "node_modules/@typespec/rest": { - "version": "0.53.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.53.0.tgz", - "integrity": "sha512-aA75Ol2pRvUjtRqQvFHmFG52pkeif3m+tboLAT00AekTxOPZ3rqQmlE12ne4QF8KjgHA6denqH4f/XyDoRJOJQ==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.54.0.tgz", + "integrity": "sha512-F1hq/Per9epPJQ8Ey84mAtrgrZeLu6fDMIxNao1XlTfDEFZuYgFuCSyg0pyIi0Xg7KUBMvrvSv83WoF3mN2szw==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.0", - "@typespec/http": "~0.53.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0" } }, "node_modules/@typespec/versioning": { - "version": "0.53.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.53.0.tgz", - "integrity": "sha512-nrrLXCWPDrrClAfpCMzQ3YPTbKQmjPC3LSeMjq+wPiMq+1PW95ulOGD4QiCBop+4wKhMCJHnqqSzVauT1LjdvQ==", + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.54.0.tgz", + "integrity": "sha512-IlGpveOJ0WBTbn3w8nfzgSNhJWNd0+H+bo1Ljrjpeb9SFQmS8bX2fDf0vqsHVl50XgvKIZxgOpEXN5TmuzNnRw==", "dev": true, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.53.0" + "@typespec/compiler": "~0.54.0" } }, "node_modules/ajv": { @@ -675,9 +710,9 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 79f3e2590952..6a8def4344fb 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,15 +1,17 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-python": "0.21.1" + "@azure-tools/typespec-python": "0.22.2" }, "devDependencies": { - "@azure-tools/typespec-client-generator-core": "0.40.0-dev.15", - "@azure-tools/typespec-azure-core": "~0.39.0", - "@typespec/http": "~0.53.0", - "@typespec/compiler": "~0.53.0", - "@typespec/versioning": "~0.53.0", - "@typespec/openapi": "~0.53.0", - "@typespec/rest": "~0.53.0" + "@typespec/compiler": "~0.54.0", + "@typespec/http": "~0.54.0", + "@typespec/openapi": "~0.54.0", + "@azure-tools/typespec-autorest": "~0.40.0", + "@azure-tools/typespec-azure-resource-manager": "~0.40.0", + "@azure-tools/typespec-azure-core": "~0.40.0", + "@typespec/rest": "~0.54.0", + "@typespec/versioning": "~0.54.0", + "@azure-tools/typespec-client-generator-core": "~0.40.0" } } From f12ac3abbb32079c8315232d1d683592cde774c1 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Tue, 12 Mar 2024 13:29:38 -0700 Subject: [PATCH 23/28] [Monitor] Improve docs regarding sovereign clouds (#33196) Signed-off-by: Paul Van Eck --- sdk/monitor/azure-monitor-ingestion/README.md | 7 ++- .../azure/monitor/ingestion/_patch.py | 18 +++++++ .../azure/monitor/ingestion/aio/_patch.py | 18 +++++++ .../azure-monitor-ingestion/samples/README.md | 3 ++ .../sample_authentication_async.py | 51 +++++++++++++++++++ .../samples/sample_authentication.py | 44 ++++++++++++++++ sdk/monitor/azure-monitor-query/README.md | 11 +++- .../azure/monitor/query/_logs_query_client.py | 9 ++++ .../monitor/query/_metrics_query_client.py | 9 ++++ .../query/aio/_logs_query_client_async.py | 9 ++++ .../query/aio/_metrics_query_client_async.py | 9 ++++ .../sample_authentication_async.py | 24 +++++++++ .../samples/sample_authentication.py | 22 ++++++++ 13 files changed, 231 insertions(+), 3 deletions(-) create mode 100644 sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_authentication_async.py create mode 100644 sdk/monitor/azure-monitor-ingestion/samples/sample_authentication.py diff --git a/sdk/monitor/azure-monitor-ingestion/README.md b/sdk/monitor/azure-monitor-ingestion/README.md index 36bcdc0b8f06..aee218f11994 100644 --- a/sdk/monitor/azure-monitor-ingestion/README.md +++ b/sdk/monitor/azure-monitor-ingestion/README.md @@ -69,7 +69,12 @@ logs_client = LogsIngestionClient(endpoint, credential) By default, `LogsIngestionClient` is configured to connect to the public Azure cloud. To connect to non-public Azure clouds, some additional configuration is required. The appropriate scope for authentication must be provided using the `credential_scopes` keyword argument. The following example shows how to configure the client to connect to Azure US Government: ```python -logs_client = LogsIngestionClient(endpoint, credential_scopes=["https://monitor.azure.us//.default"]) +from azure.identity import AzureAuthorityHosts, DefaultAzureCredential +from azure.monitor.ingestion import LogsIngestionClient + +# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable. +credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) +logs_client = LogsIngestionClient(endpoint, credential, credential_scopes=["https://monitor.azure.us/.default"]) ``` ## Key concepts 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 05533ce0eb19..ef7425309147 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_patch.py @@ -21,6 +21,24 @@ class LogsIngestionClient(GeneratedClient): :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 + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_authentication.py + :start-after: [START create_client_public_cloud] + :end-before: [END create_client_public_cloud] + :language: python + :dedent: 4 + :caption: Creating the LogsIngestionClient with DefaultAzureCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_authentication.py + :start-after: [START create_client_sovereign_cloud] + :end-before: [END create_client_sovereign_cloud] + :language: python + :dedent: 4 + :caption: Creating the LogsIngestionClient for use with a sovereign cloud (i.e. non-public cloud). """ diff --git a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_patch.py b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_patch.py index 7da806c76537..ef37c4edbdb2 100644 --- a/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_patch.py +++ b/sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/aio/_patch.py @@ -21,6 +21,24 @@ class LogsIngestionClient(GeneratedClient): :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 + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_authentication_async.py + :start-after: [START create_client_public_cloud_async] + :end-before: [END create_client_public_cloud_async] + :language: python + :dedent: 4 + :caption: Creating the LogsIngestionClient with DefaultAzureCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_authentication_async.py + :start-after: [START create_client_sovereign_cloud_async] + :end-before: [END create_client_sovereign_cloud_async] + :language: python + :dedent: 4 + :caption: Creating the LogsIngestionClient for use with a sovereign cloud (i.e. non-public cloud). """ diff --git a/sdk/monitor/azure-monitor-ingestion/samples/README.md b/sdk/monitor/azure-monitor-ingestion/samples/README.md index 83c00bc25b86..b4393d44fab5 100644 --- a/sdk/monitor/azure-monitor-ingestion/samples/README.md +++ b/sdk/monitor/azure-monitor-ingestion/samples/README.md @@ -14,6 +14,7 @@ This library allows you to send data from virtually any source to supported buil |**File Name**|**Description**| |-------------|---------------| +|[sample_authentication.py][sample_authentication] and [sample_authentication_async.py][sample_authentication_async]|Authenticate a client with the public cloud and a sovereign cloud.| |[sample_send_small_logs.py][sample_send_small_logs] and [sample_send_small_logs_async.py][sample_send_small_logs_async]|Send a small number of logs to a Log Analytics workspace.| |[sample_custom_error_callback.py][sample_custom_error_callback] and [sample_custom_error_callback_async.py][sample_custom_error_callback_async]|Use error callbacks to customize how errors are handled during upload. | |[sample_upload_file_contents.py][sample_upload_file_contents] and [sample_upload_file_contents_async.py][sample_upload_file_contents_async]|Upload the contents of a file to a Log Analytics workspace.| @@ -72,6 +73,8 @@ To learn more about Azure Monitor, see the [Azure Monitor service documentation] +[sample_authentication]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/sample_authentication.py +[sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_authentication_async.py [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 diff --git a/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_authentication_async.py b/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_authentication_async.py new file mode 100644 index 000000000000..1c076e709dd9 --- /dev/null +++ b/sdk/monitor/azure-monitor-ingestion/samples/async_samples/sample_authentication_async.py @@ -0,0 +1,51 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_authentication_async.py + +DESCRIPTION: + This sample demonstrates how to authenticate the LogsIngestionClient. + + Note: This sample requires the azure-identity library. + +USAGE: + python sample_authentication_async.py +""" + +import asyncio + + +async def authenticate_public_cloud(): + # [START create_client_public_cloud_async] + from azure.identity.aio import DefaultAzureCredential + from azure.monitor.ingestion.aio import LogsIngestionClient + + credential = DefaultAzureCredential() + endpoint = "https://example.ingest.monitor.azure.com" + client = LogsIngestionClient(endpoint, credential) + # [END create_client_public_cloud_async] + + +async def authenticate_sovereign_cloud(): + # [START create_client_sovereign_cloud_async] + from azure.identity import AzureAuthorityHosts + from azure.identity.aio import DefaultAzureCredential + from azure.monitor.ingestion.aio import LogsIngestionClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + endpoint = "https://example.ingest.monitor.azure.us" + client = LogsIngestionClient(endpoint, credential, credential_scopes=["https://monitor.azure.us/.default"]) + # [END create_client_sovereign_cloud_async] + + +async def main(): + await authenticate_public_cloud() + await authenticate_sovereign_cloud() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/sdk/monitor/azure-monitor-ingestion/samples/sample_authentication.py b/sdk/monitor/azure-monitor-ingestion/samples/sample_authentication.py new file mode 100644 index 000000000000..9cb512de58bc --- /dev/null +++ b/sdk/monitor/azure-monitor-ingestion/samples/sample_authentication.py @@ -0,0 +1,44 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_authentication.py + +DESCRIPTION: + This sample demonstrates how to authenticate the LogsIngestionClient. + + Note: This sample requires the azure-identity library. + +USAGE: + python sample_authentication.py +""" + + +def authenticate_public_cloud(): + # [START create_client_public_cloud] + from azure.identity import DefaultAzureCredential + from azure.monitor.ingestion import LogsIngestionClient + + credential = DefaultAzureCredential() + endpoint = "https://example.ingest.monitor.azure.com" + client = LogsIngestionClient(endpoint, credential) + # [END create_client_public_cloud] + + +def authenticate_sovereign_cloud(): + # [START create_client_sovereign_cloud] + from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + from azure.monitor.ingestion import LogsIngestionClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + endpoint = "https://example.ingest.monitor.azure.us" + client = LogsIngestionClient(endpoint, credential, credential_scopes=["https://monitor.azure.us/.default"]) + # [END create_client_sovereign_cloud] + + +if __name__ == "__main__": + authenticate_public_cloud() + authenticate_sovereign_cloud() diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 275da0c8b242..3103aa7f99de 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -73,8 +73,15 @@ async_metrics_client = MetricsClient("https://", credential) By default, `LogsQueryClient` and `MetricsQueryClient` are configured to connect to the public Azure cloud. These can be configured to connect to non-public Azure clouds by passing in the correct `endpoint` argument: For example: ```python -logs_query_client = LogsQueryClient(credential, endpoint="https://api.loganalytics.azure.cn/v1") -metrics_query_client = MetricsQueryClient(credential, endpoint="https://management.chinacloudapi.cn") +from azure.identity import AzureAuthorityHosts, DefaultAzureCredential +from azure.monitor.query import LogsQueryClient, MetricsQueryClient + +# Authority can also be set via the AZURE_AUTHORITY_HOST environment variable. +credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + +logs_query_client = LogsQueryClient(credential, endpoint="https://api.loganalytics.us/v1") +metrics_query_client = MetricsQueryClient(credential, endpoint="https://management.usgovcloudapi.net") + ``` **Note**: Currently, `MetricsQueryClient` uses the Azure Resource Manager (ARM) endpoint for querying metrics, so you will need the corresponding management endpoint for your cloud when using this client. This is subject to change in the future. diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py index e0c3ea902984..75ad359d3e3c 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py @@ -48,6 +48,15 @@ class LogsQueryClient(object): # pylint: disable=client-accepts-api-version-key :language: python :dedent: 4 :caption: Creating the LogsQueryClient with a TokenCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_authentication.py + :start-after: [START create_logs_query_client_sovereign_cloud] + :end-before: [END create_logs_query_client_sovereign_cloud] + :language: python + :dedent: 4 + :caption: Creating the LogsQueryClient for use with a sovereign cloud (i.e. non-public cloud). """ def __init__(self, credential: TokenCredential, **kwargs: Any) -> None: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py index 7bae95c6863d..a0f3c4980415 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py @@ -38,6 +38,15 @@ class MetricsQueryClient(object): # pylint: disable=client-accepts-api-version- :language: python :dedent: 4 :caption: Creating the MetricsQueryClient with a TokenCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_authentication.py + :start-after: [START create_metrics_query_client_sovereign_cloud] + :end-before: [END create_metrics_query_client_sovereign_cloud] + :language: python + :dedent: 4 + :caption: Creating the MetricsQueryClient for use with a sovereign cloud (i.e. non-public cloud). """ def __init__(self, credential: TokenCredential, **kwargs: Any) -> None: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py index 1207b891c9ba..016611f22a1f 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py @@ -43,6 +43,15 @@ class LogsQueryClient(object): # pylint: disable=client-accepts-api-version-key :language: python :dedent: 4 :caption: Creating the asynchronous LogsQueryClient with a TokenCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_authentication_async.py + :start-after: [START create_logs_query_client_sovereign_cloud_async] + :end-before: [END create_logs_query_client_sovereign_cloud_async] + :language: python + :dedent: 4 + :caption: Creating the LogsQueryClient for use with a sovereign cloud (i.e. non-public cloud). """ def __init__(self, credential: AsyncTokenCredential, **kwargs: Any) -> None: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py index 48115e494b19..db99bf882972 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_metrics_query_client_async.py @@ -37,6 +37,15 @@ class MetricsQueryClient(object): # pylint: disable=client-accepts-api-version- :language: python :dedent: 4 :caption: Creating the asynchronous MetricsQueryClient with a TokenCredential. + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_authentication_async.py + :start-after: [START create_metrics_query_client_sovereign_cloud_async] + :end-before: [END create_metrics_query_client_sovereign_cloud_async] + :language: python + :dedent: 4 + :caption: Creating the MetricsQueryClient for use with a sovereign cloud (i.e. non-public cloud). """ def __init__(self, credential: AsyncTokenCredential, **kwargs: Any) -> None: diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_authentication_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_authentication_async.py index 8d55b0867860..2ca9ce52d774 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_authentication_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_authentication_async.py @@ -24,6 +24,17 @@ async def create_logs_query_client_async(): # [END create_logs_query_client_async] +async def create_logs_query_client_sovereign_cloud_async(): + # [START create_logs_query_client_sovereign_cloud_async] + from azure.identity import AzureAuthorityHosts + from azure.identity.aio import DefaultAzureCredential + from azure.monitor.query.aio import LogsQueryClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + client = LogsQueryClient(credential, endpoint="https://api.loganalytics.us/v1") + # [END create_logs_query_client_sovereign_cloud_async] + + async def create_metrics_query_client_async(): # [START create_metrics_query_client_async] from azure.identity.aio import DefaultAzureCredential @@ -34,9 +45,22 @@ async def create_metrics_query_client_async(): # [END create_metrics_query_client_async] +async def create_metrics_query_client_sovereign_cloud_async(): + # [START create_metrics_query_client_sovereign_cloud_async] + from azure.identity import AzureAuthorityHosts + from azure.identity.aio import DefaultAzureCredential + from azure.monitor.query.aio import MetricsQueryClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + client = MetricsQueryClient(credential, endpoint="https://management.usgovcloudapi.net") + # [END create_metrics_query_client_sovereign_cloud_async] + + async def main(): await create_logs_query_client_async() + await create_logs_query_client_sovereign_cloud_async() await create_metrics_query_client_async() + await create_metrics_query_client_sovereign_cloud_async() if __name__ == '__main__': diff --git a/sdk/monitor/azure-monitor-query/samples/sample_authentication.py b/sdk/monitor/azure-monitor-query/samples/sample_authentication.py index 00f148065b6b..d2c7ab28fc6c 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_authentication.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_authentication.py @@ -23,6 +23,16 @@ def create_logs_query_client(): # [END create_logs_query_client] +def create_logs_query_client_sovereign_cloud(): + # [START create_logs_query_client_sovereign_cloud] + from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + from azure.monitor.query import LogsQueryClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + client = LogsQueryClient(credential, endpoint="https://api.loganalytics.us/v1") + # [END create_logs_query_client_sovereign_cloud] + + def create_metrics_query_client(): # [START create_metrics_query_client] from azure.identity import DefaultAzureCredential @@ -33,6 +43,18 @@ def create_metrics_query_client(): # [END create_metrics_query_client] +def create_metrics_query_client_sovereign_cloud(): + # [START create_metrics_query_client_sovereign_cloud] + from azure.identity import AzureAuthorityHosts, DefaultAzureCredential + from azure.monitor.query import MetricsQueryClient + + credential = DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) + client = MetricsQueryClient(credential, endpoint="https://management.usgovcloudapi.net") + # [END create_metrics_query_client_sovereign_cloud] + + if __name__ == '__main__': create_logs_query_client() + create_logs_query_client_sovereign_cloud() create_metrics_query_client() + create_metrics_query_client_sovereign_cloud() From 5a2d1955551279cc2b61c7309f4ff7d3b4b26070 Mon Sep 17 00:00:00 2001 From: Nagkumar Arkalgud Date: Tue, 12 Mar 2024 13:54:51 -0700 Subject: [PATCH 24/28] Support for file contents in simulated messages (#34726) * Reverting models to make sure calls to the simulator work * quotes * Spellcheck fixes * ignore the models for doc generation * Fixed the quotes on f strings * pylint skip file * Support for summarization * Adding a limit of 2 conversation turns for all but conversation simulators * exclude synthetic from mypy * Another lint fix * Skip the file causing linting issues --- .../generative/index/_embeddings/__init__.py | 1 + .../ai/generative/index/_utils/logging.py | 1 + .../simulator/_callback_conversation_bot.py | 22 +++++++++++++++++-- .../simulator/simulator/simulator.py | 6 +++-- sdk/ai/azure-ai-generative/pyproject.toml | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/sdk/ai/azure-ai-generative/azure/ai/generative/index/_embeddings/__init__.py b/sdk/ai/azure-ai-generative/azure/ai/generative/index/_embeddings/__init__.py index c2938372b55d..6aa5846c8063 100644 --- a/sdk/ai/azure-ai-generative/azure/ai/generative/index/_embeddings/__init__.py +++ b/sdk/ai/azure-ai-generative/azure/ai/generative/index/_embeddings/__init__.py @@ -2,6 +2,7 @@ # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- +# pylint: skip-file """Embeddings generation and management tools.""" import contextlib import copy diff --git a/sdk/ai/azure-ai-generative/azure/ai/generative/index/_utils/logging.py b/sdk/ai/azure-ai-generative/azure/ai/generative/index/_utils/logging.py index 7f6a47408fea..b6c56c305b7d 100644 --- a/sdk/ai/azure-ai-generative/azure/ai/generative/index/_utils/logging.py +++ b/sdk/ai/azure-ai-generative/azure/ai/generative/index/_utils/logging.py @@ -1,6 +1,7 @@ # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- +# pylint: disable=W0125 """Logging utilities.""" import inspect import logging diff --git a/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/_callback_conversation_bot.py b/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/_callback_conversation_bot.py index 007201fe9baf..8cdf2f45ec8c 100644 --- a/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/_callback_conversation_bot.py +++ b/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/_callback_conversation_bot.py @@ -1,6 +1,7 @@ # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- +#pylint: skip-file import copy from typing import List, Tuple @@ -29,8 +30,22 @@ async def generate_response( self.user_template, conversation_history, self.user_template_parameters ) msg_copy = copy.deepcopy(chat_protocol_message) - result = await self.callback(msg_copy) - + result = {} + try: + result = await self.callback(msg_copy) + except Exception as exc: + if "status_code" in dir(exc) and 400 <= exc.status_code < 500 and "response was filtered" in exc.message: + result = { + "messages": [{ + "content": ("Error: The response was filtered due to the prompt " + "triggering Azure OpenAI's content management policy. " + "Please modify your prompt and retry."), + "role": "assistant" + }], + "finish_reason": ["stop"], + "id": None, + "template_parameters": {} + } self.logger.info("Using user provided callback returning response.") time_taken = 0 @@ -54,6 +69,9 @@ def _to_chat_protocol(self, template, conversation_history, template_parameters) for _, m in enumerate(conversation_history): messages.append({"content": m.message, "role": m.role.value}) + if template_parameters.get("file_content", None) and any('File contents:' not in message['content'] for message in messages): + messages.append({"content": f"File contents: {template_parameters['file_content']}", "role": "user"}) + return { "template_parameters": template_parameters, "messages": messages, diff --git a/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/simulator.py b/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/simulator.py index f6a9162c30aa..2554ad75e489 100644 --- a/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/simulator.py +++ b/sdk/ai/azure-ai-generative/azure/ai/generative/synthetic/simulator/simulator/simulator.py @@ -194,7 +194,7 @@ def _join_conversation_starter(self, parameters, to_join): async def simulate_async( self, template: "Template", - max_conversation_turns: int, + max_conversation_turns: int = 2, parameters: Optional[List[dict]] = None, jailbreak: bool = False, api_call_retry_limit: int = 3, @@ -208,6 +208,7 @@ async def simulate_async( :keyword template: An instance of the Template class defining the conversation structure. :paramtype template: Template :keyword max_conversation_turns: The maximum number of conversation turns to simulate. + Defaults to 2, change only applies to chat templates. :paramtype max_conversation_turns: int :keyword parameters: A list of dictionaries containing the parameter values to be used in the simulations. Defaults to an empty list. @@ -239,7 +240,8 @@ async def simulate_async( if not isinstance(parameters, list): raise ValueError(f"Expect parameters to be a list of dictionary, but found {type(parameters)}") - + if "conversation" not in template.template_name: + max_conversation_turns = 2 if template.content_harm: self._ensure_service_dependencies() self.adversarial = True diff --git a/sdk/ai/azure-ai-generative/pyproject.toml b/sdk/ai/azure-ai-generative/pyproject.toml index 9e37165cc0f0..c12b3e784e21 100644 --- a/sdk/ai/azure-ai-generative/pyproject.toml +++ b/sdk/ai/azure-ai-generative/pyproject.toml @@ -13,7 +13,7 @@ strict_sphinx = true [tool.mypy] python_version = "3.10" -exclude = ["azure/ai/generative/index/_langchain/vendor", "tests", "setup.py", "samples", "azure/ai/generative/evaluate/pf_templates/built_in_metrics"] +exclude = ["azure/ai/generative/index/_langchain/vendor", "tests", "setup.py", "samples", "azure/ai/generative/evaluate/pf_templates/built_in_metrics", "azure/ai/generative/synthetic"] warn_unused_configs = true follow_imports = "skip" ignore_missing_imports = true From bf5fc50cba888068ed1e10faea8a6f5af287a7e5 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 12 Mar 2024 17:46:07 -0400 Subject: [PATCH 25/28] Increment package version after release of azure-eventgrid (#34737) --- sdk/eventgrid/azure-eventgrid/CHANGELOG.md | 10 ++++++++++ .../azure-eventgrid/azure/eventgrid/_version.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md index 7ee72a7c585e..67215858cab5 100644 --- a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 4.18.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 4.18.0 (2024-03-12) ### Features Added diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py index 7fc3c50a052f..b4a7ecb2e1b7 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "4.18.0" +VERSION = "4.18.1" From c3c285e19aae3b83dcb302d5865c0af97001fa76 Mon Sep 17 00:00:00 2001 From: Ronnie Geraghty Date: Tue, 12 Mar 2024 14:57:18 -0700 Subject: [PATCH 26/28] Turn on EnforceMaxLifeOfIssues (#34731) Turning on GitHub Action to enforce the max life of issues. "Close stale issues" --- .github/event-processor.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/event-processor.config b/.github/event-processor.config index 3cecb54ae77d..52e731644b0f 100644 --- a/.github/event-processor.config +++ b/.github/event-processor.config @@ -22,5 +22,5 @@ "IdentifyStalePullRequests": "On", "CloseAddressedIssues": "On", "LockClosedIssues": "On", - "EnforceMaxLifeOfIssues": "Off" + "EnforceMaxLifeOfIssues": "On" } From b3411ac62370322717e952b0542cbf60775202b9 Mon Sep 17 00:00:00 2001 From: Leighton Chen Date: Tue, 12 Mar 2024 22:22:26 -0700 Subject: [PATCH 27/28] Add process/cpu live metrics (#34735) --- .../CHANGELOG.md | 2 + .../exporter/_quickpulse/_constants.py | 2 +- .../exporter/_quickpulse/_live_metrics.py | 39 ++++++++++- .../setup.py | 4 ++ .../tests/quickpulse/test_live_metrics.py | 66 ++++++++++++++++++- shared_requirements.txt | 1 + 6 files changed, 111 insertions(+), 3 deletions(-) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md index d589309891ac..56200abdfc9d 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md @@ -6,6 +6,8 @@ - Add live metrics collection of requests/dependencies/exceptions ([#34673](https://github.com/Azure/azure-sdk-for-python/pull/34673)) +- Add live metrics collection of cpu time/process memory + ([#34735](https://github.com/Azure/azure-sdk-for-python/pull/34735)) ### Breaking Changes diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py index 94155b73f32c..b34228ce923d 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_constants.py @@ -49,4 +49,4 @@ class _DocumentIngressDocumentType(Enum): Event = "Event" Trace = "Trace" -# cSpell:disable +# cSpell:enable diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py index c84ae7b2a906..feb6922f4428 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_live_metrics.py @@ -1,8 +1,13 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +# cSpell:disable + +from typing import Any, Iterable, Optional + import platform -from typing import Any, Optional +import psutil +from opentelemetry.metrics import CallbackOptions, Observation from opentelemetry.sdk._logs import LogData from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.resources import Resource @@ -13,10 +18,12 @@ from azure.monitor.opentelemetry.exporter._generated.models import ContextTagKeys from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _COMMITTED_BYTES_NAME, _DEPENDENCY_DURATION_NAME, _DEPENDENCY_FAILURE_RATE_NAME, _DEPENDENCY_RATE_NAME, _EXCEPTION_RATE_NAME, + _PROCESSOR_TIME_NAME, _REQUEST_DURATION_NAME, _REQUEST_FAILURE_RATE_NAME, _REQUEST_RATE_NAME, @@ -43,6 +50,8 @@ ) +PROCESS = psutil.Process() + def enable_live_metrics(**kwargs: Any) -> None: """Live metrics entry point. @@ -113,6 +122,14 @@ def __init__(self, connection_string: Optional[str], resource: Optional[Resource "exc/sec", "live metrics exception rate per second" ) + self._process_memory_gauge = self._meter.create_observable_gauge( + _COMMITTED_BYTES_NAME[0], + [_get_process_memory], + ) + self._processor_time_gauge = self._meter.create_observable_gauge( + _PROCESSOR_TIME_NAME[0], + [_get_processor_time], + ) def _record_span(self, span: ReadableSpan) -> None: # Only record if in post state @@ -150,3 +167,23 @@ def _record_log_record(self, log_data: LogData) -> None: exc_message = log_record.attributes.get(SpanAttributes.EXCEPTION_MESSAGE) if exc_type is not None or exc_message is not None: self._exception_rate_counter.add(1) + + +# pylint: disable=unused-argument +def _get_process_memory(options: CallbackOptions) -> Iterable[Observation]: + # rss is non-swapped physical memory a process has used + yield Observation( + PROCESS.memory_info().rss, + {}, + ) + + +# pylint: disable=unused-argument +def _get_processor_time(options: CallbackOptions) -> Iterable[Observation]: + # Processor time does not include idle time + yield Observation( + 100 - psutil.cpu_times_percent().idle, + {}, + ) + +# cSpell:enable diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py index 56f8392cef1c..7668667ac21c 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/setup.py @@ -6,6 +6,7 @@ # license information. # -------------------------------------------------------------------------- +# cSpell:disable import os import re @@ -86,6 +87,7 @@ "msrest>=0.6.10", "opentelemetry-api~=1.21", "opentelemetry-sdk~=1.21", + "psutil>=5.9.8", ], entry_points={ "opentelemetry_traces_exporter": [ @@ -102,3 +104,5 @@ ] } ) + +# cSpell:enable diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py index f1699bd6beb7..464d7162ee07 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/tests/quickpulse/test_live_metrics.py @@ -1,22 +1,44 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +# cSpell:disable + +import collections import platform import unittest from unittest import mock -from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics import ( + Counter, + Histogram, + Meter, + MeterProvider, + ObservableGauge, +) from opentelemetry.sdk.resources import Resource, ResourceAttributes from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import SpanKind from azure.monitor.opentelemetry.exporter._generated.models import ContextTagKeys +from azure.monitor.opentelemetry.exporter._quickpulse._constants import ( + _COMMITTED_BYTES_NAME, + _DEPENDENCY_DURATION_NAME, + _DEPENDENCY_FAILURE_RATE_NAME, + _DEPENDENCY_RATE_NAME, + _EXCEPTION_RATE_NAME, + _PROCESSOR_TIME_NAME, + _REQUEST_DURATION_NAME, + _REQUEST_FAILURE_RATE_NAME, + _REQUEST_RATE_NAME, +) from azure.monitor.opentelemetry.exporter._quickpulse._exporter import ( _QuickpulseExporter, _QuickpulseMetricReader, ) from azure.monitor.opentelemetry.exporter._quickpulse._live_metrics import ( enable_live_metrics, + _get_process_memory, + _get_processor_time, _QuickpulseManager, ) from azure.monitor.opentelemetry.exporter._quickpulse._state import ( @@ -92,6 +114,28 @@ def test_init(self, generator_mock): self.assertEqual(qpm._reader._base_monitoring_data_point, qpm._base_monitoring_data_point) self.assertTrue(isinstance(qpm._meter_provider, MeterProvider)) self.assertEqual(qpm._meter_provider._sdk_config.metric_readers, [qpm._reader]) + self.assertTrue(isinstance(qpm._meter, Meter)) + self.assertEqual(qpm._meter.name, "azure_monitor_live_metrics") + self.assertTrue(isinstance(qpm._request_duration, Histogram)) + self.assertEqual(qpm._request_duration.name, _REQUEST_DURATION_NAME[0]) + self.assertTrue(isinstance(qpm._dependency_duration, Histogram)) + self.assertEqual(qpm._dependency_duration.name, _DEPENDENCY_DURATION_NAME[0]) + self.assertTrue(isinstance(qpm._request_rate_counter, Counter)) + self.assertEqual(qpm._request_rate_counter.name, _REQUEST_RATE_NAME[0]) + self.assertTrue(isinstance(qpm._request_failed_rate_counter, Counter)) + self.assertEqual(qpm._request_failed_rate_counter.name, _REQUEST_FAILURE_RATE_NAME[0]) + self.assertTrue(isinstance(qpm._dependency_rate_counter, Counter)) + self.assertEqual(qpm._dependency_rate_counter.name, _DEPENDENCY_RATE_NAME[0]) + self.assertTrue(isinstance(qpm._dependency_failure_rate_counter, Counter)) + self.assertEqual(qpm._dependency_failure_rate_counter.name, _DEPENDENCY_FAILURE_RATE_NAME[0]) + self.assertTrue(isinstance(qpm._exception_rate_counter, Counter)) + self.assertEqual(qpm._exception_rate_counter.name, _EXCEPTION_RATE_NAME[0]) + self.assertTrue(isinstance(qpm._process_memory_gauge, ObservableGauge)) + self.assertEqual(qpm._process_memory_gauge.name, _COMMITTED_BYTES_NAME[0]) + self.assertEqual(qpm._process_memory_gauge._callbacks, [_get_process_memory]) + self.assertTrue(isinstance(qpm._processor_time_gauge, ObservableGauge)) + self.assertEqual(qpm._processor_time_gauge.name, _PROCESSOR_TIME_NAME[0]) + self.assertEqual(qpm._processor_time_gauge._callbacks, [_get_processor_time]) def test_singleton(self): @@ -247,3 +291,23 @@ def test_record_log_exception(self, post_state_mock, log_doc_mock, append_doc_mo qpm._record_log_record(log_data_mock) append_doc_mock.assert_called_once_with(log_record_doc) qpm._exception_rate_counter.add.assert_called_once_with(1) + + def test_process_memory(self): + with mock.patch("azure.monitor.opentelemetry.exporter._quickpulse._live_metrics.PROCESS") as process_mock: + memory = collections.namedtuple('memory', 'rss') + pmem = memory(rss=40) + process_mock.memory_info.return_value = pmem + mem = _get_process_memory(None) + obs = next(mem) + self.assertEqual(obs.value, 40) + + @mock.patch("psutil.cpu_times_percent") + def test_processor_time(self, processor_mock): + cpu = collections.namedtuple('cpu', 'idle') + cpu_times = cpu(idle=94.5) + processor_mock.return_value = cpu_times + time = _get_processor_time(None) + obs = next(time) + self.assertEqual(obs.value, 5.5) + +# cSpell:enable diff --git a/shared_requirements.txt b/shared_requirements.txt index 564822a591a2..0cfd9cefeea1 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -17,6 +17,7 @@ azureml-telemetry cryptography msrestazure requests +psutil opencensus opencensus-ext-azure opencensus-ext-threading From e1e099fa1420d5e14027db0a59cde6c67694dc4a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 13 Mar 2024 06:25:31 +0000 Subject: [PATCH 28/28] CodeGen from PR 28072 in Azure/azure-rest-api-specs Merge 68aea0f474dc2fc15b27fca5d95b00197f303733 into 98df3588284c0b77389e981ef04aa93fed89037e --- sdk/signalr/azure-mgmt-signalr/_meta.json | 4 +- .../azure/mgmt/signalr/_configuration.py | 4 +- .../signalr/_signal_rmanagement_client.py | 6 +- .../azure/mgmt/signalr/_version.py | 2 +- .../azure/mgmt/signalr/aio/_configuration.py | 4 +- .../signalr/aio/_signal_rmanagement_client.py | 6 +- .../mgmt/signalr/aio/operations/__init__.py | 2 + .../operations/_signal_rreplica_operations.py | 494 +++++++++++++ .../azure/mgmt/signalr/models/_models_py3.py | 24 +- .../azure/mgmt/signalr/operations/__init__.py | 2 + .../mgmt/signalr/operations/_operations.py | 2 +- .../operations/_signal_r_operations.py | 24 +- ..._signal_rcustom_certificates_operations.py | 8 +- .../_signal_rcustom_domains_operations.py | 8 +- ...private_endpoint_connections_operations.py | 8 +- ...gnal_rprivate_link_resources_operations.py | 2 +- .../operations/_signal_rreplica_operations.py | 650 ++++++++++++++++++ .../_signal_rreplicas_operations.py | 12 +- ...hared_private_link_resources_operations.py | 8 +- .../signalr/operations/_usages_operations.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../signal_r_check_name_availability.py | 2 +- .../signal_r_create_or_update.py | 2 +- .../generated_samples/signal_r_delete.py | 2 +- .../generated_samples/signal_r_get.py | 2 +- .../signal_r_list_by_resource_group.py | 2 +- .../signal_r_list_by_subscription.py | 2 +- .../generated_samples/signal_r_list_keys.py | 2 +- .../signal_r_list_replica_skus.py | 2 +- .../generated_samples/signal_r_list_skus.py | 2 +- .../signal_r_regenerate_key.py | 2 +- .../generated_samples/signal_r_restart.py | 2 +- .../generated_samples/signal_r_update.py | 2 +- ...l_rcustom_certificates_create_or_update.py | 2 +- .../signal_rcustom_certificates_delete.py | 2 +- .../signal_rcustom_certificates_get.py | 2 +- .../signal_rcustom_certificates_list.py | 2 +- ...signal_rcustom_domains_create_or_update.py | 2 +- .../signal_rcustom_domains_delete.py | 2 +- .../signal_rcustom_domains_get.py | 2 +- .../signal_rcustom_domains_list.py | 2 +- ...al_rprivate_endpoint_connections_delete.py | 2 +- ...ignal_rprivate_endpoint_connections_get.py | 2 +- ...gnal_rprivate_endpoint_connections_list.py | 2 +- ...al_rprivate_endpoint_connections_update.py | 2 +- .../signal_rprivate_link_resources_list.py | 2 +- ...private_link_resources_create_or_update.py | 50 ++ ...plica_shared_private_link_resources_get.py | 43 ++ ...lica_shared_private_link_resources_list.py | 43 ++ .../signal_rreplicas_create_or_update.py | 2 +- .../signal_rreplicas_delete.py | 2 +- .../generated_samples/signal_rreplicas_get.py | 2 +- .../signal_rreplicas_list.py | 2 +- .../signal_rreplicas_restart.py | 2 +- .../signal_rreplicas_update.py | 2 +- ...private_link_resources_create_or_update.py | 2 +- ...l_rshared_private_link_resources_delete.py | 2 +- ...gnal_rshared_private_link_resources_get.py | 2 +- ...nal_rshared_private_link_resources_list.py | 2 +- .../generated_samples/usages_list.py | 2 +- sdk/webpubsub/azure-mgmt-webpubsub/_meta.json | 4 +- .../azure/mgmt/webpubsub/_configuration.py | 4 +- .../azure/mgmt/webpubsub/_version.py | 2 +- .../_web_pub_sub_management_client.py | 8 +- .../mgmt/webpubsub/aio/_configuration.py | 4 +- .../aio/_web_pub_sub_management_client.py | 8 +- .../mgmt/webpubsub/aio/operations/__init__.py | 2 + .../_web_pub_sub_replica_operations.py | 494 +++++++++++++ .../azure/mgmt/webpubsub/models/__init__.py | 2 + .../mgmt/webpubsub/models/_models_py3.py | 74 +- .../mgmt/webpubsub/operations/__init__.py | 2 + .../mgmt/webpubsub/operations/_operations.py | 2 +- .../operations/_usages_operations.py | 2 +- ..._pub_sub_custom_certificates_operations.py | 8 +- .../_web_pub_sub_custom_domains_operations.py | 8 +- .../_web_pub_sub_hubs_operations.py | 8 +- .../operations/_web_pub_sub_operations.py | 24 +- ...private_endpoint_connections_operations.py | 8 +- ...b_sub_private_link_resources_operations.py | 2 +- .../_web_pub_sub_replica_operations.py | 650 ++++++++++++++++++ .../_web_pub_sub_replicas_operations.py | 12 +- ...hared_private_link_resources_operations.py | 8 +- .../generated_samples/operations_list.py | 2 +- .../generated_samples/usages_list.py | 2 +- .../web_pub_sub_check_name_availability.py | 2 +- .../web_pub_sub_create_or_update.py | 3 +- ...ub_custom_certificates_create_or_update.py | 2 +- .../web_pub_sub_custom_certificates_delete.py | 2 +- .../web_pub_sub_custom_certificates_get.py | 2 +- .../web_pub_sub_custom_certificates_list.py | 2 +- ...pub_sub_custom_domains_create_or_update.py | 2 +- .../web_pub_sub_custom_domains_delete.py | 2 +- .../web_pub_sub_custom_domains_get.py | 2 +- .../web_pub_sub_custom_domains_list.py | 2 +- .../generated_samples/web_pub_sub_delete.py | 2 +- .../generated_samples/web_pub_sub_get.py | 2 +- .../web_pub_sub_hubs_create_or_update.py | 3 +- .../web_pub_sub_hubs_delete.py | 2 +- .../generated_samples/web_pub_sub_hubs_get.py | 2 +- .../web_pub_sub_hubs_list.py | 2 +- .../web_pub_sub_list_by_resource_group.py | 2 +- .../web_pub_sub_list_by_subscription.py | 2 +- .../web_pub_sub_list_keys.py | 2 +- .../web_pub_sub_list_replica_skus.py | 2 +- .../web_pub_sub_list_skus.py | 2 +- ...sub_private_endpoint_connections_delete.py | 2 +- ...ub_sub_private_endpoint_connections_get.py | 2 +- ...b_sub_private_endpoint_connections_list.py | 2 +- ...sub_private_endpoint_connections_update.py | 2 +- ...web_pub_sub_private_link_resources_list.py | 2 +- .../web_pub_sub_regenerate_key.py | 2 +- ...private_link_resources_create_or_update.py | 50 ++ ...plica_shared_private_link_resources_get.py | 43 ++ ...lica_shared_private_link_resources_list.py | 43 ++ .../web_pub_sub_replicas_create_or_update.py | 2 +- .../web_pub_sub_replicas_delete.py | 2 +- .../web_pub_sub_replicas_get.py | 2 +- .../web_pub_sub_replicas_list.py | 2 +- .../web_pub_sub_replicas_restart.py | 2 +- .../web_pub_sub_replicas_update.py | 2 +- .../generated_samples/web_pub_sub_restart.py | 2 +- ...private_link_resources_create_or_update.py | 2 +- ...ub_shared_private_link_resources_delete.py | 2 +- ...b_sub_shared_private_link_resources_get.py | 2 +- ..._sub_shared_private_link_resources_list.py | 2 +- .../generated_samples/web_pub_sub_update.py | 3 +- 126 files changed, 2843 insertions(+), 196 deletions(-) create mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplica_operations.py create mode 100644 sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplica_operations.py create mode 100644 sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_create_or_update.py create mode 100644 sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_get.py create mode 100644 sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_list.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_replica_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replica_operations.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_create_or_update.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_get.py create mode 100644 sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_list.py diff --git a/sdk/signalr/azure-mgmt-signalr/_meta.json b/sdk/signalr/azure-mgmt-signalr/_meta.json index 13b2a3955370..998cfe4b0795 100644 --- a/sdk/signalr/azure-mgmt-signalr/_meta.json +++ b/sdk/signalr/azure-mgmt-signalr/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c280892951a9e45c059132c05aace25a9c752d48", + "commit": "1c97625c82c459225dc00b8ef7811eb8675f616f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/signalr/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/signalr/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/signalr/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py index 2ff46ccc038c..de768211fba4 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py @@ -29,14 +29,14 @@ class SignalRManagementClientConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-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: super(SignalRManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-08-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py index c7173fa40d2d..7a01c1ced6ae 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py @@ -22,6 +22,7 @@ SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, + SignalRReplicaOperations, SignalRReplicasOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations, @@ -55,6 +56,8 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations :ivar signal_rreplicas: SignalRReplicasOperations operations :vartype signal_rreplicas: azure.mgmt.signalr.operations.SignalRReplicasOperations + :ivar signal_rreplica: SignalRReplicaOperations operations + :vartype signal_rreplica: azure.mgmt.signalr.operations.SignalRReplicaOperations :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations :vartype signal_rshared_private_link_resources: @@ -65,7 +68,7 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key :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 "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -106,6 +109,7 @@ def __init__( self.signal_rreplicas = SignalRReplicasOperations( self._client, self._config, self._serialize, self._deserialize ) + self.signal_rreplica = SignalRReplicaOperations(self._client, self._config, self._serialize, self._deserialize) self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py index 2eda20789583..e5754a47ce68 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py index 0dc64cb72302..b88d93b4a617 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py @@ -29,14 +29,14 @@ class SignalRManagementClientConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-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: super(SignalRManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-08-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py index 569ddba1f4b7..9d824a84fc77 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py @@ -22,6 +22,7 @@ SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, + SignalRReplicaOperations, SignalRReplicasOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations, @@ -56,6 +57,8 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key azure.mgmt.signalr.aio.operations.SignalRPrivateLinkResourcesOperations :ivar signal_rreplicas: SignalRReplicasOperations operations :vartype signal_rreplicas: azure.mgmt.signalr.aio.operations.SignalRReplicasOperations + :ivar signal_rreplica: SignalRReplicaOperations operations + :vartype signal_rreplica: azure.mgmt.signalr.aio.operations.SignalRReplicaOperations :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations :vartype signal_rshared_private_link_resources: @@ -66,7 +69,7 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key :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 "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -107,6 +110,7 @@ def __init__( self.signal_rreplicas = SignalRReplicasOperations( self._client, self._config, self._serialize, self._deserialize ) + self.signal_rreplica = SignalRReplicaOperations(self._client, self._config, self._serialize, self._deserialize) self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py index e15b22bc07ac..d7f6b20554dc 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py @@ -14,6 +14,7 @@ from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations from ._signal_rreplicas_operations import SignalRReplicasOperations +from ._signal_rreplica_operations import SignalRReplicaOperations from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -29,6 +30,7 @@ "SignalRPrivateEndpointConnectionsOperations", "SignalRPrivateLinkResourcesOperations", "SignalRReplicasOperations", + "SignalRReplicaOperations", "SignalRSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplica_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplica_operations.py new file mode 100644 index 000000000000..203a28761d26 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplica_operations.py @@ -0,0 +1,494 @@ +# 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 io import IOBase +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._signal_rreplica_operations import ( + build_shared_private_link_resources_create_or_update_request, + build_shared_private_link_resources_get_request, + build_shared_private_link_resources_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SignalRReplicaOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.signalr.aio.SignalRManagementClient`'s + :attr:`signal_rreplica` 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 shared_private_link_resources_list( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :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: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResourceList] = 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_shared_private_link_resources_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_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("SharedPrivateLinkResourceList", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + + shared_private_link_resources_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + } + + @distributed_trace_async + async def shared_private_link_resources_get( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Get the specified shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :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.signalr.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + shared_private_link_resources_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + async def _shared_private_link_resources_create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> _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: str = kwargs.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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedPrivateLinkResource") + + request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._shared_private_link_resources_create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _shared_private_link_resources_create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: ~azure.mgmt.signalr.models.SharedPrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + 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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Is either a SharedPrivateLinkResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.signalr.models.SharedPrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.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: str = kwargs.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, 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._shared_private_link_resources_create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_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("SharedPrivateLinkResource", 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_shared_private_link_resources_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py index c6b07d939cc1..00e9312da673 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py @@ -1605,7 +1605,7 @@ class ResourceSku(_serialization.Model): :ivar name: The name of the SKU. Required. - Allowed values: Standard_S1, Free_F1, Premium_P1. Required. + Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2. Required. :vartype name: str :ivar tier: Optional tier of this particular SKU. 'Standard' or 'Free'. @@ -1616,12 +1616,14 @@ class ResourceSku(_serialization.Model): :vartype size: str :ivar family: Not used. Retained for future use. :vartype family: str - :ivar capacity: Optional, integer. The unit count of the resource. 1 by default. + :ivar capacity: Optional, integer. The unit count of the resource. + 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. If present, following values are allowed: - Free: 1; - Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; - Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;. + Free_F1: 1; + Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P2: 100,200,300,400,500,600,700,800,900,1000;. :vartype capacity: int """ @@ -1650,19 +1652,21 @@ def __init__( """ :keyword name: The name of the SKU. Required. - Allowed values: Standard_S1, Free_F1, Premium_P1. Required. + Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2. Required. :paramtype name: str :keyword tier: Optional tier of this particular SKU. 'Standard' or 'Free'. ``Basic`` is deprecated, use ``Standard`` instead. Known values are: "Free", "Basic", "Standard", and "Premium". :paramtype tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier - :keyword capacity: Optional, integer. The unit count of the resource. 1 by default. + :keyword capacity: Optional, integer. The unit count of the resource. + 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. If present, following values are allowed: - Free: 1; - Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; - Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;. + Free_F1: 1; + Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P2: 100,200,300,400,500,600,700,800,900,1000;. :paramtype capacity: int """ super().__init__(**kwargs) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py index e15b22bc07ac..d7f6b20554dc 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py @@ -14,6 +14,7 @@ from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations from ._signal_rreplicas_operations import SignalRReplicasOperations +from ._signal_rreplica_operations import SignalRReplicaOperations from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -29,6 +30,7 @@ "SignalRPrivateEndpointConnectionsOperations", "SignalRPrivateLinkResourcesOperations", "SignalRReplicasOperations", + "SignalRReplicaOperations", "SignalRSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py index 95ca3c13e0da..414084785231 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py @@ -40,7 +40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py index c9e4108a6c81..1a4bfabb74f3 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py @@ -43,7 +43,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74,7 +74,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -294,7 +294,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -334,7 +334,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) 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_list_replica_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -425,7 +425,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +465,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py index e62034b88d75..5d540902627a 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py index 9662b6e18f26..e3d69b369ced 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py index 305559f8e82f..74828f1cafb6 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py index f871079d813f..1d2afcc4bfc5 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py @@ -42,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplica_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplica_operations.py new file mode 100644 index 000000000000..4ea4aa65da37 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplica_operations.py @@ -0,0 +1,650 @@ +# 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 io import IOBase +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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_shared_private_link_resources_list_request( + resource_group_name: str, resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_shared_private_link_resources_get_request( + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # 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 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**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_shared_private_link_resources_create_or_update_request( + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # 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 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**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) + + +class SignalRReplicaOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.signalr.SignalRManagementClient`'s + :attr:`signal_rreplica` 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 shared_private_link_resources_list( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> Iterable["_models.SharedPrivateLinkResource"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :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: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResourceList] = 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_shared_private_link_resources_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_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("SharedPrivateLinkResourceList", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + + shared_private_link_resources_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + } + + @distributed_trace + def shared_private_link_resources_get( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Get the specified shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :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.signalr.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + shared_private_link_resources_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + def _shared_private_link_resources_create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> _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: str = kwargs.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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedPrivateLinkResource") + + request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._shared_private_link_resources_create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _shared_private_link_resources_create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: ~azure.mgmt.signalr.models.SharedPrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + 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.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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.signalr.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Is either a SharedPrivateLinkResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.signalr.models.SharedPrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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.signalr.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: str = kwargs.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._shared_private_link_resources_create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_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("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_shared_private_link_resources_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py index 96a1e2028c29..5f2f68f8e4d2 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +133,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +232,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -283,7 +283,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py index 9647cafccd61..dfb17c720de1 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py index d48ed872f931..ebd14973448e 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py @@ -40,7 +40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py index e79c77362c77..46896cde7e45 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py index ccf2e6923bc3..009378ce42ec 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CheckNameAvailability.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py index d6865a294c01..8be73248fe0c 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py index 5b2c1fcaeeec..065d469a8875 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py index a3c6607c6504..01547d948739 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py index 02083322c5d4..904d511c52d1 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListByResourceGroup.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py index 201913bf0faa..a364c694d1e7 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListBySubscription.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py index c72fbaaea080..b1c0a3886fdb 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListKeys.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py index b36dacd3c4fe..ad882223028f 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListReplicaSkus.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_ListReplicaSkus.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py index 47db232b95ce..212cad3bd651 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListSkus.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py index d42c3b8bdd30..eec8314b4045 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_RegenerateKey.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py index 637a577d6011..4fd8c6632e22 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Restart.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_Restart.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py index 4a7af8c6c474..1a3f12eda216 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Update.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalR_Update.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py index 22b63e33e173..327ce882b2d7 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py index bec8224d3282..8dcc17eaf73b 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomCertificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py index 65d1218ffc88..d30647f89a5a 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomCertificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py index 60bc26c57e41..1cf65687f648 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomCertificates_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py index 4c6e71c9fc54..5dbb231a3644 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py index 0f01df9c0a6e..df3e4f1d2a43 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomDomains_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py index e221230f6d9b..d9d065d3db2d 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomDomains_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py index dfce99e158e5..a4ead3610822 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRCustomDomains_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py index d2601e67e484..f63b73168464 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py index 0710b311eb79..007eb622ff73 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRPrivateEndpointConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py index a4df76dc4dbb..f746f37493a7 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRPrivateEndpointConnections_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py index 567b5f62478a..4371f3926ac8 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Update.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRPrivateEndpointConnections_Update.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py index f7348c2156e0..600a5e9f28cc 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateLinkResources_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_create_or_update.py new file mode 100644 index 000000000000..05a5a8d66a65 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_create_or_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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplica_shared_private_link_resources_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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplica.begin_shared_private_link_resources_create_or_update( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + shared_private_link_resource_name="upstream", + parameters={ + "properties": { + "groupId": "sites", + "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp", + "requestMessage": "Please approve", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplica_SharedPrivateLinkResources_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_get.py new file mode 100644 index 000000000000..8b0e7a10d4d9 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplica_shared_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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplica.shared_private_link_resources_get( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + shared_private_link_resource_name="upstream", + ) + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplica_SharedPrivateLinkResources_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_list.py new file mode 100644 index 000000000000..cbf8a2ee2e32 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplica_shared_private_link_resources_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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplica_shared_private_link_resources_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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplica.shared_private_link_resources_list( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplica_SharedPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py index 0a29d1a5d99a..ce3dfe27d31d 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py index ee5af6332ca9..c532545efe33 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py index a590ebb170fb..c82c9e270a8b 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py index 8da70b2dd009..b71ac491e25b 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py index 2bdad1bbc109..0fef6592ade7 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Restart.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_Restart.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py index 621877131023..d7bf4e3cfb65 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Update.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRReplicas_Update.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py index 1d27604a2e58..bb967a5ec4b4 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py index 21507649c827..137abd3c37b9 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py index b7ebf823170d..b08ab57c75e5 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py index ea0565beb5c4..bce36041ae55 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/SignalRSharedPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py index 39ca0381ec46..1bf0b9587bf8 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json b/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json index b4ecb53e616e..15a607819740 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json +++ b/sdk/webpubsub/azure-mgmt-webpubsub/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c280892951a9e45c059132c05aace25a9c752d48", + "commit": "1c97625c82c459225dc00b8ef7811eb8675f616f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/webpubsub/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/webpubsub/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/webpubsub/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py index ebea80cbe463..b37022c3c91b 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py @@ -29,14 +29,14 @@ class WebPubSubManagementClientConfiguration(Configuration): # pylint: disable= :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-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: super(WebPubSubManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-08-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py index 2eda20789583..eae7c95b6fbd 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b2" +VERSION = "0.1.0" diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py index e2a6a436eb6c..226ae3f0040f 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_web_pub_sub_management_client.py @@ -24,6 +24,7 @@ WebPubSubOperations, WebPubSubPrivateEndpointConnectionsOperations, WebPubSubPrivateLinkResourcesOperations, + WebPubSubReplicaOperations, WebPubSubReplicasOperations, WebPubSubSharedPrivateLinkResourcesOperations, ) @@ -59,6 +60,8 @@ class WebPubSubManagementClient: # pylint: disable=client-accepts-api-version-k azure.mgmt.webpubsub.operations.WebPubSubPrivateLinkResourcesOperations :ivar web_pub_sub_replicas: WebPubSubReplicasOperations operations :vartype web_pub_sub_replicas: azure.mgmt.webpubsub.operations.WebPubSubReplicasOperations + :ivar web_pub_sub_replica: WebPubSubReplicaOperations operations + :vartype web_pub_sub_replica: azure.mgmt.webpubsub.operations.WebPubSubReplicaOperations :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations :vartype web_pub_sub_shared_private_link_resources: @@ -69,7 +72,7 @@ class WebPubSubManagementClient: # pylint: disable=client-accepts-api-version-k :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 "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -111,6 +114,9 @@ def __init__( self.web_pub_sub_replicas = WebPubSubReplicasOperations( self._client, self._config, self._serialize, self._deserialize ) + self.web_pub_sub_replica = WebPubSubReplicaOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py index 4608f2d3b45c..8188357ec3ea 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_configuration.py @@ -29,14 +29,14 @@ class WebPubSubManagementClientConfiguration(Configuration): # pylint: disable= :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-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: super(WebPubSubManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-08-01-preview") + api_version: str = kwargs.pop("api_version", "2024-01-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py index 4c5b41c998cd..c634195c2f50 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/_web_pub_sub_management_client.py @@ -24,6 +24,7 @@ WebPubSubOperations, WebPubSubPrivateEndpointConnectionsOperations, WebPubSubPrivateLinkResourcesOperations, + WebPubSubReplicaOperations, WebPubSubReplicasOperations, WebPubSubSharedPrivateLinkResourcesOperations, ) @@ -59,6 +60,8 @@ class WebPubSubManagementClient: # pylint: disable=client-accepts-api-version-k azure.mgmt.webpubsub.aio.operations.WebPubSubPrivateLinkResourcesOperations :ivar web_pub_sub_replicas: WebPubSubReplicasOperations operations :vartype web_pub_sub_replicas: azure.mgmt.webpubsub.aio.operations.WebPubSubReplicasOperations + :ivar web_pub_sub_replica: WebPubSubReplicaOperations operations + :vartype web_pub_sub_replica: azure.mgmt.webpubsub.aio.operations.WebPubSubReplicaOperations :ivar web_pub_sub_shared_private_link_resources: WebPubSubSharedPrivateLinkResourcesOperations operations :vartype web_pub_sub_shared_private_link_resources: @@ -69,7 +72,7 @@ class WebPubSubManagementClient: # pylint: disable=client-accepts-api-version-k :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 "2023-08-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2024-01-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 @@ -111,6 +114,9 @@ def __init__( self.web_pub_sub_replicas = WebPubSubReplicasOperations( self._client, self._config, self._serialize, self._deserialize ) + self.web_pub_sub_replica = WebPubSubReplicaOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.web_pub_sub_shared_private_link_resources = WebPubSubSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py index c10ad6661320..49f4676fbe9d 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/__init__.py @@ -15,6 +15,7 @@ from ._web_pub_sub_private_endpoint_connections_operations import WebPubSubPrivateEndpointConnectionsOperations from ._web_pub_sub_private_link_resources_operations import WebPubSubPrivateLinkResourcesOperations from ._web_pub_sub_replicas_operations import WebPubSubReplicasOperations +from ._web_pub_sub_replica_operations import WebPubSubReplicaOperations from ._web_pub_sub_shared_private_link_resources_operations import WebPubSubSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -31,6 +32,7 @@ "WebPubSubPrivateEndpointConnectionsOperations", "WebPubSubPrivateLinkResourcesOperations", "WebPubSubReplicasOperations", + "WebPubSubReplicaOperations", "WebPubSubSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_replica_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_replica_operations.py new file mode 100644 index 000000000000..1c1579da74b7 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/aio/operations/_web_pub_sub_replica_operations.py @@ -0,0 +1,494 @@ +# 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 io import IOBase +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._web_pub_sub_replica_operations import ( + build_shared_private_link_resources_create_or_update_request, + build_shared_private_link_resources_get_request, + build_shared_private_link_resources_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class WebPubSubReplicaOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.webpubsub.aio.WebPubSubManagementClient`'s + :attr:`web_pub_sub_replica` 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 shared_private_link_resources_list( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :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: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResourceList] = 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_shared_private_link_resources_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_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("SharedPrivateLinkResourceList", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + + shared_private_link_resources_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + } + + @distributed_trace_async + async def shared_private_link_resources_get( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Get the specified shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :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.webpubsub.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + shared_private_link_resources_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + async def _shared_private_link_resources_create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> _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: str = kwargs.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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedPrivateLinkResource") + + request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._shared_private_link_resources_create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _shared_private_link_resources_create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + 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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Is either a SharedPrivateLinkResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 SharedPrivateLinkResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.webpubsub.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: str = kwargs.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, 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._shared_private_link_resources_create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_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("SharedPrivateLinkResource", 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_shared_private_link_resources_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py index dc072ffb16b3..5a3e3d1254da 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/__init__.py @@ -72,6 +72,7 @@ from ._models_py3 import WebPubSubNetworkACLs from ._models_py3 import WebPubSubResource from ._models_py3 import WebPubSubResourceList +from ._models_py3 import WebPubSubSocketIOSettings from ._models_py3 import WebPubSubTlsSettings from ._web_pub_sub_management_client_enums import ACLAction @@ -159,6 +160,7 @@ "WebPubSubNetworkACLs", "WebPubSubResource", "WebPubSubResourceList", + "WebPubSubSocketIOSettings", "WebPubSubTlsSettings", "ACLAction", "CreatedByType", diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py index d8b54f71ef3f..f960b96f05ed 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/models/_models_py3.py @@ -1877,7 +1877,7 @@ class ResourceSku(_serialization.Model): :ivar name: The name of the SKU. Required. - Allowed values: Standard_S1, Free_F1, Premium_P1. Required. + Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2. Required. :vartype name: str :ivar tier: Optional tier of this particular SKU. 'Standard' or 'Free'. @@ -1888,12 +1888,14 @@ class ResourceSku(_serialization.Model): :vartype size: str :ivar family: Not used. Retained for future use. :vartype family: str - :ivar capacity: Optional, integer. The unit count of the resource. 1 by default. + :ivar capacity: Optional, integer. The unit count of the resource. + 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. If present, following values are allowed: - Free: 1; - Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; - Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;. + Free_F1: 1; + Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P2: 100,200,300,400,500,600,700,800,900,1000;. :vartype capacity: int """ @@ -1922,19 +1924,21 @@ def __init__( """ :keyword name: The name of the SKU. Required. - Allowed values: Standard_S1, Free_F1, Premium_P1. Required. + Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2. Required. :paramtype name: str :keyword tier: Optional tier of this particular SKU. 'Standard' or 'Free'. ``Basic`` is deprecated, use ``Standard`` instead. Known values are: "Free", "Basic", "Standard", and "Premium". :paramtype tier: str or ~azure.mgmt.webpubsub.models.WebPubSubSkuTier - :keyword capacity: Optional, integer. The unit count of the resource. 1 by default. + :keyword capacity: Optional, integer. The unit count of the resource. + 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. If present, following values are allowed: - Free: 1; - Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; - Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;. + Free_F1: 1; + Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + Premium_P2: 100,200,300,400,500,600,700,800,900,1000;. :paramtype capacity: int """ super().__init__(**kwargs) @@ -2614,12 +2618,21 @@ class WebPubSubHubProperties(_serialization.Model): :ivar anonymous_connect_policy: The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". :vartype anonymous_connect_policy: str + :ivar web_socket_keep_alive_interval_in_seconds: The settings for configuring the WebSocket + ping-pong interval in seconds for all clients in the hub. Valid range: 1 to 120. Default to 20 + seconds. + :vartype web_socket_keep_alive_interval_in_seconds: int """ + _validation = { + "web_socket_keep_alive_interval_in_seconds": {"maximum": 120, "minimum": 1}, + } + _attribute_map = { "event_handlers": {"key": "eventHandlers", "type": "[EventHandler]"}, "event_listeners": {"key": "eventListeners", "type": "[EventListener]"}, "anonymous_connect_policy": {"key": "anonymousConnectPolicy", "type": "str"}, + "web_socket_keep_alive_interval_in_seconds": {"key": "webSocketKeepAliveIntervalInSeconds", "type": "int"}, } def __init__( @@ -2628,6 +2641,7 @@ def __init__( event_handlers: Optional[List["_models.EventHandler"]] = None, event_listeners: Optional[List["_models.EventListener"]] = None, anonymous_connect_policy: str = "deny", + web_socket_keep_alive_interval_in_seconds: int = 20, **kwargs: Any ) -> None: """ @@ -2644,11 +2658,16 @@ def __init__( :keyword anonymous_connect_policy: The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". :paramtype anonymous_connect_policy: str + :keyword web_socket_keep_alive_interval_in_seconds: The settings for configuring the WebSocket + ping-pong interval in seconds for all clients in the hub. Valid range: 1 to 120. Default to 20 + seconds. + :paramtype web_socket_keep_alive_interval_in_seconds: int """ super().__init__(**kwargs) self.event_handlers = event_handlers self.event_listeners = event_listeners self.anonymous_connect_policy = anonymous_connect_policy + self.web_socket_keep_alive_interval_in_seconds = web_socket_keep_alive_interval_in_seconds class WebPubSubKeys(_serialization.Model): @@ -2828,10 +2847,12 @@ class WebPubSubResource(TrackedResource): # pylint: disable=too-many-instance-a This property is replica specific. Disable the regional endpoint without replica is not allowed. :vartype region_endpoint_enabled: str - :ivar resource_stopped: Stop or start the resource. Default to "false". + :ivar resource_stopped: Stop or start the resource. Default to "False". When it's true, the data plane of the resource is shutdown. When it's false, the data plane of the resource is started. :vartype resource_stopped: str + :ivar socket_io: SocketIO settings for the resource. + :vartype socket_io: ~azure.mgmt.webpubsub.models.WebPubSubSocketIOSettings """ _validation = { @@ -2888,6 +2909,7 @@ class WebPubSubResource(TrackedResource): # pylint: disable=too-many-instance-a "disable_aad_auth": {"key": "properties.disableAadAuth", "type": "bool"}, "region_endpoint_enabled": {"key": "properties.regionEndpointEnabled", "type": "str"}, "resource_stopped": {"key": "properties.resourceStopped", "type": "str"}, + "socket_io": {"key": "properties.socketIO", "type": "WebPubSubSocketIOSettings"}, } def __init__( # pylint: disable=too-many-locals @@ -2907,6 +2929,7 @@ def __init__( # pylint: disable=too-many-locals disable_aad_auth: bool = False, region_endpoint_enabled: str = "Enabled", resource_stopped: str = "false", + socket_io: Optional["_models.WebPubSubSocketIOSettings"] = None, **kwargs: Any ) -> None: """ @@ -2950,10 +2973,12 @@ def __init__( # pylint: disable=too-many-locals This property is replica specific. Disable the regional endpoint without replica is not allowed. :paramtype region_endpoint_enabled: str - :keyword resource_stopped: Stop or start the resource. Default to "false". + :keyword resource_stopped: Stop or start the resource. Default to "False". When it's true, the data plane of the resource is shutdown. When it's false, the data plane of the resource is started. :paramtype resource_stopped: str + :keyword socket_io: SocketIO settings for the resource. + :paramtype socket_io: ~azure.mgmt.webpubsub.models.WebPubSubSocketIOSettings """ super().__init__(tags=tags, location=location, **kwargs) self.sku = sku @@ -2977,6 +3002,7 @@ def __init__( # pylint: disable=too-many-locals self.disable_aad_auth = disable_aad_auth self.region_endpoint_enabled = region_endpoint_enabled self.resource_stopped = resource_stopped + self.socket_io = socket_io class WebPubSubResourceList(_serialization.Model): @@ -3014,6 +3040,30 @@ def __init__( self.next_link = next_link +class WebPubSubSocketIOSettings(_serialization.Model): + """SocketIO settings for the resource. + + :ivar service_mode: The service mode of Web PubSub for Socket.IO. Values allowed: + "Default": have your own backend Socket.IO server + "Serverless": your application doesn't have a backend server. + :vartype service_mode: str + """ + + _attribute_map = { + "service_mode": {"key": "serviceMode", "type": "str"}, + } + + def __init__(self, *, service_mode: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword service_mode: The service mode of Web PubSub for Socket.IO. Values allowed: + "Default": have your own backend Socket.IO server + "Serverless": your application doesn't have a backend server. + :paramtype service_mode: str + """ + super().__init__(**kwargs) + self.service_mode = service_mode + + class WebPubSubTlsSettings(_serialization.Model): """TLS settings for the resource. diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py index c10ad6661320..49f4676fbe9d 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/__init__.py @@ -15,6 +15,7 @@ from ._web_pub_sub_private_endpoint_connections_operations import WebPubSubPrivateEndpointConnectionsOperations from ._web_pub_sub_private_link_resources_operations import WebPubSubPrivateLinkResourcesOperations from ._web_pub_sub_replicas_operations import WebPubSubReplicasOperations +from ._web_pub_sub_replica_operations import WebPubSubReplicaOperations from ._web_pub_sub_shared_private_link_resources_operations import WebPubSubSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -31,6 +32,7 @@ "WebPubSubPrivateEndpointConnectionsOperations", "WebPubSubPrivateLinkResourcesOperations", "WebPubSubReplicasOperations", + "WebPubSubReplicaOperations", "WebPubSubSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py index 31d0896e6e36..1d9ceb92e6bc 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_operations.py @@ -40,7 +40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py index 396eeca7395e..c64b9634a828 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_usages_operations.py @@ -40,7 +40,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_certificates_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_certificates_operations.py index f27a4f6a3e9c..b6bcb73e000b 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_certificates_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_certificates_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_domains_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_domains_operations.py index fb3e4a744315..336148de858e 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_domains_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_custom_domains_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py index c7d68cd1a0ad..a2423e928db6 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_hubs_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +126,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py index 54c7a4a1889f..54c93a5753df 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_operations.py @@ -43,7 +43,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74,7 +74,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +128,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -294,7 +294,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -334,7 +334,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) 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_list_replica_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -425,7 +425,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -465,7 +465,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py index 03c4bfd70e8e..6d89308d42a0 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_endpoint_connections_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py index 3b0c88873680..bb62597e5f75 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_private_link_resources_operations.py @@ -42,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replica_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replica_operations.py new file mode 100644 index 000000000000..5abb18297c91 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replica_operations.py @@ -0,0 +1,650 @@ +# 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 io import IOBase +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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_shared_private_link_resources_list_request( + resource_group_name: str, resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_shared_private_link_resources_get_request( + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # 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 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**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_shared_private_link_resources_create_or_update_request( + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-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.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # 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 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**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) + + +class WebPubSubReplicaOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.webpubsub.WebPubSubManagementClient`'s + :attr:`web_pub_sub_replica` 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 shared_private_link_resources_list( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> Iterable["_models.SharedPrivateLinkResource"]: + """List shared private link resources. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :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: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResourceList] = 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_shared_private_link_resources_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_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("SharedPrivateLinkResourceList", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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) + + shared_private_link_resources_list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + } + + @distributed_trace + def shared_private_link_resources_get( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Get the specified shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :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.webpubsub.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.shared_private_link_resources_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + shared_private_link_resources_get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + def _shared_private_link_resources_create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> _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: str = kwargs.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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SharedPrivateLinkResource") + + request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._shared_private_link_resources_create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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("SharedPrivateLinkResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _shared_private_link_resources_create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + 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.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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.webpubsub.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_shared_private_link_resources_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + shared_private_link_resource_name: str, + parameters: Union[_models.SharedPrivateLinkResource, IO], + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Create or update a shared private link resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param shared_private_link_resource_name: The name of the shared private link resource. + Required. + :type shared_private_link_resource_name: str + :param parameters: The shared private link resource. Is either a SharedPrivateLinkResource type + or a IO type. Required. + :type parameters: ~azure.mgmt.webpubsub.models.SharedPrivateLinkResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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.webpubsub.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: str = kwargs.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._shared_private_link_resources_create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + shared_private_link_resource_name=shared_private_link_resource_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("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_shared_private_link_resources_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replicas_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replicas_operations.py index b45517fcd382..23e469ef9d33 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replicas_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_replicas_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +133,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +184,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +232,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -283,7 +283,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py index 3390e15412b4..1a6457412617 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_operations.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/operations/_web_pub_sub_shared_private_link_resources_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -186,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/operations_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/operations_list.py index b8435c0ce9d6..48eb120137ec 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/operations_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/usages_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/usages_list.py index 0fbda4cee82d..4d0dfa52a6b3 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/usages_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/usages_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_check_name_availability.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_check_name_availability.py index d9944d005f74..05d868bffce6 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_check_name_availability.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CheckNameAvailability.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_create_or_update.py index f91e7662e810..582001084ba8 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_create_or_update.py @@ -54,6 +54,7 @@ def main(): "publicNetwork": {"allow": ["ClientConnection"]}, }, "publicNetworkAccess": "Enabled", + "socketIO": {"serviceMode": "Serverless"}, "tls": {"clientCertEnabled": False}, }, "sku": {"capacity": 1, "name": "Premium_P1", "tier": "Premium"}, @@ -63,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_create_or_update.py index a8cdb6259f79..5c683b80498a 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_delete.py index 3ce063f92074..879640382551 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomCertificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_get.py index 06e07815a8a9..a516a213edee 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomCertificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_list.py index 530828bd8abc..46feb89095a3 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_certificates_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomCertificates_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_create_or_update.py index 4912d29a2480..e6ced8ea1042 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_delete.py index 518200882184..6d4b31c1b976 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomDomains_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_get.py index d2ada3391721..e26af673d951 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomDomains_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_list.py index 28923e36a339..fa97085570fe 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_custom_domains_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubCustomDomains_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_delete.py index 3661af5f2dc8..c299e5f627d1 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_delete.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_get.py index 295665c79f03..0aab48099b8b 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_create_or_update.py index e91558ff9686..e89a6161ed94 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_create_or_update.py @@ -58,12 +58,13 @@ def main(): }, } ], + "webSocketKeepAliveIntervalInSeconds": 50, } }, ).result() print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_delete.py index ff7576c3f0fa..a02a7bc2543d 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubHubs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_get.py index de40d7710752..7d8d2b4a559e 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubHubs_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_list.py index a732c629becf..0e07337d0515 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_hubs_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubHubs_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_resource_group.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_resource_group.py index 72cdf125df74..d74663989efb 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_resource_group.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListByResourceGroup.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_subscription.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_subscription.py index d1a95aff1d3f..2da376e26bf2 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_subscription.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListBySubscription.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_keys.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_keys.py index 13b17bbe4bdb..83f421ae7d19 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_keys.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListKeys.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_replica_skus.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_replica_skus.py index bfec306d000d..f7b78a7a4dea 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_replica_skus.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_replica_skus.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListReplicaSkus.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_ListReplicaSkus.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_skus.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_skus.py index cca51c6ae082..2f3ca7412796 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_skus.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_list_skus.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListSkus.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_delete.py index 7ba4af7e9ee7..4cd5c79bf141 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_get.py index f65775ee9898..05408168a6ab 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_list.py index 395c2e1559ee..f0bdea3d78b0 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_update.py index 124515152249..0980d089cf05 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_endpoint_connections_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_link_resources_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_link_resources_list.py index afc293bf96b3..16342e2b4209 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_link_resources_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_private_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateLinkResources_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_regenerate_key.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_regenerate_key.py index 549bd30ab6bc..9ae83f3b4c87 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_regenerate_key.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_RegenerateKey.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_create_or_update.py new file mode 100644 index 000000000000..8f62b138e375 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_create_or_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.webpubsub import WebPubSubManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-webpubsub +# USAGE + python web_pub_sub_replica_shared_private_link_resources_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 = WebPubSubManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.web_pub_sub_replica.begin_shared_private_link_resources_create_or_update( + resource_group_name="myResourceGroup", + resource_name="myWebPubSubService", + replica_name="myWebPubSubService-eastus", + shared_private_link_resource_name="upstream", + parameters={ + "properties": { + "groupId": "sites", + "privateLinkResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp", + "requestMessage": "Please approve", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplica_SharedPrivateLinkResources_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_get.py new file mode 100644 index 000000000000..355b537d4acb --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_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.webpubsub import WebPubSubManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-webpubsub +# USAGE + python web_pub_sub_replica_shared_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 = WebPubSubManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.web_pub_sub_replica.shared_private_link_resources_get( + resource_group_name="myResourceGroup", + resource_name="myWebPubSubService", + replica_name="myWebPubSubService-eastus", + shared_private_link_resource_name="upstream", + ) + print(response) + + +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplica_SharedPrivateLinkResources_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_list.py new file mode 100644 index 000000000000..c5fc62dd8bc9 --- /dev/null +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replica_shared_private_link_resources_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.webpubsub import WebPubSubManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-webpubsub +# USAGE + python web_pub_sub_replica_shared_private_link_resources_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 = WebPubSubManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.web_pub_sub_replica.shared_private_link_resources_list( + resource_group_name="myResourceGroup", + resource_name="myWebPubSubService", + replica_name="myWebPubSubService-eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplica_SharedPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_create_or_update.py index 047fe92da5e4..90145ca3f456 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_create_or_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_delete.py index 38623a3df4ae..15d6384e670a 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_get.py index 1bb4a0503341..19255eefeac3 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_list.py index 1d6b2ab1e4f1..b82a05ffddaa 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_restart.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_restart.py index ac02bd49306d..e55e861b9cb3 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_restart.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_restart.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Restart.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_Restart.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_update.py index 26f70f78ef30..494a43b13d20 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_replicas_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubReplicas_Update.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubReplicas_Update.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_restart.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_restart.py index edbc3b816a89..65a0a0ff0ec2 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_restart.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_restart.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Restart.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_Restart.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_create_or_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_create_or_update.py index e58c1c9a9b9b..3ee6f2b2612d 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_create_or_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_delete.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_delete.py index fd475cb21236..d7a025382591 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_delete.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_get.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_get.py index 1a295757c024..1d1d2e99e2ef 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_get.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_list.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_list.py index 6fbfa1162c89..95d90ea9c134 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_list.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_shared_private_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_update.py b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_update.py index 3639d27eafd2..533feed488c5 100644 --- a/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_update.py +++ b/sdk/webpubsub/azure-mgmt-webpubsub/generated_samples/web_pub_sub_update.py @@ -54,6 +54,7 @@ def main(): "publicNetwork": {"allow": ["ClientConnection"]}, }, "publicNetworkAccess": "Enabled", + "socketIO": {"serviceMode": "Serverless"}, "tls": {"clientCertEnabled": False}, }, "sku": {"capacity": 1, "name": "Premium_P1", "tier": "Premium"}, @@ -63,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Update.json +# x-ms-original-file: specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2024-01-01-preview/examples/WebPubSub_Update.json if __name__ == "__main__": main()