From 29a1e09ec4cf283a30e6779d7d0fb434b71914c0 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Mon, 23 Aug 2021 11:53:37 -0700 Subject: [PATCH 01/16] Consistency related changes (#20385) * time stamp * Rename AggragationType to MetricAggregationType * Metric Class * logs batch result * MetricNamespaceClassification * LogsTable + LogsTableColumn * lint * more lint --- sdk/monitor/azure-monitor-query/CHANGELOG.md | 8 ++ sdk/monitor/azure-monitor-query/README.md | 8 +- .../azure/monitor/query/__init__.py | 18 ++-- .../monitor/query/_metrics_query_client.py | 6 +- .../azure/monitor/query/_models.py | 89 ++++++++++--------- .../query/aio/_metrics_query_client_async.py | 6 +- .../sample_log_query_client_async.py | 2 +- .../sample_log_query_client_without_pandas.py | 2 +- .../samples/sample_metrics_query_client.py | 4 +- .../tests/async/test_metrics_client_async.py | 6 +- .../tests/perfstress_tests/metric_query.py | 4 +- .../tests/test_metrics_client.py | 6 +- 12 files changed, 86 insertions(+), 73 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md index c5cbf831efbe..ea4ae667b247 100644 --- a/sdk/monitor/azure-monitor-query/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md @@ -5,6 +5,9 @@ ### Features Added - Added additional `display_description` attribute to the `Metric` type. +- Added a `MetricClass` enum to provide the class of a metric. +- Added a `metric_class` attribute to the `MetricDefinition` type. +- Added a `MetricNamespaceClassification` enum to support the `namespace_classification` attribute on `MetricNamespace` type. ### Breaking Changes @@ -22,6 +25,11 @@ - `LogsQueryResult` now returns `datetime` objects for a time values. - `LogsBatchQuery` doesn't accept a `request_id` anymore. - `MetricsMetadataValues` is removed. A dictionary is used instead. +- `time_stamp` is renamed to `timestamp` in `MetricValue` type. +- `AggregationType` is renamed to `MetricAggregationType`. +- Removed `LogsBatchResultError` type. +- `LogsQueryResultTable` is named to `LogsTable` +- `LogsQueryResultColumn` is renamed to `LogsTableColumn` ### Bugs Fixed diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index a87aa1ae263d..8d3d209f4c24 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -226,10 +226,10 @@ LogsQueryResult / LogsBatchQueryResult |---statistics |---visualization |---error -|---tables (list of `LogsQueryResultTable` objects) +|---tables (list of `LogsTable` objects) |---name |---rows - |---columns (list of `LogsQueryResultColumn` objects) + |---columns (list of `LogsTableColumn` objects) |---name |---type ``` @@ -313,7 +313,7 @@ MetricsResult ```python import os from datetime import datetime, timedelta -from azure.monitor.query import MetricsQueryClient, AggregationType +from azure.monitor.query import MetricsQueryClient, MetricAggregationType from azure.identity import DefaultAzureCredential credential = DefaultAzureCredential() @@ -323,7 +323,7 @@ metrics_uri = os.environ['METRICS_RESOURCE_URI'] response = client.query( metrics_uri, metric_names=["MatchedEventCount"], - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) for metric in response.metrics: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py index 13d5a58a442f..386aec140be1 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py @@ -8,40 +8,42 @@ from ._metrics_query_client import MetricsQueryClient from ._models import ( - AggregationType, + MetricAggregationType, LogsBatchQueryResult, LogsQueryResult, - LogsQueryResultTable, - LogsQueryResultColumn, + LogsTable, + LogsTableColumn, MetricsResult, - LogsBatchResultError, LogsBatchQuery, MetricNamespace, + MetricNamespaceClassification, MetricDefinition, TimeSeriesElement, Metric, MetricValue, + MetricClass, MetricAvailability ) from ._version import VERSION __all__ = [ - "AggregationType", + "MetricAggregationType", "LogsQueryClient", "LogsBatchQueryResult", - "LogsBatchResultError", "LogsQueryResult", - "LogsQueryResultColumn", - "LogsQueryResultTable", + "LogsTableColumn", + "LogsTable", "LogsBatchQuery", "MetricsQueryClient", "MetricNamespace", + "MetricNamespaceClassification", "MetricDefinition", "MetricsResult", "TimeSeriesElement", "Metric", "MetricValue", + "MetricClass", "MetricAvailability" ] 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 cc3d69571b4b..aae99348a479 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 @@ -72,8 +72,8 @@ def query(self, resource_uri, metric_names, **kwargs): or tuple[~datetime.datetime, ~datetime.datetime] :keyword granularity: The granularity (i.e. timegrain) of the query. :paramtype granularity: ~datetime.timedelta - :keyword aggregations: The list of aggregation types to retrieve. Use `azure.monitor.query.AggregationType` - enum to get each aggregation type. + :keyword aggregations: The list of aggregation types to retrieve. Use + `azure.monitor.query.MetricAggregationType` enum to get each aggregation type. :paramtype aggregations: list[str] :keyword max_results: The maximum number of records to retrieve. Valid only if $filter is specified. @@ -134,7 +134,7 @@ def list_metric_namespaces(self, resource_uri, **kwargs): :keyword start_time: The ISO 8601 conform Date start time from which to query for metric namespaces. :paramtype start_time: str - :return: An iterator like instance of either MetricNamespaceCollection or the result of cls(response) + :return: An iterator like instance of either MetricNamespace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricNamespace] :raises: ~azure.core.exceptions.HttpResponseError """ diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py index 49264f9ac651..2b3a33672ec6 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py @@ -16,7 +16,7 @@ ) -class LogsQueryResultTable(object): +class LogsTable(object): """Contains the columns and rows for one table in a query response. All required parameters must be populated in order to send to Azure. @@ -24,12 +24,12 @@ class LogsQueryResultTable(object): :param name: Required. The name of the table. :type name: str :param columns: Required. The list of columns in this table. - :type columns: list[~azure.monitor.query.LogsQueryResultColumn] + :type columns: list[~azure.monitor.query.LogsTableColumn] :param rows: Required. The resulting rows from this query. :type rows: list[list[str]] """ def __init__(self, name, columns, rows): - # type: (str, List[LogsQueryResultColumn], List[List[str]]) -> None + # type: (str, List[LogsTableColumn], List[List[str]]) -> None self.name = name self.columns = columns self.rows = [process_row(self.columns, row) for row in rows] @@ -38,12 +38,12 @@ def __init__(self, name, columns, rows): def _from_generated(cls, generated): return cls( name=generated.name, - columns=[LogsQueryResultColumn(name=col.name, type=col.type) for col in generated.columns], + columns=[LogsTableColumn(name=col.name, type=col.type) for col in generated.columns], rows=generated.rows ) -class LogsQueryResultColumn(InternalColumn): +class LogsTableColumn(InternalColumn): """A column in a table. :ivar name: The name of this column. @@ -59,7 +59,7 @@ class LogsQueryResultColumn(InternalColumn): def __init__(self, **kwargs): # type: (Any) -> None - super(LogsQueryResultColumn, self).__init__(**kwargs) + super(LogsTableColumn, self).__init__(**kwargs) self.name = kwargs.get("name", None) self.type = kwargs.get("type", None) @@ -68,7 +68,7 @@ class LogsQueryResult(object): """Contains the tables, columns & rows resulting from a query. :ivar tables: The list of tables, columns and rows. - :vartype tables: list[~azure.monitor.query.LogsQueryResultTable] + :vartype tables: list[~azure.monitor.query.LogsTable] :ivar statistics: This will include a statistics property in the response that describes various performance statistics such as query execution time and resource usage. :vartype statistics: object @@ -92,7 +92,7 @@ def _from_generated(cls, generated): tables = None if generated.tables is not None: tables = [ - LogsQueryResultTable._from_generated( # pylint: disable=protected-access + LogsTable._from_generated( # pylint: disable=protected-access table ) for table in generated.tables ] @@ -222,7 +222,7 @@ class LogsBatchQueryResult(object): :ivar status: status code of the response. :vartype status: int :ivar tables: The list of tables, columns and rows. - :vartype tables: list[~azure.monitor.query.LogsQueryResultTable] + :vartype tables: list[~azure.monitor.query.LogsTable] :ivar statistics: This will include a statistics property in the response that describes various performance statistics such as query execution time and resource usage. :vartype statistics: object @@ -250,7 +250,7 @@ def _from_generated(cls, generated): tables = None if generated.body.tables is not None: tables = [ - LogsQueryResultTable._from_generated( # pylint: disable=protected-access + LogsTable._from_generated( # pylint: disable=protected-access table ) for table in generated.body.tables ] @@ -264,31 +264,13 @@ def _from_generated(cls, generated): ) -class LogsBatchResultError(object): - """Error response for a batch request. - - :ivar message: The error message describing the cause of the error. - :vartype message: str - :param code: The error code. - :vartype code: str - :param details: The details of the error. - :vartype inner_error: list[~azure.monitor.query.ErrorDetails] +class MetricNamespaceClassification(str, Enum): + """Kind of namespace """ - def __init__(self, **kwargs): - # type: (Any) -> None - self.message = kwargs.get("message", None) - self.code = kwargs.get("code", None) - self.details = kwargs.get("details", None) - @classmethod - def _from_generated(cls, generated): - if not generated: - return cls() - return cls( - message=generated.inner_error.message, - code=generated.code, - details=generated.inner_error.details - ) + PLATFORM = "Platform" + CUSTOM = "Custom" + QOS = "Qos" class MetricNamespace(object): @@ -302,6 +284,8 @@ class MetricNamespace(object): :paramtype name: str :keyword fully_qualified_namespace: The fully qualified namespace name. :paramtype fully_qualified_namespace: str + :keyword namespace_classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :paramtype namespace_classification: str or ~azure.monitor.query.MetricNamespaceClassification """ def __init__( self, @@ -311,6 +295,7 @@ def __init__( self.type = kwargs.get('type', None) self.name = kwargs.get('name', None) self.fully_qualified_namespace = kwargs.get('fully_qualified_namespace', None) + self.namespace_classification = kwargs.get('namespace_classification', None) @classmethod def _from_generated(cls, generated): @@ -323,10 +308,23 @@ def _from_generated(cls, generated): id=generated.id, type=generated.type, name=generated.name, - fully_qualified_namespace=fully_qualified_namespace + fully_qualified_namespace=fully_qualified_namespace, + namespace_classification=generated.classification ) -class MetricDefinition(object): + +class MetricClass(str, Enum): + """The class of the metric. + """ + + AVAILABILITY = "Availability" + TRANSACTIONS = "Transactions" + ERRORS = "Errors" + LATENCY = "Latency" + SATURATION = "Saturation" + + +class MetricDefinition(object): #pylint: disable=too-many-instance-attributes """Metric definition class specifies the metadata for a metric. :keyword dimension_required: Flag to indicate whether the dimension is required. @@ -344,12 +342,15 @@ class MetricDefinition(object): :keyword primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :paramtype primary_aggregation_type: str or ~monitor_query_client.models.AggregationType + :paramtype primary_aggregation_type: str or ~azure.monitor.query.MetricAggregationType + :keyword metric_class: The class of the metric. Possible values include: "Availability", + "Transactions", "Errors", "Latency", "Saturation". + :paramtype metric_class: str or ~azure.monitor.query.MetricClass :keyword supported_aggregation_types: the collection of what aggregation types are supported. - :paramtype supported_aggregation_types: list[str or ~monitor_query_client.models.AggregationType] + :paramtype supported_aggregation_types: list[str or ~azure.monitor.query.MetricAggregationType] :keyword metric_availabilities: the collection of what aggregation intervals are available to be queried. - :paramtype metric_availabilities: list[~monitor_query_client.models.MetricAvailability] + :paramtype metric_availabilities: list[~azure.monitor.query.MetricAvailability] :keyword id: the resource identifier of the metric definition. :paramtype id: str :keyword dimensions: the name and the display name of the dimension, i.e. it is a localizable @@ -371,6 +372,7 @@ def __init__( self.metric_availabilities = kwargs.get('metric_availabilities', None) # type: List[MetricAvailability] self.id = kwargs.get('id', None) # type: Optional[str] self.dimensions = kwargs.get('dimensions', None) # type: Optional[List[str]] + self.metric_class = kwargs.get('metric_class', None) # type: Optional[str] @classmethod def _from_generated(cls, generated): @@ -387,6 +389,7 @@ def _from_generated(cls, generated): unit=generated.unit, primary_aggregation_type=generated.primary_aggregation_type, supported_aggregation_types=generated.supported_aggregation_types, + metric_class=generated.metric_class, metric_availabilities=[ MetricAvailability._from_generated( # pylint: disable=protected-access val @@ -401,8 +404,8 @@ class MetricValue(object): All required parameters must be populated in order to send to Azure. - :ivar time_stamp: Required. The timestamp for the metric value in ISO 8601 format. - :vartype time_stamp: ~datetime.datetime + :ivar timestamp: Required. The timestamp for the metric value in ISO 8601 format. + :vartype timestamp: ~datetime.datetime :ivar average: The average value in the time range. :vartype average: float :ivar minimum: The least value in the time range. @@ -420,7 +423,7 @@ def __init__( **kwargs ): # type: (Any) -> None - self.time_stamp = kwargs['time_stamp'] + self.timestamp = kwargs['timestamp'] self.average = kwargs.get('average', None) self.minimum = kwargs.get('minimum', None) self.maximum = kwargs.get('maximum', None) @@ -432,7 +435,7 @@ def _from_generated(cls, generated): if not generated: return cls() return cls( - time_stamp=generated.time_stamp, + timestamp=generated.time_stamp, average=generated.average, minimum=generated.minimum, maximum=generated.maximum, @@ -552,7 +555,7 @@ def _from_generated(cls, generated): ) -class AggregationType(str, Enum): +class MetricAggregationType(str, Enum): """The aggregation type of the metric. """ 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 ed307d6e6fc7..dfdc2906f38b 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 @@ -67,8 +67,8 @@ async def query( or tuple[~datetime.datetime, ~datetime.datetime] :keyword granularity: The interval (i.e. timegrain) of the query. :paramtype granularity: ~datetime.timedelta - :keyword aggregations: The list of aggregation types to retrieve. Use `azure.monitor.query.AggregationType` - enum to get each aggregation type. + :keyword aggregations: The list of aggregation types to retrieve. + Use `azure.monitor.query.MetricAggregationType` enum to get each aggregation type. :paramtype aggregations: list[str] :keyword max_results: The maximum number of records to retrieve. Valid only if $filter is specified. @@ -118,7 +118,7 @@ def list_metric_namespaces(self, resource_uri: str, **kwargs: Any) -> AsyncItemP :keyword start_time: The ISO 8601 conform Date start time from which to query for metric namespaces. :paramtype start_time: str - :return: An iterator like instance of either MetricNamespaceCollection or the result of cls(response) + :return: An iterator like instance of either MetricNamespace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricNamespace] :raises: ~azure.core.exceptions.HttpResponseError """ diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py index 4aebbde5e27f..15aa900e6a26 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py @@ -42,7 +42,7 @@ async def logs_query(): # if you dont want to use pandas - here's how you can process it. - #response.tables is a LogsQueryResultTable + #response.tables is a LogsTable for table in response.tables: for col in table.columns: #LogsQueryResultColumn print(col.name + "/"+ col.type + " | ", end="") diff --git a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py index f6a1bff2517d..da3aa5dd0cab 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py @@ -22,7 +22,7 @@ if not response.tables: print("No results for the query") -#response.tables is a LogsQueryResultTable +#response.tables is a LogsTable for table in response.tables: for col in table.columns: #LogsQueryResultColumn print(col.name + "/"+ col.type + " | ", end="") diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py index 15c6dcbdf157..224d7f05e8ea 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py @@ -4,7 +4,7 @@ import os from datetime import datetime, timedelta import urllib3 -from azure.monitor.query import MetricsQueryClient, AggregationType +from azure.monitor.query import MetricsQueryClient, MetricAggregationType from azure.identity import DefaultAzureCredential urllib3.disable_warnings() @@ -21,7 +21,7 @@ metrics_uri, metric_names=["MatchedEventCount", "DeliverySuccesssCount"], timespan=timedelta(days=1), - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) for metric in response.metrics: diff --git a/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py b/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py index ab796d7d0924..e205e67734e2 100644 --- a/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py @@ -2,7 +2,7 @@ import pytest import os from azure.identity.aio import ClientSecretCredential -from azure.monitor.query import AggregationType +from azure.monitor.query import MetricAggregationType from azure.monitor.query.aio import MetricsQueryClient def _credential(): @@ -22,7 +22,7 @@ async def test_metrics_auth(): os.environ['METRICS_RESOURCE_URI'], metric_names=["MatchedEventCount"], timespan=timedelta(days=1), - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) assert response assert response.metrics @@ -37,7 +37,7 @@ async def test_metrics_granularity(): metric_names=["MatchedEventCount"], timespan=timedelta(days=1), granularity=timedelta(minutes=5), - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) assert response assert response.granularity == timedelta(minutes=5) diff --git a/sdk/monitor/azure-monitor-query/tests/perfstress_tests/metric_query.py b/sdk/monitor/azure-monitor-query/tests/perfstress_tests/metric_query.py index 11995ed8812c..f91e2c9a3b23 100644 --- a/sdk/monitor/azure-monitor-query/tests/perfstress_tests/metric_query.py +++ b/sdk/monitor/azure-monitor-query/tests/perfstress_tests/metric_query.py @@ -8,7 +8,7 @@ from datetime import datetime, timezone from azure_devtools.perfstress_tests import PerfStressTest -from azure.monitor.query import MetricsQueryClient as SyncMetricsQueryClient, AggregationType +from azure.monitor.query import MetricsQueryClient as SyncMetricsQueryClient, MetricAggregationType from azure.monitor.query.aio import MetricsQueryClient as AsyncMetricsQueryClient from azure.identity import DefaultAzureCredential as SyncDefaultAzureCredential @@ -21,7 +21,7 @@ def __init__(self, arguments): # auth configuration self.metrics_uri = self.get_from_env('METRICS_RESOURCE_URI') self.names = ["MatchedEventCount"] - self.aggregations = [AggregationType.COUNT] + self.aggregations = [MetricAggregationType.COUNT] # Create clients self.metrics_client = SyncMetricsQueryClient( diff --git a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py index 082da65c4385..ecdb7e7c8a3a 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py @@ -2,7 +2,7 @@ import os from datetime import datetime, timedelta from azure.identity import ClientSecretCredential -from azure.monitor.query import MetricsQueryClient, AggregationType +from azure.monitor.query import MetricsQueryClient, MetricAggregationType def _credential(): credential = ClientSecretCredential( @@ -20,7 +20,7 @@ def test_metrics_auth(): os.environ['METRICS_RESOURCE_URI'], metric_names=["MatchedEventCount"], timespan=timedelta(days=1), - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) assert response assert response.metrics @@ -34,7 +34,7 @@ def test_metrics_granularity(): metric_names=["MatchedEventCount"], timespan=timedelta(days=1), granularity=timedelta(minutes=5), - aggregations=[AggregationType.COUNT] + aggregations=[MetricAggregationType.COUNT] ) assert response assert response.granularity == timedelta(minutes=5) From 37084adcef9377ba9b9ed70174bf90b5d30b5bda Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 23 Aug 2021 16:04:05 -0700 Subject: [PATCH 02/16] Add Cloud Configuration section to Identity readme (#20373) --- sdk/identity/azure-identity/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index 2cf65d4a99bb..0f3c12139e16 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -220,6 +220,22 @@ default_credential = DefaultAzureCredential() client = SecretClient("https://my-vault.vault.azure.net", default_credential) ``` +## Cloud Configuration +Credentials default to authenticating to the Azure Active Directory endpoint for +Azure Public Cloud. To access resources in other clouds, such as Azure Government +or a private cloud, configure credentials with the `authority` argument. +[AzureAuthorityHosts](https://aka.ms/azsdk/python/identity/docs#azure.identity.AzureAuthorityHosts) +defines authorities for well-known clouds: +```py +from azure.identity import AzureAuthorityHosts + +DefaultAzureCredential(authority=AzureAuthorityHosts.AZURE_GOVERNMENT) +``` +Not all credentials require this configuration. Credentials which authenticate +through a development tool, such as `AzureCliCredential`, use that tool's +configuration. Similarly, `VisualStudioCodeCredential` accepts an `authority` +argument but defaults to the authority matching VS Code's "Azure: Cloud" setting. + ## Credential Classes ### Authenticating Azure Hosted Applications From 7e7f55233be72e999ffee255697665921df14f76 Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:37:02 -0700 Subject: [PATCH 03/16] keyvault and storage have a conflict between mindependency and what local azure-identity requires. resolve it (#20391) --- sdk/keyvault/azure-keyvault-keys/dev_requirements.txt | 2 +- sdk/storage/azure-storage-blob/dev_requirements.txt | 2 +- sdk/storage/azure-storage-file-share/dev_requirements.txt | 2 +- sdk/storage/azure-storage-queue/dev_requirements.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-keys/dev_requirements.txt b/sdk/keyvault/azure-keyvault-keys/dev_requirements.txt index 5154b1d523b3..e2d675cd6101 100644 --- a/sdk/keyvault/azure-keyvault-keys/dev_requirements.txt +++ b/sdk/keyvault/azure-keyvault-keys/dev_requirements.txt @@ -1,8 +1,8 @@ -e ../../../tools/azure-devtools ../../core/azure-core --e ../../identity/azure-identity -e ../azure-mgmt-keyvault -e ../../../tools/azure-sdk-tools ../../nspkg/azure-keyvault-nspkg aiohttp>=3.0; python_version >= '3.5' +azure-identity parameterized>=0.7.3 \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/dev_requirements.txt b/sdk/storage/azure-storage-blob/dev_requirements.txt index 2bd2c64d8f4a..ea061dc8f943 100644 --- a/sdk/storage/azure-storage-blob/dev_requirements.txt +++ b/sdk/storage/azure-storage-blob/dev_requirements.txt @@ -2,6 +2,6 @@ -e ../../../tools/azure-devtools -e ../../../tools/azure-sdk-tools ../../core/azure-core --e ../../identity/azure-identity +azure-identity -e ../../storage/azure-mgmt-storage aiohttp>=3.0; python_version >= '3.5' diff --git a/sdk/storage/azure-storage-file-share/dev_requirements.txt b/sdk/storage/azure-storage-file-share/dev_requirements.txt index 65ac0fb23796..b560dfb066cc 100644 --- a/sdk/storage/azure-storage-file-share/dev_requirements.txt +++ b/sdk/storage/azure-storage-file-share/dev_requirements.txt @@ -2,6 +2,6 @@ -e ../../../tools/azure-devtools -e ../../../tools/azure-sdk-tools ../../core/azure-core --e ../../identity/azure-identity +azure-identity -e ../azure-storage-blob aiohttp>=3.0; python_version >= '3.5' diff --git a/sdk/storage/azure-storage-queue/dev_requirements.txt b/sdk/storage/azure-storage-queue/dev_requirements.txt index bcfe678ce19e..bc7fcbede036 100644 --- a/sdk/storage/azure-storage-queue/dev_requirements.txt +++ b/sdk/storage/azure-storage-queue/dev_requirements.txt @@ -2,5 +2,5 @@ -e ../../../tools/azure-devtools -e ../../../tools/azure-sdk-tools ../../core/azure-core --e ../../identity/azure-identity +azure-identity aiohttp>=3.0; python_version >= '3.5' From fd3d26dac409a9cba7ec11824c27a35f43dac042 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Tue, 24 Aug 2021 10:14:10 +0800 Subject: [PATCH 04/16] [AutoRelease] t2-costmanagement-2021-07-27-84467 (#19949) * CodeGen from PR 15291 in Azure/azure-rest-api-specs Updating Query filter description (#15291) Co-authored-by: Jorge Chavez Nieto * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: Jorge Chavez Nieto Co-authored-by: PythonSdkPipelines --- .../azure-mgmt-costmanagement/CHANGELOG.md | 7 +++++++ .../azure-mgmt-costmanagement/_meta.json | 8 ++++---- .../azure/mgmt/costmanagement/_version.py | 2 +- .../models/_cost_management_client_enums.py | 3 +++ .../mgmt/costmanagement/models/_models.py | 20 +++++++++++-------- .../mgmt/costmanagement/models/_models_py3.py | 20 +++++++++++-------- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md index 7e2d43aea3f4..ab098a2f2c20 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 3.0.0 (2021-07-27) + +**Breaking changes** + + - Parameter dataset of model QueryDefinition is now required + - Parameter dataset of model ForecastDefinition is now required + ## 2.0.0 (2021-06-08) **Features** diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json index 03051a9b4540..8041e01d515b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.4.5", "use": [ - "@autorest/python@5.8.0", + "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "67528b3e539b96ccaaf82c360f5715184e467e21", + "commit": "74efe54fbc55c91a1d9213afbb2723747acfddf9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/cost-management/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index 48944bf3938a..cac9f5d10f8b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "3.0.0" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index 16087446457c..eac0fd7748ff 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -185,6 +185,9 @@ class FunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The name of the aggregation function to use. """ + AVG = "Avg" + MAX = "Max" + MIN = "Min" SUM = "Sum" class GranularityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py index 2c2ba531e35b..ffd3292fd2df 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py @@ -1012,7 +1012,7 @@ class ForecastDefinition(msrest.serialization.Model): :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType :param time_period: Has time period for pulling data for the forecast. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param dataset: Has definition for data in this forecast. + :param dataset: Required. Has definition for data in this forecast. :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset :param include_actual_cost: a boolean determining if actualCost will be included. :type include_actual_cost: bool @@ -1023,6 +1023,7 @@ class ForecastDefinition(msrest.serialization.Model): _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, + 'dataset': {'required': True}, } _attribute_map = { @@ -1042,7 +1043,7 @@ def __init__( self.type = kwargs['type'] self.timeframe = kwargs['timeframe'] self.time_period = kwargs.get('time_period', None) - self.dataset = kwargs.get('dataset', None) + self.dataset = kwargs['dataset'] self.include_actual_cost = kwargs.get('include_actual_cost', None) self.include_fresh_partial_cost = kwargs.get('include_fresh_partial_cost', None) @@ -1267,7 +1268,7 @@ class QueryAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Sum". + include: "Avg", "Max", "Min", "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -1364,7 +1365,8 @@ class QueryDataset(msrest.serialization.Model): :param grouping: Array of group by expression to use in the query. Query can have up to 2 group by clauses. :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: Has filter expression to use in the query. + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. :type filter: ~azure.mgmt.costmanagement.models.QueryFilter """ @@ -1407,7 +1409,8 @@ class QueryDatasetAutoGenerated(msrest.serialization.Model): :param grouping: Array of group by expression to use in the query. Query can have up to 2 group by clauses. :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: Has filter expression to use in the query. + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. :type filter: ~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated """ @@ -1469,13 +1472,14 @@ class QueryDefinition(msrest.serialization.Model): :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType :param time_period: Has time period for pulling data for the query. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param dataset: Has definition for data in this query. + :param dataset: Required. Has definition for data in this query. :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, + 'dataset': {'required': True}, } _attribute_map = { @@ -1493,7 +1497,7 @@ def __init__( self.type = kwargs['type'] self.timeframe = kwargs['timeframe'] self.time_period = kwargs.get('time_period', None) - self.dataset = kwargs.get('dataset', None) + self.dataset = kwargs['dataset'] class QueryFilter(msrest.serialization.Model): @@ -1700,7 +1704,7 @@ class ReportConfigAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Sum". + include: "Avg", "Max", "Min", "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index 699d4b63d817..e3f7e70197dd 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -1117,7 +1117,7 @@ class ForecastDefinition(msrest.serialization.Model): :type timeframe: str or ~azure.mgmt.costmanagement.models.ForecastTimeframeType :param time_period: Has time period for pulling data for the forecast. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param dataset: Has definition for data in this forecast. + :param dataset: Required. Has definition for data in this forecast. :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset :param include_actual_cost: a boolean determining if actualCost will be included. :type include_actual_cost: bool @@ -1128,6 +1128,7 @@ class ForecastDefinition(msrest.serialization.Model): _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, + 'dataset': {'required': True}, } _attribute_map = { @@ -1144,8 +1145,8 @@ def __init__( *, type: Union[str, "ForecastType"], timeframe: Union[str, "ForecastTimeframeType"], + dataset: "QueryDataset", time_period: Optional["QueryTimePeriod"] = None, - dataset: Optional["QueryDataset"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, **kwargs @@ -1392,7 +1393,7 @@ class QueryAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Sum". + include: "Avg", "Max", "Min", "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ @@ -1499,7 +1500,8 @@ class QueryDataset(msrest.serialization.Model): :param grouping: Array of group by expression to use in the query. Query can have up to 2 group by clauses. :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: Has filter expression to use in the query. + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. :type filter: ~azure.mgmt.costmanagement.models.QueryFilter """ @@ -1548,7 +1550,8 @@ class QueryDatasetAutoGenerated(msrest.serialization.Model): :param grouping: Array of group by expression to use in the query. Query can have up to 2 group by clauses. :type grouping: list[~azure.mgmt.costmanagement.models.QueryGrouping] - :param filter: Has filter expression to use in the query. + :param filter: The filter expression to use in the query. Please reference our Query API REST + documentation for how to properly format the filter. :type filter: ~azure.mgmt.costmanagement.models.QueryFilterAutoGenerated """ @@ -1618,13 +1621,14 @@ class QueryDefinition(msrest.serialization.Model): :type timeframe: str or ~azure.mgmt.costmanagement.models.TimeframeType :param time_period: Has time period for pulling data for the query. :type time_period: ~azure.mgmt.costmanagement.models.QueryTimePeriod - :param dataset: Has definition for data in this query. + :param dataset: Required. Has definition for data in this query. :type dataset: ~azure.mgmt.costmanagement.models.QueryDataset """ _validation = { 'type': {'required': True}, 'timeframe': {'required': True}, + 'dataset': {'required': True}, } _attribute_map = { @@ -1639,8 +1643,8 @@ def __init__( *, type: Union[str, "ExportType"], timeframe: Union[str, "TimeframeType"], + dataset: "QueryDataset", time_period: Optional["QueryTimePeriod"] = None, - dataset: Optional["QueryDataset"] = None, **kwargs ): super(QueryDefinition, self).__init__(**kwargs) @@ -1875,7 +1879,7 @@ class ReportConfigAggregation(msrest.serialization.Model): :param name: Required. The name of the column to aggregate. :type name: str :param function: Required. The name of the aggregation function to use. Possible values - include: "Sum". + include: "Avg", "Max", "Min", "Sum". :type function: str or ~azure.mgmt.costmanagement.models.FunctionType """ From d0c334c58bd14f67a645e47251f56260bda89411 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Tue, 24 Aug 2021 10:15:56 +0800 Subject: [PATCH 05/16] [AutoRelease] t2-servicebus-2021-08-19-00756 (#20350) * CodeGen from PR 14749 in Azure/azure-rest-api-specs add apitestErrorCode doc (#14749) * add apitestErrorCode doc * add armRPC doc * add roundTripInconsistentProperty doc * small fix * update * update signalR armTemplate * update yaml * new file * add testScenario with armTemplate * update doc * update readme.md * update doc * update NOTE section * add signalRCreateOrUpdate example file * udpate doc * add generate test scenario section * update doc * add serviceFacbric test scenario file * update managedClusters.yaml * update generateABasicTestScenario.md * update features doc * add run api test gif * version,CHANGELOG * test * Update test_cli_mgmt_servicebus_namespace.py * Update test_queues.py * Update test_queues.py Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines Co-authored-by: Zed Lei <59104634+RAY-316@users.noreply.github.com> Co-authored-by: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com> --- .../azure-mgmt-servicebus/CHANGELOG.md | 35 + .../azure-mgmt-servicebus/MANIFEST.in | 1 + .../azure-mgmt-servicebus/_meta.json | 11 + .../azure/mgmt/servicebus/__init__.py | 3 - .../azure/mgmt/servicebus/_configuration.py | 11 +- .../_service_bus_management_client.py | 408 ++- .../azure/mgmt/servicebus/_version.py | 2 +- .../mgmt/servicebus/aio/_configuration.py | 13 +- .../aio/_service_bus_management_client.py | 414 ++- .../azure/mgmt/servicebus/models.py | 7 + .../mgmt/servicebus/v2015_08_01/__init__.py | 16 + .../servicebus/v2015_08_01/_configuration.py | 70 + .../servicebus/v2015_08_01/_metadata.json | 107 + .../_service_bus_management_client.py | 109 + .../servicebus/v2015_08_01/aio/__init__.py | 10 + .../v2015_08_01/aio/_configuration.py | 66 + .../aio/_service_bus_management_client.py | 102 + .../v2015_08_01/aio/operations/__init__.py | 21 + .../aio/operations/_namespaces_operations.py | 1000 +++++++ .../v2015_08_01/aio/operations/_operations.py | 104 + .../aio/operations/_queues_operations.py | 790 ++++++ .../operations/_subscriptions_operations.py | 321 +++ .../aio/operations/_topics_operations.py | 790 ++++++ .../servicebus/v2015_08_01/models/__init__.py | 113 + .../servicebus/v2015_08_01/models/_models.py | 1525 +++++++++++ .../v2015_08_01/models/_models_py3.py | 1689 ++++++++++++ .../_service_bus_management_client_enums.py | 109 + .../v2015_08_01/operations/__init__.py | 21 + .../operations/_namespaces_operations.py | 1019 +++++++ .../v2015_08_01/operations/_operations.py | 109 + .../operations/_queues_operations.py | 805 ++++++ .../operations/_subscriptions_operations.py | 329 +++ .../operations/_topics_operations.py | 805 ++++++ .../mgmt/servicebus/v2015_08_01/py.typed | 1 + .../mgmt/servicebus/v2017_04_01/__init__.py | 16 + .../servicebus/v2017_04_01/_configuration.py | 70 + .../servicebus/v2017_04_01/_metadata.json | 113 + .../_service_bus_management_client.py | 139 + .../servicebus/v2017_04_01/aio/__init__.py | 10 + .../v2017_04_01/aio/_configuration.py | 66 + .../aio/_service_bus_management_client.py | 132 + .../v2017_04_01/aio/operations/__init__.py | 33 + .../_disaster_recovery_configs_operations.py | 714 +++++ .../aio/operations/_event_hubs_operations.py | 117 + .../_migration_configs_operations.py | 499 ++++ .../aio/operations/_namespaces_operations.py | 1282 +++++++++ .../v2017_04_01/aio/operations/_operations.py | 105 + .../_premium_messaging_regions_operations.py | 109 + .../aio/operations/_queues_operations.py | 750 +++++ .../aio/operations/_regions_operations.py | 113 + .../aio/operations/_rules_operations.py | 355 +++ .../operations/_subscriptions_operations.py | 339 +++ .../aio/operations/_topics_operations.py | 750 +++++ .../servicebus/v2017_04_01/models/__init__.py | 191 ++ .../servicebus/v2017_04_01/models/_models.py | 2057 ++++++++++++++ .../v2017_04_01/models/_models_py3.py | 2231 +++++++++++++++ .../_service_bus_management_client_enums.py | 140 + .../v2017_04_01/operations/__init__.py | 33 + .../_disaster_recovery_configs_operations.py | 728 +++++ .../operations/_event_hubs_operations.py | 6 +- .../_migration_configs_operations.py | 36 +- .../operations/_namespaces_operations.py | 1305 +++++++++ .../v2017_04_01/operations/_operations.py | 110 + .../_premium_messaging_regions_operations.py | 6 +- .../operations/_queues_operations.py | 44 +- .../operations/_regions_operations.py | 6 +- .../operations/_rules_operations.py | 18 +- .../operations/_subscriptions_operations.py | 18 +- .../operations/_topics_operations.py | 44 +- .../mgmt/servicebus/v2017_04_01/py.typed | 1 + .../v2018_01_01_preview/__init__.py | 16 + .../v2018_01_01_preview/_configuration.py | 70 + .../v2018_01_01_preview/_metadata.json | 115 + .../_service_bus_management_client.py | 149 + .../v2018_01_01_preview/aio/__init__.py | 10 + .../v2018_01_01_preview/aio/_configuration.py | 66 + .../aio/_service_bus_management_client.py | 142 + .../aio}/operations/__init__.py | 4 +- .../_disaster_recovery_configs_operations.py | 725 +++++ .../aio/operations/_event_hubs_operations.py | 117 + .../_migration_configs_operations.py | 499 ++++ .../aio/operations/_namespaces_operations.py | 1820 ++++++++++++ .../aio/operations/_operations.py | 105 + .../_premium_messaging_regions_operations.py | 109 + ...private_endpoint_connections_operations.py | 374 +++ .../_private_link_resources_operations.py | 100 + .../aio/operations/_queues_operations.py | 750 +++++ .../aio/operations/_regions_operations.py | 113 + .../aio/operations/_rules_operations.py | 355 +++ .../operations/_subscriptions_operations.py | 339 +++ .../aio/operations/_topics_operations.py | 750 +++++ .../models/__init__.py | 3 + .../models/_models.py | 206 +- .../models/_models_py3.py | 211 +- .../_service_bus_management_client_enums.py | 0 .../operations/__init__.py | 37 + .../_disaster_recovery_configs_operations.py | 42 +- .../operations/_event_hubs_operations.py | 122 + .../_migration_configs_operations.py | 510 ++++ .../operations/_namespaces_operations.py | 452 +-- .../operations/_operations.py | 6 +- .../_premium_messaging_regions_operations.py | 114 + ...private_endpoint_connections_operations.py | 22 +- .../_private_link_resources_operations.py | 6 +- .../operations/_queues_operations.py | 764 ++++++ .../operations/_regions_operations.py | 118 + .../operations/_rules_operations.py | 363 +++ .../operations/_subscriptions_operations.py | 347 +++ .../operations/_topics_operations.py | 764 ++++++ .../servicebus/v2018_01_01_preview/py.typed | 1 + .../v2021_01_01_preview/__init__.py | 16 + .../v2021_01_01_preview/_configuration.py | 69 + .../v2021_01_01_preview/_metadata.json | 112 + .../_service_bus_management_client.py | 134 + .../v2021_01_01_preview/aio/__init__.py | 10 + .../v2021_01_01_preview/aio/_configuration.py | 65 + .../aio/_service_bus_management_client.py | 127 + .../aio/operations/__init__.py | 31 + .../_disaster_recovery_configs_operations.py | 725 +++++ .../_migration_configs_operations.py | 499 ++++ .../aio/operations/_namespaces_operations.py | 1218 +++++++++ .../aio/operations/_operations.py | 105 + ...private_endpoint_connections_operations.py | 374 +++ .../_private_link_resources_operations.py | 100 + .../aio/operations/_queues_operations.py | 750 +++++ .../aio/operations/_rules_operations.py | 355 +++ .../operations/_subscriptions_operations.py | 339 +++ .../aio/operations/_topics_operations.py | 750 +++++ .../v2021_01_01_preview/models/__init__.py | 210 ++ .../v2021_01_01_preview/models/_models.py | 2228 +++++++++++++++ .../v2021_01_01_preview/models/_models_py3.py | 2429 +++++++++++++++++ .../_service_bus_management_client_enums.py | 161 ++ .../operations/__init__.py | 31 + .../_disaster_recovery_configs_operations.py | 739 +++++ .../_migration_configs_operations.py | 510 ++++ .../operations/_namespaces_operations.py | 1240 +++++++++ .../operations/_operations.py | 110 + ...private_endpoint_connections_operations.py | 383 +++ .../_private_link_resources_operations.py | 105 + .../operations/_queues_operations.py | 764 ++++++ .../operations/_rules_operations.py | 363 +++ .../operations/_subscriptions_operations.py | 347 +++ .../operations/_topics_operations.py | 764 ++++++ .../servicebus/v2021_01_01_preview/py.typed | 1 + sdk/servicebus/azure-mgmt-servicebus/setup.py | 2 +- ...espace.test_disaster_recovery_configs.yaml | 481 ---- ...ebus_namespace.test_migration_configs.yaml | 1155 -------- ...t_servicebus_namespace.test_namespace.yaml | 1170 -------- ..._cli_mgmt_servicebus_queue.test_queue.yaml | 149 +- ...ebus_topic.test_subscrpition_and_rule.yaml | 161 +- ..._cli_mgmt_servicebus_topic.test_topic.yaml | 144 +- .../test_cli_mgmt_servicebus_namespace.py | 6 +- .../azure-servicebus/tests/test_queues.py | 2 + shared_requirements.txt | 1 + 154 files changed, 50151 insertions(+), 3722 deletions(-) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/_meta.json create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_event_hubs_operations.py (96%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_migration_configs_operations.py (93%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_premium_messaging_regions_operations.py (95%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_queues_operations.py (95%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_regions_operations.py (96%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_rules_operations.py (96%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_subscriptions_operations.py (95%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2017_04_01}/operations/_topics_operations.py (95%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview/aio}/operations/__init__.py (100%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/models/__init__.py (98%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/models/_models.py (92%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/models/_models_py3.py (92%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/models/_service_bus_management_client_enums.py (100%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/operations/_disaster_recovery_configs_operations.py (95%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/operations/_namespaces_operations.py (90%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/operations/_operations.py (95%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/operations/_private_endpoint_connections_operations.py (95%) rename sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/{ => v2018_01_01_preview}/operations/_private_link_resources_operations.py (94%) create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py create mode 100644 sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed delete mode 100644 sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_disaster_recovery_configs.yaml delete mode 100644 sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_migration_configs.yaml delete mode 100644 sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_namespace.yaml diff --git a/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md b/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md index 0267426e9412..b41c5e473bc0 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-mgmt-servicebus/CHANGELOG.md @@ -1,5 +1,40 @@ # Release History +## 7.0.0 (2021-08-19) + +**Features** + + - Model Rule has a new parameter system_data + - Model SBNamespaceUpdateParameters has a new parameter private_endpoint_connections + - Model PrivateEndpointConnection has a new parameter system_data + - Model SBTopic has a new parameter system_data + - Model Identity has a new parameter user_assigned_identities + - Model SBNamespace has a new parameter system_data + - Model SBNamespace has a new parameter private_endpoint_connections + - Model Encryption has a new parameter require_infrastructure_encryption + - Model SBAuthorizationRule has a new parameter system_data + - Model SBSubscription has a new parameter system_data + - Model KeyVaultProperties has a new parameter key_version + - Model KeyVaultProperties has a new parameter identity + - Model ArmDisasterRecovery has a new parameter system_data + - Model NetworkRuleSet has a new parameter system_data + - Model SBQueue has a new parameter system_data + - Model MigrationConfigProperties has a new parameter system_data + - Added operation NamespacesOperations.list_network_rule_sets + +**Breaking changes** + + - Parameter id of model Subnet is now required + - Removed operation NamespacesOperations.list_virtual_network_rules + - Removed operation NamespacesOperations.migrate + - Removed operation NamespacesOperations.delete_ip_filter_rule + - Removed operation NamespacesOperations.get_virtual_network_rule + - Removed operation NamespacesOperations.create_or_update_ip_filter_rule + - Removed operation NamespacesOperations.delete_virtual_network_rule + - Removed operation NamespacesOperations.get_ip_filter_rule + - Removed operation NamespacesOperations.list_ip_filter_rules + - Removed operation NamespacesOperations.create_or_update_virtual_network_rule + ## 6.0.0 (2020-11-23) **Features** diff --git a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in +++ b/sdk/servicebus/azure-mgmt-servicebus/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/servicebus/azure-mgmt-servicebus/_meta.json b/sdk/servicebus/azure-mgmt-servicebus/_meta.json new file mode 100644 index 000000000000..3ded810499df --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "45bf753575c080524ca3439441430eb47d8b982f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/servicebus/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/servicebus/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py index e6ef471ff03a..f640dac181bb 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/__init__.py @@ -7,9 +7,6 @@ # -------------------------------------------------------------------------- from ._service_bus_management_client import ServiceBusManagementClient -from ._version import VERSION - -__version__ = VERSION __all__ = ['ServiceBusManagementClient'] try: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py index 5f855135c3d3..9531d7678c12 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_configuration.py @@ -1,11 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- - from typing import TYPE_CHECKING from azure.core.configuration import Configuration @@ -20,7 +22,6 @@ from azure.core.credentials import TokenCredential - class ServiceBusManagementClientConfiguration(Configuration): """Configuration for ServiceBusManagementClient. @@ -49,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-servicebus/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py index 08a628c95a43..1073ca408443 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_service_bus_management_client.py @@ -1,130 +1,366 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from msrest import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): + """Azure Service Bus client. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. -from ._configuration import ServiceBusManagementClientConfiguration -from .operations import NamespacesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import DisasterRecoveryConfigsOperations -from .operations import QueuesOperations -from .operations import TopicsOperations -from .operations import EventHubsOperations -from .operations import MigrationConfigsOperations -from .operations import PremiumMessagingRegionsOperations -from .operations import RegionsOperations -from .operations import SubscriptionsOperations -from .operations import RulesOperations -from . import models - - -class ServiceBusManagementClient(object): - """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. - - :ivar namespaces: NamespacesOperations operations - :vartype namespaces: azure.mgmt.servicebus.operations.NamespacesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.servicebus.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.servicebus.operations.PrivateLinkResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicebus.operations.Operations - :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations - :vartype disaster_recovery_configs: azure.mgmt.servicebus.operations.DisasterRecoveryConfigsOperations - :ivar queues: QueuesOperations operations - :vartype queues: azure.mgmt.servicebus.operations.QueuesOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.servicebus.operations.TopicsOperations - :ivar event_hubs: EventHubsOperations operations - :vartype event_hubs: azure.mgmt.servicebus.operations.EventHubsOperations - :ivar migration_configs: MigrationConfigsOperations operations - :vartype migration_configs: azure.mgmt.servicebus.operations.MigrationConfigsOperations - :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations - :vartype premium_messaging_regions: azure.mgmt.servicebus.operations.PremiumMessagingRegionsOperations - :ivar regions: RegionsOperations operations - :vartype regions: azure.mgmt.servicebus.operations.RegionsOperations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.servicebus.operations.SubscriptionsOperations - :ivar rules: RulesOperations operations - :vartype rules: azure.mgmt.servicebus.operations.RulesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ + DEFAULT_API_VERSION = '2017-04-01' + _PROFILE_TAG = "azure.mgmt.servicebus.ServiceBusManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str + api_version=None, # type: Optional[str] base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - # type: (...) -> None if not base_url: base_url = 'https://management.azure.com' self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ServiceBusManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-08-01: :mod:`v2015_08_01.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` + """ + if api_version == '2015-08-01': + from .v2015_08_01 import models + return models + elif api_version == '2017-04-01': + from .v2017_04_01 import models + return models + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview import models + return models + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def disaster_recovery_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`DisasterRecoveryConfigsOperations` + * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + """ + api_version = self._get_api_version('disaster_recovery_configs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import DisasterRecoveryConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def event_hubs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`EventHubsOperations` + * 2018-01-01-preview: :class:`EventHubsOperations` + """ + api_version = self._get_api_version('event_hubs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import EventHubsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import EventHubsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def migration_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`MigrationConfigsOperations` + * 2018-01-01-preview: :class:`MigrationConfigsOperations` + * 2021-01-01-preview: :class:`MigrationConfigsOperations` + """ + api_version = self._get_api_version('migration_configs') + if api_version == '2017-04-01': + from .v2017_04_01.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import MigrationConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def namespaces(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`NamespacesOperations` + * 2017-04-01: :class:`NamespacesOperations` + * 2018-01-01-preview: :class:`NamespacesOperations` + * 2021-01-01-preview: :class:`NamespacesOperations` + """ + api_version = self._get_api_version('namespaces') + if api_version == '2015-08-01': + from .v2015_08_01.operations import NamespacesOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import NamespacesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import NamespacesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import NamespacesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.migration_configs = MigrationConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.premium_messaging_regions = PremiumMessagingRegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) + * 2015-08-01: :class:`Operations` + * 2017-04-01: :class:`Operations` + * 2018-01-01-preview: :class:`Operations` + * 2021-01-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2015-08-01': + from .v2015_08_01.operations import Operations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import Operations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import Operations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def premium_messaging_regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`PremiumMessagingRegionsOperations` + * 2018-01-01-preview: :class:`PremiumMessagingRegionsOperations` + """ + api_version = self._get_api_version('premium_messaging_regions') + if api_version == '2017-04-01': + from .v2017_04_01.operations import PremiumMessagingRegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PremiumMessagingRegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def queues(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`QueuesOperations` + * 2017-04-01: :class:`QueuesOperations` + * 2018-01-01-preview: :class:`QueuesOperations` + * 2021-01-01-preview: :class:`QueuesOperations` + """ + api_version = self._get_api_version('queues') + if api_version == '2015-08-01': + from .v2015_08_01.operations import QueuesOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import QueuesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import QueuesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import QueuesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RegionsOperations` + * 2018-01-01-preview: :class:`RegionsOperations` + """ + api_version = self._get_api_version('regions') + if api_version == '2017-04-01': + from .v2017_04_01.operations import RegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def rules(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RulesOperations` + * 2018-01-01-preview: :class:`RulesOperations` + * 2021-01-01-preview: :class:`RulesOperations` + """ + api_version = self._get_api_version('rules') + if api_version == '2017-04-01': + from .v2017_04_01.operations import RulesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RulesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import RulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def subscriptions(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`SubscriptionsOperations` + * 2017-04-01: :class:`SubscriptionsOperations` + * 2018-01-01-preview: :class:`SubscriptionsOperations` + * 2021-01-01-preview: :class:`SubscriptionsOperations` + """ + api_version = self._get_api_version('subscriptions') + if api_version == '2015-08-01': + from .v2015_08_01.operations import SubscriptionsOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import SubscriptionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import SubscriptionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import SubscriptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def topics(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`TopicsOperations` + * 2017-04-01: :class:`TopicsOperations` + * 2018-01-01-preview: :class:`TopicsOperations` + * 2021-01-01-preview: :class:`TopicsOperations` + """ + api_version = self._get_api_version('topics') + if api_version == '2015-08-01': + from .v2015_08_01.operations import TopicsOperations as OperationClass + elif api_version == '2017-04-01': + from .v2017_04_01.operations import TopicsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import TopicsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import TopicsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) def close(self): - # type: () -> None self._client.close() - def __enter__(self): - # type: () -> ServiceBusManagementClient self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py index caf312bd2d0b..364f3c906cf9 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.0.0" +VERSION = "7.0.0" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py index 731dc0b33f61..81b406d86751 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_configuration.py @@ -1,11 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- - from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -18,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - class ServiceBusManagementClientConfiguration(Configuration): """Configuration for ServiceBusManagementClient. @@ -35,7 +36,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - **kwargs: Any + **kwargs # type: Any ) -> None: if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -46,7 +47,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-servicebus/{}'.format(VERSION)) self._configure(**kwargs) def _configure( diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py index b4bb2493ea16..e62c78ab6d31 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/aio/_service_bus_management_client.py @@ -1,124 +1,364 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from msrest import Deserializer, Serializer +from ._configuration import ServiceBusManagementClientConfiguration + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ServiceBusManagementClientConfiguration -from .operations import NamespacesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import DisasterRecoveryConfigsOperations -from .operations import QueuesOperations -from .operations import TopicsOperations -from .operations import EventHubsOperations -from .operations import MigrationConfigsOperations -from .operations import PremiumMessagingRegionsOperations -from .operations import RegionsOperations -from .operations import SubscriptionsOperations -from .operations import RulesOperations -from .. import models - - -class ServiceBusManagementClient(object): - """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. - - :ivar namespaces: NamespacesOperations operations - :vartype namespaces: azure.mgmt.servicebus.aio.operations.NamespacesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.servicebus.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.servicebus.aio.operations.PrivateLinkResourcesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicebus.aio.operations.Operations - :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations - :vartype disaster_recovery_configs: azure.mgmt.servicebus.aio.operations.DisasterRecoveryConfigsOperations - :ivar queues: QueuesOperations operations - :vartype queues: azure.mgmt.servicebus.aio.operations.QueuesOperations - :ivar topics: TopicsOperations operations - :vartype topics: azure.mgmt.servicebus.aio.operations.TopicsOperations - :ivar event_hubs: EventHubsOperations operations - :vartype event_hubs: azure.mgmt.servicebus.aio.operations.EventHubsOperations - :ivar migration_configs: MigrationConfigsOperations operations - :vartype migration_configs: azure.mgmt.servicebus.aio.operations.MigrationConfigsOperations - :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations - :vartype premium_messaging_regions: azure.mgmt.servicebus.aio.operations.PremiumMessagingRegionsOperations - :ivar regions: RegionsOperations operations - :vartype regions: azure.mgmt.servicebus.aio.operations.RegionsOperations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.servicebus.aio.operations.SubscriptionsOperations - :ivar rules: RulesOperations operations - :vartype rules: azure.mgmt.servicebus.aio.operations.RulesOperations +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class ServiceBusManagementClient(MultiApiClientMixin, _SDKClient): + """Azure Service Bus client. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ + DEFAULT_API_VERSION = '2017-04-01' + _PROFILE_TAG = "azure.mgmt.servicebus.ServiceBusManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + api_version: Optional[str] = None, base_url: Optional[str] = None, - **kwargs: Any + profile: KnownProfiles = KnownProfiles.default, + **kwargs # type: Any ) -> None: if not base_url: base_url = 'https://management.azure.com' self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(ServiceBusManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.namespaces = NamespacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queues = QueuesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.topics = TopicsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.event_hubs = EventHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.migration_configs = MigrationConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.premium_messaging_regions = PremiumMessagingRegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.regions = RegionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.rules = RulesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-08-01: :mod:`v2015_08_01.models` + * 2017-04-01: :mod:`v2017_04_01.models` + * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` + """ + if api_version == '2015-08-01': + from ..v2015_08_01 import models + return models + elif api_version == '2017-04-01': + from ..v2017_04_01 import models + return models + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview import models + return models + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def disaster_recovery_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`DisasterRecoveryConfigsOperations` + * 2018-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + * 2021-01-01-preview: :class:`DisasterRecoveryConfigsOperations` + """ + api_version = self._get_api_version('disaster_recovery_configs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import DisasterRecoveryConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'disaster_recovery_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def event_hubs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`EventHubsOperations` + * 2018-01-01-preview: :class:`EventHubsOperations` + """ + api_version = self._get_api_version('event_hubs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import EventHubsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import EventHubsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'event_hubs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def migration_configs(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`MigrationConfigsOperations` + * 2018-01-01-preview: :class:`MigrationConfigsOperations` + * 2021-01-01-preview: :class:`MigrationConfigsOperations` + """ + api_version = self._get_api_version('migration_configs') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import MigrationConfigsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import MigrationConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'migration_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def namespaces(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`NamespacesOperations` + * 2017-04-01: :class:`NamespacesOperations` + * 2018-01-01-preview: :class:`NamespacesOperations` + * 2021-01-01-preview: :class:`NamespacesOperations` + """ + api_version = self._get_api_version('namespaces') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import NamespacesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import NamespacesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'namespaces'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: - async def __aenter__(self) -> "ServiceBusManagementClient": + * 2015-08-01: :class:`Operations` + * 2017-04-01: :class:`Operations` + * 2018-01-01-preview: :class:`Operations` + * 2021-01-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import Operations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import Operations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def premium_messaging_regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`PremiumMessagingRegionsOperations` + * 2018-01-01-preview: :class:`PremiumMessagingRegionsOperations` + """ + api_version = self._get_api_version('premium_messaging_regions') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import PremiumMessagingRegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PremiumMessagingRegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'premium_messaging_regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-01-01-preview: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-01-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-01-01-preview: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def queues(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`QueuesOperations` + * 2017-04-01: :class:`QueuesOperations` + * 2018-01-01-preview: :class:`QueuesOperations` + * 2021-01-01-preview: :class:`QueuesOperations` + """ + api_version = self._get_api_version('queues') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import QueuesOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import QueuesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import QueuesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import QueuesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'queues'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def regions(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RegionsOperations` + * 2018-01-01-preview: :class:`RegionsOperations` + """ + api_version = self._get_api_version('regions') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import RegionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import RegionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'regions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def rules(self): + """Instance depends on the API version: + + * 2017-04-01: :class:`RulesOperations` + * 2018-01-01-preview: :class:`RulesOperations` + * 2021-01-01-preview: :class:`RulesOperations` + """ + api_version = self._get_api_version('rules') + if api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import RulesOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import RulesOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import RulesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'rules'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def subscriptions(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`SubscriptionsOperations` + * 2017-04-01: :class:`SubscriptionsOperations` + * 2018-01-01-preview: :class:`SubscriptionsOperations` + * 2021-01-01-preview: :class:`SubscriptionsOperations` + """ + api_version = self._get_api_version('subscriptions') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import SubscriptionsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import SubscriptionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def topics(self): + """Instance depends on the API version: + + * 2015-08-01: :class:`TopicsOperations` + * 2017-04-01: :class:`TopicsOperations` + * 2018-01-01-preview: :class:`TopicsOperations` + * 2021-01-01-preview: :class:`TopicsOperations` + """ + api_version = self._get_api_version('topics') + if api_version == '2015-08-01': + from ..v2015_08_01.aio.operations import TopicsOperations as OperationClass + elif api_version == '2017-04-01': + from ..v2017_04_01.aio.operations import TopicsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from ..v2018_01_01_preview.aio.operations import TopicsOperations as OperationClass + elif api_version == '2021-01-01-preview': + from ..v2021_01_01_preview.aio.operations import TopicsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'topics'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): await self._client.__aenter__() return self - - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details): await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py new file mode 100644 index 000000000000..5572430ae05d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models.py @@ -0,0 +1,7 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from .v2017_04_01.models import * diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py new file mode 100644 index 000000000000..f640dac181bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py new file mode 100644 index 000000000000..86251b30a6cd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json new file mode 100644 index 000000000000..f0e50cee8bd2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_metadata.json @@ -0,0 +1,107 @@ +{ + "chosen_version": "2015-08-01", + "total_api_version_list": ["2015-08-01"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "namespaces": "NamespacesOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py new file mode 100644 index 000000000000..8e48132a1173 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/_service_bus_management_client.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import Operations +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2015_08_01.operations.Operations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2015_08_01.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2015_08_01.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2015_08_01.operations.TopicsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py new file mode 100644 index 000000000000..9016cbc21795 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py new file mode 100644 index 000000000000..110ae4142b88 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2015-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py new file mode 100644 index 000000000000..b2bce21706fc --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/_service_bus_management_client.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import Operations +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2015_08_01.aio.operations.Operations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2015_08_01.aio.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2015_08_01.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2015_08_01.aio.operations.TopicsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2015_08_01.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py new file mode 100644 index 000000000000..7acd03e6343c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'Operations', + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..2b18ed327fa7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_namespaces_operations.py @@ -0,0 +1,1000 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.NamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceCreateOrUpdateParameters", + **kwargs: Any + ) -> Optional["_models.NamespaceResource"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceCreateOrUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.NamespaceResource"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamespaceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NamespaceResource": + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.NamespaceResource"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py new file mode 100644 index 000000000000..41f1aa1219ff --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py new file mode 100644 index 000000000000..21e4945daaa7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_queues_operations.py @@ -0,0 +1,790 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.QueueListResult"]: + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('QueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.QueueCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.QueueResource": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.QueueResource": + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def post_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..ecad0389db18 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_subscriptions_operations.py @@ -0,0 +1,321 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SubscriptionCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SubscriptionResource": + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SubscriptionResource": + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..78809361ef44 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/aio/operations/_topics_operations.py @@ -0,0 +1,790 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.TopicListResult"]: + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.TopicCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.TopicResource": + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.TopicResource": + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def post_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SharedAccessAuthorizationRuleResource": + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateKeysParameters", + **kwargs: Any + ) -> "_models.ResourceListKeys": + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py new file mode 100644 index 000000000000..78f57734661b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/__init__.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import MessageCountDetails + from ._models_py3 import NamespaceCreateOrUpdateParameters + from ._models_py3 import NamespaceListResult + from ._models_py3 import NamespaceResource + from ._models_py3 import NamespaceUpdateParameters + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import QueueCreateOrUpdateParameters + from ._models_py3 import QueueListResult + from ._models_py3 import QueueResource + from ._models_py3 import RegenerateKeysParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceListKeys + from ._models_py3 import SharedAccessAuthorizationRuleCreateOrUpdateParameters + from ._models_py3 import SharedAccessAuthorizationRuleListResult + from ._models_py3 import SharedAccessAuthorizationRuleResource + from ._models_py3 import Sku + from ._models_py3 import SubscriptionCreateOrUpdateParameters + from ._models_py3 import SubscriptionListResult + from ._models_py3 import SubscriptionResource + from ._models_py3 import TopicCreateOrUpdateParameters + from ._models_py3 import TopicListResult + from ._models_py3 import TopicResource + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import NamespaceCreateOrUpdateParameters # type: ignore + from ._models import NamespaceListResult # type: ignore + from ._models import NamespaceResource # type: ignore + from ._models import NamespaceUpdateParameters # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import QueueCreateOrUpdateParameters # type: ignore + from ._models import QueueListResult # type: ignore + from ._models import QueueResource # type: ignore + from ._models import RegenerateKeysParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListKeys # type: ignore + from ._models import SharedAccessAuthorizationRuleCreateOrUpdateParameters # type: ignore + from ._models import SharedAccessAuthorizationRuleListResult # type: ignore + from ._models import SharedAccessAuthorizationRuleResource # type: ignore + from ._models import Sku # type: ignore + from ._models import SubscriptionCreateOrUpdateParameters # type: ignore + from ._models import SubscriptionListResult # type: ignore + from ._models import SubscriptionResource # type: ignore + from ._models import TopicCreateOrUpdateParameters # type: ignore + from ._models import TopicListResult # type: ignore + from ._models import TopicResource # type: ignore + from ._models import TrackedResource # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + EntityAvailabilityStatus, + EntityStatus, + NamespaceState, + Policykey, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'MessageCountDetails', + 'NamespaceCreateOrUpdateParameters', + 'NamespaceListResult', + 'NamespaceResource', + 'NamespaceUpdateParameters', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'QueueCreateOrUpdateParameters', + 'QueueListResult', + 'QueueResource', + 'RegenerateKeysParameters', + 'Resource', + 'ResourceListKeys', + 'SharedAccessAuthorizationRuleCreateOrUpdateParameters', + 'SharedAccessAuthorizationRuleListResult', + 'SharedAccessAuthorizationRuleResource', + 'Sku', + 'SubscriptionCreateOrUpdateParameters', + 'SubscriptionListResult', + 'SubscriptionResource', + 'TopicCreateOrUpdateParameters', + 'TopicListResult', + 'TopicResource', + 'TrackedResource', + 'AccessRights', + 'EntityAvailabilityStatus', + 'EntityStatus', + 'NamespaceState', + 'Policykey', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py new file mode 100644 index 000000000000..27c852590330 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models.py @@ -0,0 +1,1525 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_dead_letter_message_count = None + self.transfer_message_count = None + + +class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Namespace operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Namespace location. + :type location: str + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :param tags: A set of tags. Namespace tags. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs['location'] + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.provisioning_state = None + self.status = kwargs.get('status', None) + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = kwargs.get('create_acs_namespace', None) + self.enabled = kwargs.get('enabled', None) + + +class NamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NamespaceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = kwargs.get('location', None) + self.type = None + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class NamespaceResource(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.status = kwargs.get('status', None) + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = kwargs.get('create_acs_namespace', None) + self.enabled = kwargs.get('enabled', None) + + +class NamespaceUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The sku of the created namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + super(NamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2015_08_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class QueueCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Queue operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Queue name. + :type name: str + :param location: Required. location of the resource. + :type location: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs['location'] + self.lock_duration = kwargs.get('lock_duration', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class QueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueueResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QueueResource(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(QueueResource, self).__init__(**kwargs) + self.lock_duration = kwargs.get('lock_duration', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class RegenerateKeysParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation. + + :param policykey: Key that needs to be regenerated. Possible values include: "PrimaryKey", + "SecondaryKey". + :type policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey + """ + + _attribute_map = { + 'policykey': {'key': 'Policykey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateKeysParameters, self).__init__(**kwargs) + self.policykey = kwargs.get('policykey', None) + + +class ResourceListKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + :param primary_connection_string: Primary connection string of the created namespace + authorization rule. + :type primary_connection_string: str + :param secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :type secondary_connection_string: str + :param primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type primary_key: str + :param secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type secondary_key: str + :param key_name: A string that describes the authorization rule. + :type key_name: str + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListKeys, self).__init__(**kwargs) + self.primary_connection_string = kwargs.get('primary_connection_string', None) + self.secondary_connection_string = kwargs.get('secondary_connection_string', None) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.key_name = kwargs.get('key_name', None) + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Authorization Rules operation. + + :param location: data center location. + :type location: str + :param name: Name of the authorization rule. + :type name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.name = kwargs.get('name', None) + self.rights = kwargs.get('rights', None) + + +class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: + list[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessAuthorizationRuleResource, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + + +class Sku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Name of this SKU. Possible values include: "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName + :param tier: Required. The billing tier of this particular SKU. Possible values include: + "Basic", "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier + :param capacity: The specified messaging units for the tier. + :type capacity: int + """ + + _validation = { + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs['tier'] + self.capacity = kwargs.get('capacity', None) + + +class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Subscription operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Subscription data center location. + :type location: str + :param type: Resource manager type of the resource. + :type type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs['location'] + self.type = kwargs.get('type', None) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.count_details = None + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.is_read_only = kwargs.get('is_read_only', None) + self.lock_duration = kwargs.get('lock_duration', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.message_count = None + self.requires_session = kwargs.get('requires_session', None) + self.status = kwargs.get('status', None) + self.updated_at = None + + +class SubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SubscriptionResource(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SubscriptionResource, self).__init__(**kwargs) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.count_details = None + self.created_at = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.is_read_only = kwargs.get('is_read_only', None) + self.lock_duration = kwargs.get('lock_duration', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.message_count = None + self.requires_session = kwargs.get('requires_session', None) + self.status = kwargs.get('status', None) + self.updated_at = None + + +class TopicCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Topic operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Topic name. + :type name: str + :param location: Required. Location of the resource. + :type location: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.location = kwargs['location'] + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.filtering_messages_before_publishing = kwargs.get('filtering_messages_before_publishing', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.is_express = kwargs.get('is_express', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.subscription_count = None + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None + + +class TopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TopicResource(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TopicResource, self).__init__(**kwargs) + self.accessed_at = None + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.entity_availability_status = kwargs.get('entity_availability_status', None) + self.created_at = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.enable_express = kwargs.get('enable_express', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.filtering_messages_before_publishing = kwargs.get('filtering_messages_before_publishing', None) + self.is_anonymous_accessible = kwargs.get('is_anonymous_accessible', None) + self.is_express = kwargs.get('is_express', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.size_in_bytes = None + self.status = kwargs.get('status', None) + self.subscription_count = None + self.support_ordering = kwargs.get('support_ordering', None) + self.updated_at = None diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py new file mode 100644 index 000000000000..2b2c32db4e79 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py @@ -0,0 +1,1689 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2015_08_01.models.UnavailableReason + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_dead_letter_message_count = None + self.transfer_message_count = None + + +class NamespaceCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Namespace operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Namespace location. + :type location: str + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :param tags: A set of tags. Namespace tags. + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + status: Optional[Union[str, "NamespaceState"]] = None, + create_acs_namespace: Optional[bool] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(NamespaceCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.sku = sku + self.tags = tags + self.provisioning_state = None + self.status = status + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = create_acs_namespace + self.enabled = enabled + + +class NamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NamespaceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NamespaceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = location + self.type = None + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(location=location, **kwargs) + self.tags = tags + + +class NamespaceResource(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: SKU of the namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :param status: State of the namespace. Possible values include: "Unknown", "Creating", + "Created", "Activating", "Enabling", "Active", "Disabling", "Disabled", "SoftDeleting", + "SoftDeleted", "Removing", "Removed", "Failed". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceState + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :param create_acs_namespace: Indicates whether to create an ACS namespace. + :type create_acs_namespace: bool + :param enabled: Specifies whether this instance is enabled. + :type enabled: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'create_acs_namespace': {'key': 'properties.createACSNamespace', 'type': 'bool'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + status: Optional[Union[str, "NamespaceState"]] = None, + create_acs_namespace: Optional[bool] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(NamespaceResource, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.status = status + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.create_acs_namespace = create_acs_namespace + self.enabled = enabled + + +class NamespaceUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Patch Namespace operation. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The sku of the created namespace. + :type sku: ~azure.mgmt.servicebus.v2015_08_01.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + super(NamespaceUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2015_08_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2015_08_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class QueueCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Queue operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Queue name. + :type name: str + :param location: Required. location of the resource. + :type location: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name: Optional[str] = None, + lock_duration: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + max_delivery_count: Optional[int] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(QueueCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = name + self.location = location + self.lock_duration = lock_duration + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.is_anonymous_accessible = is_anonymous_accessible + self.max_delivery_count = max_delivery_count + self.max_size_in_megabytes = max_size_in_megabytes + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.size_in_bytes = None + self.status = status + self.support_ordering = support_ordering + self.updated_at = None + + +class QueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.QueueResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QueueResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["QueueResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(QueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QueueResource(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param lock_duration: The duration of a peek-lock; that is, the amount of time that the message + is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default + value is 1 minute. + :type lock_duration: str + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: the TimeSpan idle interval after which the queue is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the queue. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: The default message time to live value. This is the + duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: A value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param is_anonymous_accessible: A value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. + :type max_delivery_count: int + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. + :type max_size_in_megabytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :param support_ordering: A value that indicates whether the queue supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + lock_duration: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + max_delivery_count: Optional[int] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(QueueResource, self).__init__(location=location, **kwargs) + self.lock_duration = lock_duration + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.is_anonymous_accessible = is_anonymous_accessible + self.max_delivery_count = max_delivery_count + self.max_size_in_megabytes = max_size_in_megabytes + self.message_count = None + self.count_details = None + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.size_in_bytes = None + self.status = status + self.support_ordering = support_ordering + self.updated_at = None + + +class RegenerateKeysParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation. + + :param policykey: Key that needs to be regenerated. Possible values include: "PrimaryKey", + "SecondaryKey". + :type policykey: str or ~azure.mgmt.servicebus.v2015_08_01.models.Policykey + """ + + _attribute_map = { + 'policykey': {'key': 'Policykey', 'type': 'str'}, + } + + def __init__( + self, + *, + policykey: Optional[Union[str, "Policykey"]] = None, + **kwargs + ): + super(RegenerateKeysParameters, self).__init__(**kwargs) + self.policykey = policykey + + +class ResourceListKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + :param primary_connection_string: Primary connection string of the created namespace + authorization rule. + :type primary_connection_string: str + :param secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :type secondary_connection_string: str + :param primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type primary_key: str + :param secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :type secondary_key: str + :param key_name: A string that describes the authorization rule. + :type key_name: str + """ + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + *, + primary_connection_string: Optional[str] = None, + secondary_connection_string: Optional[str] = None, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + key_name: Optional[str] = None, + **kwargs + ): + super(ResourceListKeys, self).__init__(**kwargs) + self.primary_connection_string = primary_connection_string + self.secondary_connection_string = secondary_connection_string + self.primary_key = primary_key + self.secondary_key = secondary_key + self.key_name = key_name + + +class SharedAccessAuthorizationRuleCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Authorization Rules operation. + + :param location: data center location. + :type location: str + :param name: Name of the authorization rule. + :type name: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + name: Optional[str] = None, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.name = name + self.rights = rights + + +class SharedAccessAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: + list[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessAuthorizationRuleResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessAuthorizationRuleResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SharedAccessAuthorizationRuleResource(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2015_08_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SharedAccessAuthorizationRuleResource, self).__init__(location=location, **kwargs) + self.rights = rights + + +class Sku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Name of this SKU. Possible values include: "Basic", "Standard", "Premium". + :type name: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuName + :param tier: Required. The billing tier of this particular SKU. Possible values include: + "Basic", "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2015_08_01.models.SkuTier + :param capacity: The specified messaging units for the tier. + :type capacity: int + """ + + _validation = { + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + tier: Union[str, "SkuTier"], + name: Optional[Union[str, "SkuName"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SubscriptionCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Subscription operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Subscription data center location. + :type location: str + :param type: Resource manager type of the resource. + :type type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + type: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + default_message_time_to_live: Optional[str] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_batched_operations: Optional[bool] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + is_read_only: Optional[bool] = None, + lock_duration: Optional[str] = None, + max_delivery_count: Optional[int] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + **kwargs + ): + super(SubscriptionCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.type = type + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.count_details = None + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_batched_operations = enable_batched_operations + self.entity_availability_status = entity_availability_status + self.is_read_only = is_read_only + self.lock_duration = lock_duration + self.max_delivery_count = max_delivery_count + self.message_count = None + self.requires_session = requires_session + self.status = status + self.updated_at = None + + +class SubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SubscriptionResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SubscriptionResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SubscriptionResource(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :param is_read_only: Value that indicates whether the entity description is read-only. + :type is_read_only: bool + :param lock_duration: The lock duration time span for the subscription. + :type lock_duration: str + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :ivar message_count: Number of messages. + :vartype message_count: long + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'message_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'is_read_only': {'key': 'properties.isReadOnly', 'type': 'bool'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'str'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + default_message_time_to_live: Optional[str] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + enable_batched_operations: Optional[bool] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + is_read_only: Optional[bool] = None, + lock_duration: Optional[str] = None, + max_delivery_count: Optional[int] = None, + requires_session: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + **kwargs + ): + super(SubscriptionResource, self).__init__(location=location, **kwargs) + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.count_details = None + self.created_at = None + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.enable_batched_operations = enable_batched_operations + self.entity_availability_status = entity_availability_status + self.is_read_only = is_read_only + self.lock_duration = lock_duration + self.max_delivery_count = max_delivery_count + self.message_count = None + self.requires_session = requires_session + self.status = status + self.updated_at = None + + +class TopicCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters supplied to the Create Or Update Topic operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Topic name. + :type name: str + :param location: Required. Location of the resource. + :type location: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'location': {'required': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + name: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + filtering_messages_before_publishing: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + is_express: Optional[bool] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(TopicCreateOrUpdateParameters, self).__init__(**kwargs) + self.name = name + self.location = location + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.filtering_messages_before_publishing = filtering_messages_before_publishing + self.is_anonymous_accessible = is_anonymous_accessible + self.is_express = is_express + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.size_in_bytes = None + self.status = status + self.subscription_count = None + self.support_ordering = support_ordering + self.updated_at = None + + +class TopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2015_08_01.models.TopicResource] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TopicResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["TopicResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(TopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TopicResource(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :param location: Resource location. + :type location: str + :ivar type: Resource type. + :vartype type: str + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :param auto_delete_on_idle: TimeSpan idle interval after which the topic is automatically + deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: str + :param entity_availability_status: Entity availability status for the topic. Possible values + include: "Available", "Limited", "Renaming", "Restoring", "Unknown". + :type entity_availability_status: str or + ~azure.mgmt.servicebus.v2015_08_01.models.EntityAvailabilityStatus + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2015_08_01.models.MessageCountDetails + :param default_message_time_to_live: Default message time to live value. This is the duration + after which the message expires, starting from when the message is sent to Service Bus. This is + the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: str + :param duplicate_detection_history_time_window: TimeSpan structure that defines the duration of + the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: str + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param filtering_messages_before_publishing: Whether messages should be filtered before + publishing. + :type filtering_messages_before_publishing: bool + :param is_anonymous_accessible: Value that indicates whether the message is accessible + anonymously. + :type is_anonymous_accessible: bool + :param is_express: + :type is_express: bool + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. + :type max_size_in_megabytes: long + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Creating", "Deleting", "Disabled", "ReceiveDisabled", "Renaming", + "Restoring", "SendDisabled", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2015_08_01.models.EntityStatus + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'created_at': {'readonly': True}, + 'count_details': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'str'}, + 'entity_availability_status': {'key': 'properties.entityAvailabilityStatus', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'str'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'filtering_messages_before_publishing': {'key': 'properties.filteringMessagesBeforePublishing', 'type': 'bool'}, + 'is_anonymous_accessible': {'key': 'properties.isAnonymousAccessible', 'type': 'bool'}, + 'is_express': {'key': 'properties.isExpress', 'type': 'bool'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'long'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + auto_delete_on_idle: Optional[str] = None, + entity_availability_status: Optional[Union[str, "EntityAvailabilityStatus"]] = None, + default_message_time_to_live: Optional[str] = None, + duplicate_detection_history_time_window: Optional[str] = None, + enable_batched_operations: Optional[bool] = None, + enable_express: Optional[bool] = None, + enable_partitioning: Optional[bool] = None, + filtering_messages_before_publishing: Optional[bool] = None, + is_anonymous_accessible: Optional[bool] = None, + is_express: Optional[bool] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + **kwargs + ): + super(TopicResource, self).__init__(location=location, **kwargs) + self.accessed_at = None + self.auto_delete_on_idle = auto_delete_on_idle + self.entity_availability_status = entity_availability_status + self.created_at = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.enable_express = enable_express + self.enable_partitioning = enable_partitioning + self.filtering_messages_before_publishing = filtering_messages_before_publishing + self.is_anonymous_accessible = is_anonymous_accessible + self.is_express = is_express + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.size_in_bytes = None + self.status = status + self.subscription_count = None + self.support_ordering = support_ordering + self.updated_at = None diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py new file mode 100644 index 000000000000..e6b495d5c78a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_service_bus_management_client_enums.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class EntityAvailabilityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity availability status. + """ + + AVAILABLE = "Available" + LIMITED = "Limited" + RENAMING = "Renaming" + RESTORING = "Restoring" + UNKNOWN = "Unknown" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + CREATING = "Creating" + DELETING = "Deleting" + DISABLED = "Disabled" + RECEIVE_DISABLED = "ReceiveDisabled" + RENAMING = "Renaming" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + UNKNOWN = "Unknown" + +class NamespaceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the namespace. + """ + + UNKNOWN = "Unknown" + CREATING = "Creating" + CREATED = "Created" + ACTIVATING = "Activating" + ENABLING = "Enabling" + ACTIVE = "Active" + DISABLING = "Disabling" + DISABLED = "Disabled" + SOFT_DELETING = "SoftDeleting" + SOFT_DELETED = "SoftDeleted" + REMOVING = "Removing" + REMOVED = "Removed" + FAILED = "Failed" + +class Policykey(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Key that needs to be regenerated. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py new file mode 100644 index 000000000000..7acd03e6343c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/__init__.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'Operations', + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py new file mode 100644 index 000000000000..c8d403dde987 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py @@ -0,0 +1,1019 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NamespaceResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NamespaceResource"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either NamespaceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NamespaceResource" + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NamespaceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.NamespaceResource"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NamespaceResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.NamespaceResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.NamespaceResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('NamespaceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py new file mode 100644 index 000000000000..5815ac6a0236 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py new file mode 100644 index 000000000000..8d2009db92b9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_queues_operations.py @@ -0,0 +1,805 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.QueueListResult"] + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.QueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('QueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.QueueCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.QueueResource" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.QueueCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'QueueCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.QueueResource" + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QueueResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.QueueResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QueueResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QueueResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def post_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..b8ce3a8356e8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_subscriptions_operations.py @@ -0,0 +1,329 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SubscriptionCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionResource" + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SubscriptionCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SubscriptionResource" + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SubscriptionResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SubscriptionResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SubscriptionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py new file mode 100644 index 000000000000..32b70acb162b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_topics_operations.py @@ -0,0 +1,805 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2015_08_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_all( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TopicListResult"] + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.TopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.TopicCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.TopicResource" + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.TopicCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'TopicCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TopicResource" + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TopicResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.TopicResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TopicResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TopicResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SharedAccessAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SharedAccessAuthorizationRuleCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SharedAccessAuthorizationRuleCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def post_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.post_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessAuthorizationRuleResource" + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessAuthorizationRuleResource, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.SharedAccessAuthorizationRuleResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessAuthorizationRuleResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SharedAccessAuthorizationRuleResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateKeysParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceListKeys" + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2015_08_01.models.RegenerateKeysParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2015_08_01.models.ResourceListKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2015-08-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateKeysParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceListKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py new file mode 100644 index 000000000000..f640dac181bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py new file mode 100644 index 000000000000..dd6725ed87ec --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2017-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json new file mode 100644 index 000000000000..f5b275a5417b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2017-04-01", + "total_api_version_list": ["2017-04-01"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "event_hubs": "EventHubsOperations", + "migration_configs": "MigrationConfigsOperations", + "operations": "Operations", + "premium_messaging_regions": "PremiumMessagingRegionsOperations", + "rules": "RulesOperations", + "regions": "RegionsOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py new file mode 100644 index 000000000000..21dce75ea7b8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/_service_bus_management_client.py @@ -0,0 +1,139 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import Operations +from .operations import PremiumMessagingRegionsOperations +from .operations import RulesOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2017_04_01.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2017_04_01.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2017_04_01.operations.TopicsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2017_04_01.operations.DisasterRecoveryConfigsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2017_04_01.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2017_04_01.operations.MigrationConfigsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2017_04_01.operations.Operations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2017_04_01.operations.PremiumMessagingRegionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2017_04_01.operations.RulesOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2017_04_01.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py new file mode 100644 index 000000000000..9016cbc21795 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py new file mode 100644 index 000000000000..8ae5c045a460 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2017-04-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py new file mode 100644 index 000000000000..ecfea0af33bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/_service_bus_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import Operations +from .operations import PremiumMessagingRegionsOperations +from .operations import RulesOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2017_04_01.aio.operations.NamespacesOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2017_04_01.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2017_04_01.aio.operations.TopicsOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2017_04_01.aio.operations.DisasterRecoveryConfigsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2017_04_01.aio.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2017_04_01.aio.operations.MigrationConfigsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2017_04_01.aio.operations.Operations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2017_04_01.aio.operations.PremiumMessagingRegionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2017_04_01.aio.operations.RulesOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2017_04_01.aio.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2017_04_01.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py new file mode 100644 index 000000000000..0a2e6926c109 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._operations import Operations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._rules_operations import RulesOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'DisasterRecoveryConfigsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'Operations', + 'PremiumMessagingRegionsOperations', + 'RulesOperations', + 'RegionsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..b4b2633565f9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,714 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..a1e0e4fd626d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_event_hubs_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations: + """EventHubsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubListResult"]: + """Gets all the Event Hubs in a service bus Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..7d56babaabd9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..d5f3fa0e9e1d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_namespaces_operations.py @@ -0,0 +1,1282 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + async def migrate( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceMigrate", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py new file mode 100644 index 000000000000..169c562ac22c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py new file mode 100644 index 000000000000..dbb42428bfbc --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations: + """PremiumMessagingRegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py new file mode 100644 index 000000000000..b832d1386831 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py new file mode 100644 index 000000000000..a58e648745fd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_regions_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations: + """RegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku: str, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py new file mode 100644 index 000000000000..7e3556bb8350 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..57683192fad1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..6bed7e1e9734 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py new file mode 100644 index 000000000000..80f9a1628e4d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/__init__.py @@ -0,0 +1,191 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessKeys + from ._models_py3 import Action + from ._models_py3 import ArmDisasterRecovery + from ._models_py3 import ArmDisasterRecoveryListResult + from ._models_py3 import CaptureDescription + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CorrelationFilter + from ._models_py3 import Destination + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseError + from ._models_py3 import EventHubListResult + from ._models_py3 import Eventhub + from ._models_py3 import MessageCountDetails + from ._models_py3 import MigrationConfigListResult + from ._models_py3 import MigrationConfigProperties + from ._models_py3 import NWRuleSetIpRules + from ._models_py3 import NWRuleSetVirtualNetworkRules + from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PremiumMessagingRegions + from ._models_py3 import PremiumMessagingRegionsListResult + from ._models_py3 import PremiumMessagingRegionsProperties + from ._models_py3 import RegenerateAccessKeyParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceNamespacePatch + from ._models_py3 import Rule + from ._models_py3 import RuleListResult + from ._models_py3 import SBAuthorizationRule + from ._models_py3 import SBAuthorizationRuleListResult + from ._models_py3 import SBNamespace + from ._models_py3 import SBNamespaceListResult + from ._models_py3 import SBNamespaceMigrate + from ._models_py3 import SBNamespaceUpdateParameters + from ._models_py3 import SBQueue + from ._models_py3 import SBQueueListResult + from ._models_py3 import SBSku + from ._models_py3 import SBSubscription + from ._models_py3 import SBSubscriptionListResult + from ._models_py3 import SBTopic + from ._models_py3 import SBTopicListResult + from ._models_py3 import SqlFilter + from ._models_py3 import SqlRuleAction + from ._models_py3 import Subnet + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import Action # type: ignore + from ._models import ArmDisasterRecovery # type: ignore + from ._models import ArmDisasterRecoveryListResult # type: ignore + from ._models import CaptureDescription # type: ignore + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CorrelationFilter # type: ignore + from ._models import Destination # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import EventHubListResult # type: ignore + from ._models import Eventhub # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import MigrationConfigListResult # type: ignore + from ._models import MigrationConfigProperties # type: ignore + from ._models import NWRuleSetIpRules # type: ignore + from ._models import NWRuleSetVirtualNetworkRules # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PremiumMessagingRegions # type: ignore + from ._models import PremiumMessagingRegionsListResult # type: ignore + from ._models import PremiumMessagingRegionsProperties # type: ignore + from ._models import RegenerateAccessKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceNamespacePatch # type: ignore + from ._models import Rule # type: ignore + from ._models import RuleListResult # type: ignore + from ._models import SBAuthorizationRule # type: ignore + from ._models import SBAuthorizationRuleListResult # type: ignore + from ._models import SBNamespace # type: ignore + from ._models import SBNamespaceListResult # type: ignore + from ._models import SBNamespaceMigrate # type: ignore + from ._models import SBNamespaceUpdateParameters # type: ignore + from ._models import SBQueue # type: ignore + from ._models import SBQueueListResult # type: ignore + from ._models import SBSku # type: ignore + from ._models import SBSubscription # type: ignore + from ._models import SBSubscriptionListResult # type: ignore + from ._models import SBTopic # type: ignore + from ._models import SBTopicListResult # type: ignore + from ._models import SqlFilter # type: ignore + from ._models import SqlRuleAction # type: ignore + from ._models import Subnet # type: ignore + from ._models import TrackedResource # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + DefaultAction, + EncodingCaptureDescription, + EntityStatus, + FilterType, + KeyType, + MigrationConfigurationName, + NameSpaceType, + NetworkRuleIPAction, + ProvisioningStateDR, + RoleDisasterRecovery, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'AccessKeys', + 'Action', + 'ArmDisasterRecovery', + 'ArmDisasterRecoveryListResult', + 'CaptureDescription', + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'CorrelationFilter', + 'Destination', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ErrorResponseError', + 'EventHubListResult', + 'Eventhub', + 'MessageCountDetails', + 'MigrationConfigListResult', + 'MigrationConfigProperties', + 'NWRuleSetIpRules', + 'NWRuleSetVirtualNetworkRules', + 'NetworkRuleSet', + 'NetworkRuleSetListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PremiumMessagingRegions', + 'PremiumMessagingRegionsListResult', + 'PremiumMessagingRegionsProperties', + 'RegenerateAccessKeyParameters', + 'Resource', + 'ResourceNamespacePatch', + 'Rule', + 'RuleListResult', + 'SBAuthorizationRule', + 'SBAuthorizationRuleListResult', + 'SBNamespace', + 'SBNamespaceListResult', + 'SBNamespaceMigrate', + 'SBNamespaceUpdateParameters', + 'SBQueue', + 'SBQueueListResult', + 'SBSku', + 'SBSubscription', + 'SBSubscriptionListResult', + 'SBTopic', + 'SBTopicListResult', + 'SqlFilter', + 'SqlRuleAction', + 'Subnet', + 'TrackedResource', + 'AccessRights', + 'DefaultAction', + 'EncodingCaptureDescription', + 'EntityStatus', + 'FilterType', + 'KeyType', + 'MigrationConfigurationName', + 'NameSpaceType', + 'NetworkRuleIPAction', + 'ProvisioningStateDR', + 'RoleDisasterRecovery', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py new file mode 100644 index 000000000000..9d8d819f83a4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models.py @@ -0,0 +1,2057 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2017_04_01.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2017_04_01.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class CaptureDescription(msrest.serialization.Model): + """Properties to configure capture description for eventhub. + + :param enabled: A value that indicates whether capture description is enabled. + :type enabled: bool + :param encoding: Enumerates the possible values for the encoding format of capture description. + Possible values include: "Avro", "AvroDeflate". + :type encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription + :param interval_in_seconds: The time window allows you to set the frequency with which the + capture to Azure Blobs will happen, value should between 60 to 900 seconds. + :type interval_in_seconds: int + :param size_limit_in_bytes: The size window defines the amount of data built up in your Event + Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + :type size_limit_in_bytes: int + :param destination: Properties of Destination where capture will be stored. (Storage Account, + Blob Names). + :type destination: ~azure.mgmt.servicebus.v2017_04_01.models.Destination + """ + + _validation = { + 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, + 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + } + + def __init__( + self, + **kwargs + ): + super(CaptureDescription, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.encoding = kwargs.get('encoding', None) + self.interval_in_seconds = kwargs.get('interval_in_seconds', None) + self.size_limit_in_bytes = kwargs.get('size_limit_in_bytes', None) + self.destination = kwargs.get('destination', None) + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.correlation_id = kwargs.get('correlation_id', None) + self.message_id = kwargs.get('message_id', None) + self.to = kwargs.get('to', None) + self.reply_to = kwargs.get('reply_to', None) + self.label = kwargs.get('label', None) + self.session_id = kwargs.get('session_id', None) + self.reply_to_session_id = kwargs.get('reply_to_session_id', None) + self.content_type = kwargs.get('content_type', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Destination(msrest.serialization.Model): + """Capture storage details for capture description. + + :param name: Name for capture destination. + :type name: str + :param storage_account_resource_id: Resource id of the storage account to be used to create the + blobs. + :type storage_account_resource_id: str + :param blob_container: Blob container Name. + :type blob_container: str + :param archive_name_format: Blob naming convention for archive, e.g. + {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all + the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + :type archive_name_format: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, + 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Destination, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) + self.blob_container = kwargs.get('blob_container', None) + self.archive_name_format = kwargs.get('archive_name_format', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Eventhub(Resource): + """Single item in List or Get Event Hub operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar partition_ids: Current number of shards on the Event Hub. + :vartype partition_ids: list[str] + :ivar created_at: Exact time the Event Hub was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :param message_retention_in_days: Number of days to retain the events for this Event Hub, value + should be 1 to 7 days. + :type message_retention_in_days: long + :param partition_count: Number of partitions created for the Event Hub, allowed values are from + 1 to 32 partitions. + :type partition_count: long + :param status: Enumerates the possible values for the status of a Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, + 'partition_count': {'maximum': 32, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + } + + def __init__( + self, + **kwargs + ): + super(Eventhub, self).__init__(**kwargs) + self.partition_ids = None + self.created_at = None + self.updated_at = None + self.message_retention_in_days = kwargs.get('message_retention_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.status = kwargs.get('status', None) + self.capture_description = kwargs.get('capture_description', None) + + +class EventHubListResult(msrest.serialization.Model): + """The result of the List EventHubs operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Eventhub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = kwargs.get('target_namespace', None) + self.post_migration_name = kwargs.get('post_migration_name', None) + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.ip_rules = kwargs.get('ip_rules', None) + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = kwargs.get('ip_mask', None) + self.action = kwargs.get('action', "Allow") + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2017_04_01.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = kwargs.get('subnet', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2017_04_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class PremiumMessagingRegions(ResourceNamespacePatch): + """Premium Messaging Region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: + :type properties: ~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegions, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class PremiumMessagingRegionsListResult(msrest.serialization.Model): + """The response of the List PremiumMessagingRegions operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List PremiumMessagingRegions type. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of PremiumMessagingRegions. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PremiumMessagingRegionsProperties(msrest.serialization.Model): + """PremiumMessagingRegionsProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Region code. + :vartype code: str + :ivar full_name: Full name of the region. + :vartype full_name: str + """ + + _validation = { + 'code': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + self.key = kwargs.get('key', None) + + +class Rule(Resource): + """Description of Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2017_04_01.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2017_04_01.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.action = kwargs.get('action', None) + self.filter_type = kwargs.get('filter_type', None) + self.sql_filter = kwargs.get('sql_filter', None) + self.correlation_filter = kwargs.get('correlation_filter', None) + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2017_04_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespace, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBNamespaceMigrate(msrest.serialization.Model): + """Namespace Migrate Object. + + All required parameters must be populated in order to send to Azure. + + :param target_namespace_type: Required. Type of namespaces. Possible values include: + "Messaging", "NotificationHub", "Mixed", "EventHub", "Relay". + :type target_namespace_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = kwargs['target_namespace_type'] + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBQueue(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = kwargs.get('lock_duration', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class SBSubscription(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = kwargs.get('lock_duration', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBTopic(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', 20) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlRuleAction, self).__init__(**kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = kwargs['id'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py new file mode 100644 index 000000000000..cc7755aaf875 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_models_py3.py @@ -0,0 +1,2231 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2017_04_01.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2017_04_01.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + *, + partner_namespace: Optional[str] = None, + alternate_name: Optional[str] = None, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArmDisasterRecovery"]] = None, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CaptureDescription(msrest.serialization.Model): + """Properties to configure capture description for eventhub. + + :param enabled: A value that indicates whether capture description is enabled. + :type enabled: bool + :param encoding: Enumerates the possible values for the encoding format of capture description. + Possible values include: "Avro", "AvroDeflate". + :type encoding: str or ~azure.mgmt.servicebus.v2017_04_01.models.EncodingCaptureDescription + :param interval_in_seconds: The time window allows you to set the frequency with which the + capture to Azure Blobs will happen, value should between 60 to 900 seconds. + :type interval_in_seconds: int + :param size_limit_in_bytes: The size window defines the amount of data built up in your Event + Hub before an capture operation, value should be between 10485760 and 524288000 bytes. + :type size_limit_in_bytes: int + :param destination: Properties of Destination where capture will be stored. (Storage Account, + Blob Names). + :type destination: ~azure.mgmt.servicebus.v2017_04_01.models.Destination + """ + + _validation = { + 'interval_in_seconds': {'maximum': 900, 'minimum': 60}, + 'size_limit_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + encoding: Optional[Union[str, "EncodingCaptureDescription"]] = None, + interval_in_seconds: Optional[int] = None, + size_limit_in_bytes: Optional[int] = None, + destination: Optional["Destination"] = None, + **kwargs + ): + super(CaptureDescription, self).__init__(**kwargs) + self.enabled = enabled + self.encoding = encoding + self.interval_in_seconds = interval_in_seconds + self.size_limit_in_bytes = size_limit_in_bytes + self.destination = destination + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2017_04_01.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + correlation_id: Optional[str] = None, + message_id: Optional[str] = None, + to: Optional[str] = None, + reply_to: Optional[str] = None, + label: Optional[str] = None, + session_id: Optional[str] = None, + reply_to_session_id: Optional[str] = None, + content_type: Optional[str] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = properties + self.correlation_id = correlation_id + self.message_id = message_id + self.to = to + self.reply_to = reply_to + self.label = label + self.session_id = session_id + self.reply_to_session_id = reply_to_session_id + self.content_type = content_type + self.requires_preprocessing = requires_preprocessing + + +class Destination(msrest.serialization.Model): + """Capture storage details for capture description. + + :param name: Name for capture destination. + :type name: str + :param storage_account_resource_id: Resource id of the storage account to be used to create the + blobs. + :type storage_account_resource_id: str + :param blob_container: Blob container Name. + :type blob_container: str + :param archive_name_format: Blob naming convention for archive, e.g. + {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all + the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order. + :type archive_name_format: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'blob_container': {'key': 'properties.blobContainer', 'type': 'str'}, + 'archive_name_format': {'key': 'properties.archiveNameFormat', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + blob_container: Optional[str] = None, + archive_name_format: Optional[str] = None, + **kwargs + ): + super(Destination, self).__init__(**kwargs) + self.name = name + self.storage_account_resource_id = storage_account_resource_id + self.blob_container = blob_container + self.archive_name_format = archive_name_format + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseError"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.servicebus.v2017_04_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class Eventhub(Resource): + """Single item in List or Get Event Hub operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar partition_ids: Current number of shards on the Event Hub. + :vartype partition_ids: list[str] + :ivar created_at: Exact time the Event Hub was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :param message_retention_in_days: Number of days to retain the events for this Event Hub, value + should be 1 to 7 days. + :type message_retention_in_days: long + :param partition_count: Number of partitions created for the Event Hub, allowed values are from + 1 to 32 partitions. + :type partition_count: long + :param status: Enumerates the possible values for the status of a Event Hub. Possible values + include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", + "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param capture_description: Properties of capture description. + :type capture_description: ~azure.mgmt.servicebus.v2017_04_01.models.CaptureDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'partition_ids': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'message_retention_in_days': {'maximum': 7, 'minimum': 1}, + 'partition_count': {'maximum': 32, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'partition_ids': {'key': 'properties.partitionIds', 'type': '[str]'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'message_retention_in_days': {'key': 'properties.messageRetentionInDays', 'type': 'long'}, + 'partition_count': {'key': 'properties.partitionCount', 'type': 'long'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + } + + def __init__( + self, + *, + message_retention_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + capture_description: Optional["CaptureDescription"] = None, + **kwargs + ): + super(Eventhub, self).__init__(**kwargs) + self.partition_ids = None + self.created_at = None + self.updated_at = None + self.message_retention_in_days = message_retention_in_days + self.partition_count = partition_count + self.status = status + self.capture_description = capture_description + + +class EventHubListResult(msrest.serialization.Model): + """The result of the List EventHubs operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List EventHubs operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Eventhub] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of EventHubs. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Eventhub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Eventhub"]] = None, + **kwargs + ): + super(EventHubListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MigrationConfigProperties"]] = None, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace: Optional[str] = None, + post_migration_name: Optional[str] = None, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = target_namespace + self.post_migration_name = post_migration_name + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2017_04_01.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2017_04_01.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + *, + default_action: Optional[Union[str, "DefaultAction"]] = None, + virtual_network_rules: Optional[List["NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["NWRuleSetIpRules"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2017_04_01.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + subnet: Optional["Subnet"] = None, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = subnet + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2017_04_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2017_04_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class PremiumMessagingRegions(ResourceNamespacePatch): + """Premium Messaging Region. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: + :type properties: ~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'PremiumMessagingRegionsProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["PremiumMessagingRegionsProperties"] = None, + **kwargs + ): + super(PremiumMessagingRegions, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + + +class PremiumMessagingRegionsListResult(msrest.serialization.Model): + """The response of the List PremiumMessagingRegions operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Result of the List PremiumMessagingRegions type. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegions] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of PremiumMessagingRegions. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PremiumMessagingRegions]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PremiumMessagingRegions"]] = None, + **kwargs + ): + super(PremiumMessagingRegionsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PremiumMessagingRegionsProperties(msrest.serialization.Model): + """PremiumMessagingRegionsProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Region code. + :vartype code: str + :ivar full_name: Full name of the region. + :vartype full_name: str + """ + + _validation = { + 'code': {'readonly': True}, + 'full_name': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PremiumMessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "KeyType"], + key: Optional[str] = None, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + self.key = key + + +class Rule(Resource): + """Description of Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2017_04_01.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2017_04_01.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2017_04_01.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + *, + action: Optional["Action"] = None, + filter_type: Optional[Union[str, "FilterType"]] = None, + sql_filter: Optional["SqlFilter"] = None, + correlation_filter: Optional["CorrelationFilter"] = None, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.action = action + self.filter_type = filter_type + self.sql_filter = sql_filter + self.correlation_filter = correlation_filter + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Rule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2017_04_01.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.rights = rights + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBAuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + **kwargs + ): + super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBNamespaceMigrate(msrest.serialization.Model): + """Namespace Migrate Object. + + All required parameters must be populated in order to send to Azure. + + :param target_namespace_type: Required. Type of namespaces. Possible values include: + "Messaging", "NotificationHub", "Mixed", "EventHub", "Relay". + :type target_namespace_type: str or ~azure.mgmt.servicebus.v2017_04_01.models.NameSpaceType + """ + + _validation = { + 'target_namespace_type': {'required': True}, + } + + _attribute_map = { + 'target_namespace_type': {'key': 'targetNamespaceType', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace_type: Union[str, "NameSpaceType"], + **kwargs + ): + super(SBNamespaceMigrate, self).__init__(**kwargs) + self.target_namespace_type = target_namespace_type + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of Sku. + :type sku: ~azure.mgmt.servicebus.v2017_04_01.models.SBSku + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + + +class SBQueue(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = lock_duration + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBQueue"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2017_04_01.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + tier: Optional[Union[str, "SkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SBSubscription(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = lock_duration + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBSubscription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBTopic(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2017_04_01.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2017_04_01.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_message_time_to_live: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + enable_batched_operations: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.status = status + self.support_ordering = support_ordering + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2017_04_01.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = 20, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = id diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py new file mode 100644 index 000000000000..0d0adb0e71cd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/models/_service_bus_management_client_enums.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EncodingCaptureDescription(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the possible values for the encoding format of capture description. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + +class FilterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rule filter types + """ + + SQL_FILTER = "SqlFilter" + CORRELATION_FILTER = "CorrelationFilter" + +class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The access key to regenerate. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class MigrationConfigurationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + _DEFAULT = "$default" + +class NameSpaceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of namespaces + """ + + MESSAGING = "Messaging" + NOTIFICATION_HUB = "NotificationHub" + MIXED = "Mixed" + EVENT_HUB = "EventHub" + RELAY = "Relay" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The IP Filter Action + """ + + ALLOW = "Allow" + +class ProvisioningStateDR(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' + or 'Succeeded' or 'Failed' + """ + + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class RoleDisasterRecovery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or + 'Secondary' + """ + + PRIMARY = "Primary" + PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" + SECONDARY = "Secondary" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py new file mode 100644 index 000000000000..0a2e6926c109 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._operations import Operations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._rules_operations import RulesOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'QueuesOperations', + 'TopicsOperations', + 'DisasterRecoveryConfigsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'Operations', + 'PremiumMessagingRegionsOperations', + 'RulesOperations', + 'RegionsOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..d9faa08e2c17 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,728 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations(object): + """DisasterRecoveryConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArmDisasterRecoveryListResult"] + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters, # type: "_models.ArmDisasterRecovery" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ArmDisasterRecovery"] + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArmDisasterRecovery" + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def break_pairing( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + def fail_over( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py index 78ba3b0e8702..907b14a4edcc 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_event_hubs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_event_hubs_operations.py @@ -30,7 +30,7 @@ class EventHubsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,7 +60,7 @@ def list_by_namespace( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EventHubListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.EventHubListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.EventHubListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py similarity index 93% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py index 78a06e45cfb4..a7074101ba36 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_migration_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_migration_configs_operations.py @@ -32,7 +32,7 @@ class MigrationConfigsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.MigrationConfigListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -169,7 +169,7 @@ def _create_and_start_migration_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -199,17 +199,17 @@ def begin_create_and_start_migration( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :param parameters: Parameters required to create Migration Configuration. - :type parameters: ~azure.mgmt.servicebus.models.MigrationConfigProperties + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -275,7 +275,7 @@ def delete( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -313,7 +313,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -336,10 +336,10 @@ def get( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: MigrationConfigProperties, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.MigrationConfigProperties + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigProperties :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] @@ -374,7 +374,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) @@ -402,7 +402,7 @@ def complete_migration( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -440,7 +440,7 @@ def complete_migration( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -463,7 +463,7 @@ def revert( :param namespace_name: The namespace name. :type namespace_name: str :param config_name: The configuration name. Should always be "$default". - :type config_name: str or ~azure.mgmt.servicebus.models.MigrationConfigurationName + :type config_name: str or ~azure.mgmt.servicebus.v2017_04_01.models.MigrationConfigurationName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -501,7 +501,7 @@ def revert( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py new file mode 100644 index 000000000000..ecc0fd2f131e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_namespaces_operations.py @@ -0,0 +1,1305 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + def migrate( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceMigrate" + **kwargs # type: Any + ): + # type: (...) -> None + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SBNamespace"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBNamespace" + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py new file mode 100644 index 000000000000..67226cdd2f80 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2017_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py index 918d9302c34b..a023c43b81d7 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_premium_messaging_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_premium_messaging_regions_operations.py @@ -30,7 +30,7 @@ class PremiumMessagingRegionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PremiumMessagingRegionsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] @@ -102,7 +102,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py index 952570b91ae9..b26b3e0d860d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_queues_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_queues_operations.py @@ -30,7 +30,7 @@ class QueuesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def list_authorization_rules( :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -114,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -146,10 +146,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -190,7 +190,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -258,7 +258,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -287,7 +287,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -323,7 +323,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -355,7 +355,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -391,7 +391,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -423,10 +423,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -467,7 +467,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -501,7 +501,7 @@ def list_by_namespace( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBQueueListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBQueueListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBQueueListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] @@ -555,7 +555,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -584,10 +584,10 @@ def create_or_update( :param queue_name: The queue name. :type queue_name: str :param parameters: Parameters supplied to create or update a queue resource. - :type parameters: ~azure.mgmt.servicebus.models.SBQueue + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :keyword callable cls: A custom type or function that will be passed the direct response :return: SBQueue, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBQueue + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] @@ -627,7 +627,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBQueue', pipeline_response) @@ -691,7 +691,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -717,7 +717,7 @@ def get( :type queue_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBQueue, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBQueue + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBQueue :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] @@ -752,7 +752,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBQueue', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py index b10bb49c94e9..d51da019ed21 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_regions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_regions_operations.py @@ -30,7 +30,7 @@ class RegionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,7 +57,7 @@ def list_by_sku( :type sku: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PremiumMessagingRegionsListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.PremiumMessagingRegionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py similarity index 96% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py index d57a7c170c6b..6ac47885d166 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_rules_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_rules_operations.py @@ -30,7 +30,7 @@ class RulesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -74,7 +74,7 @@ def list_by_subscriptions( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.RuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.RuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] @@ -130,7 +130,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -165,10 +165,10 @@ def create_or_update( :param rule_name: The rule name. :type rule_name: str :param parameters: Parameters supplied to create a rule. - :type parameters: ~azure.mgmt.servicebus.models.Rule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :keyword callable cls: A custom type or function that will be passed the direct response :return: Rule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.Rule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] @@ -210,7 +210,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) @@ -282,7 +282,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -314,7 +314,7 @@ def get( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Rule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.Rule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.Rule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] @@ -351,7 +351,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Rule', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py index 5891897defaa..b936d1cb8a0c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_subscriptions_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_subscriptions_operations.py @@ -30,7 +30,7 @@ class SubscriptionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -71,7 +71,7 @@ def list_by_topic( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBSubscriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBSubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] @@ -126,7 +126,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -158,10 +158,10 @@ def create_or_update( :param subscription_name: The subscription name. :type subscription_name: str :param parameters: Parameters supplied to create a subscription resource. - :type parameters: ~azure.mgmt.servicebus.models.SBSubscription + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :keyword callable cls: A custom type or function that will be passed the direct response :return: SBSubscription, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBSubscription + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] @@ -202,7 +202,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBSubscription', pipeline_response) @@ -270,7 +270,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -299,7 +299,7 @@ def get( :type subscription_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBSubscription, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBSubscription + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBSubscription :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] @@ -335,7 +335,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBSubscription', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py index 6324fb4f3d4c..24d62f126806 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_topics_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/operations/_topics_operations.py @@ -30,7 +30,7 @@ class TopicsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2017_04_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -63,7 +63,7 @@ def list_authorization_rules( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -114,7 +114,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -146,10 +146,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -190,7 +190,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -222,7 +222,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -258,7 +258,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -326,7 +326,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,7 +355,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -391,7 +391,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -423,10 +423,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -467,7 +467,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -501,7 +501,7 @@ def list_by_namespace( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBTopicListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBTopicListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2017_04_01.models.SBTopicListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] @@ -555,7 +555,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -584,10 +584,10 @@ def create_or_update( :param topic_name: The topic name. :type topic_name: str :param parameters: Parameters supplied to create a topic resource. - :type parameters: ~azure.mgmt.servicebus.models.SBTopic + :type parameters: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :keyword callable cls: A custom type or function that will be passed the direct response :return: SBTopic, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBTopic + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] @@ -627,7 +627,7 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBTopic', pipeline_response) @@ -691,7 +691,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -717,7 +717,7 @@ def get( :type topic_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBTopic, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBTopic + :rtype: ~azure.mgmt.servicebus.v2017_04_01.models.SBTopic :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] @@ -752,7 +752,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBTopic', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2017_04_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py new file mode 100644 index 000000000000..f640dac181bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py new file mode 100644 index 000000000000..3c8784de1920 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json new file mode 100644 index 000000000000..0a3a5cced250 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_metadata.json @@ -0,0 +1,115 @@ +{ + "chosen_version": "2018-01-01-preview", + "total_api_version_list": ["2018-01-01-preview"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "event_hubs": "EventHubsOperations", + "migration_configs": "MigrationConfigsOperations", + "premium_messaging_regions": "PremiumMessagingRegionsOperations", + "regions": "RegionsOperations", + "subscriptions": "SubscriptionsOperations", + "rules": "RulesOperations", + "operations": "Operations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py new file mode 100644 index 000000000000..cdf7ad71819f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/_service_bus_management_client.py @@ -0,0 +1,149 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import PremiumMessagingRegionsOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .operations import RulesOperations +from .operations import Operations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2018_01_01_preview.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2018_01_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2018_01_01_preview.operations.PrivateLinkResourcesOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2018_01_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2018_01_01_preview.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2018_01_01_preview.operations.TopicsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2018_01_01_preview.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2018_01_01_preview.operations.MigrationConfigsOperations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2018_01_01_preview.operations.PremiumMessagingRegionsOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2018_01_01_preview.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2018_01_01_preview.operations.SubscriptionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.operations.RulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py new file mode 100644 index 000000000000..9016cbc21795 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..8adc3cc7abf8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py new file mode 100644 index 000000000000..b64408c38517 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/_service_bus_management_client.py @@ -0,0 +1,142 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import EventHubsOperations +from .operations import MigrationConfigsOperations +from .operations import PremiumMessagingRegionsOperations +from .operations import RegionsOperations +from .operations import SubscriptionsOperations +from .operations import RulesOperations +from .operations import Operations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace, IPFilter Rules, VirtualNetworkRules and Zone Redundant. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.DisasterRecoveryConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.TopicsOperations + :ivar event_hubs: EventHubsOperations operations + :vartype event_hubs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.EventHubsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.MigrationConfigsOperations + :ivar premium_messaging_regions: PremiumMessagingRegionsOperations operations + :vartype premium_messaging_regions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.PremiumMessagingRegionsOperations + :ivar regions: RegionsOperations operations + :vartype regions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.RegionsOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.SubscriptionsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.RulesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2018_01_01_preview.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.event_hubs = EventHubsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.premium_messaging_regions = PremiumMessagingRegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.regions = RegionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py similarity index 100% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py index 629acc6e01a4..d7920f85ee2c 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/__init__.py @@ -9,7 +9,6 @@ from ._namespaces_operations import NamespacesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._operations import Operations from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations from ._queues_operations import QueuesOperations from ._topics_operations import TopicsOperations @@ -19,12 +18,12 @@ from ._regions_operations import RegionsOperations from ._subscriptions_operations import SubscriptionsOperations from ._rules_operations import RulesOperations +from ._operations import Operations __all__ = [ 'NamespacesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', - 'Operations', 'DisasterRecoveryConfigsOperations', 'QueuesOperations', 'TopicsOperations', @@ -34,4 +33,5 @@ 'RegionsOperations', 'SubscriptionsOperations', 'RulesOperations', + 'Operations', ] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..84c77d671505 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,725 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional["_models.FailoverProperties"] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..da37d7f759ee --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_event_hubs_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations: + """EventHubsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubListResult"]: + """Gets all the Event Hubs in a service bus Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..0844d0922df0 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..7b474ace9b7a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_namespaces_operations.py @@ -0,0 +1,1820 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_ip_filter_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.IpFilterRuleListResult"]: + """Gets a list of IP Filter rules for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpFilterRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_ip_filter_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IpFilterRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_ip_filter_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules'} # type: ignore + + async def create_or_update_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + parameters: "_models.IpFilterRule", + **kwargs: Any + ) -> "_models.IpFilterRule": + """Creates or updates an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_rule_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_ip_filter_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'IpFilterRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IpFilterRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + async def delete_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an IpFilterRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_ip_filter_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + async def get_ip_filter_rule( + self, + resource_group_name: str, + namespace_name: str, + ip_filter_rule_name: str, + **kwargs: Any + ) -> "_models.IpFilterRule": + """Gets an IpFilterRule for a Namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param ip_filter_rule_name: The IP Filter Rule name. + :type ip_filter_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFilterRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_ip_filter_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'ipFilterRuleName': self._serialize.url("ip_filter_rule_name", ip_filter_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IpFilterRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def list_virtual_network_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualNetworkRuleListResult"]: + """Gets a list of VirtualNetwork rules for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_virtual_network_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualNetworkRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_virtual_network_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules'} # type: ignore + + async def create_or_update_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + parameters: "_models.VirtualNetworkRule", + **kwargs: Any + ) -> "_models.VirtualNetworkRule": + """Creates or updates an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_rule_name: str + :param parameters: The Namespace VirtualNetworkRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_virtual_network_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualNetworkRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + async def delete_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an VirtualNetworkRule for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_virtual_network_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + async def get_virtual_network_rule( + self, + resource_group_name: str, + namespace_name: str, + virtual_network_rule_name: str, + **kwargs: Any + ) -> "_models.VirtualNetworkRule": + """Gets an VirtualNetworkRule for a Namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualNetworkRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_virtual_network_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'virtualNetworkRuleName': self._serialize.url("virtual_network_rule_name", virtual_network_rule_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + async def migrate( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceMigrate", + **kwargs: Any + ) -> None: + """This operation Migrate the given namespace to provided name type. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to migrate namespace type. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.migrate.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceMigrate') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + migrate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrate'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..e39e4293a66b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py new file mode 100644 index 000000000000..9cc942bc5108 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations: + """PremiumMessagingRegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..116e01dd11c1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,374 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Gets the available PrivateEndpointConnections within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Creates or updates PrivateEndpointConnections of service namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets a description for the specified Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..81bc552d4f69 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourcesListResult": + """Gets lists of resources that supports Privatelinks. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py new file mode 100644 index 000000000000..a1bb57addf51 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py new file mode 100644 index 000000000000..d66ac64fac84 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_regions_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations: + """RegionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku: str, + **kwargs: Any + ) -> AsyncIterable["_models.PremiumMessagingRegionsListResult"]: + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py new file mode 100644 index 000000000000..23ebdb5d088f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..009e1fabce40 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..59854f70f658 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py similarity index 98% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py index a2aa3710b8ad..2297b182a4e2 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/__init__.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/__init__.py @@ -34,6 +34,7 @@ from ._models_py3 import NWRuleSetIpRules from ._models_py3 import NWRuleSetVirtualNetworkRules from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult @@ -97,6 +98,7 @@ from ._models import NWRuleSetIpRules # type: ignore from ._models import NWRuleSetVirtualNetworkRules # type: ignore from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationListResult # type: ignore @@ -181,6 +183,7 @@ 'NWRuleSetIpRules', 'NWRuleSetVirtualNetworkRules', 'NetworkRuleSet', + 'NetworkRuleSetListResult', 'Operation', 'OperationDisplay', 'OperationListResult', diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py similarity index 92% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py index 08f6e4c1fdd9..8d90e742d481 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models.py @@ -149,7 +149,8 @@ class ArmDisasterRecovery(Resource): :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.servicebus.models.ProvisioningStateDR + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. :vartype pending_replication_operations_count: long :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is @@ -160,7 +161,7 @@ class ArmDisasterRecovery(Resource): :type alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". - :vartype role: str or ~azure.mgmt.servicebus.models.RoleDisasterRecovery + :vartype role: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.RoleDisasterRecovery """ _validation = { @@ -201,7 +202,7 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Alias(Disaster Recovery configurations). - :type value: list[~azure.mgmt.servicebus.models.ArmDisasterRecovery] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration). :vartype next_link: str @@ -232,7 +233,8 @@ class CaptureDescription(msrest.serialization.Model): :type enabled: bool :param encoding: Enumerates the possible values for the encoding format of capture description. Possible values include: "Avro", "AvroDeflate". - :type encoding: str or ~azure.mgmt.servicebus.models.EncodingCaptureDescription + :type encoding: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :param interval_in_seconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. :type interval_in_seconds: int @@ -241,7 +243,7 @@ class CaptureDescription(msrest.serialization.Model): :type size_limit_in_bytes: int :param destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names). - :type destination: ~azure.mgmt.servicebus.models.Destination + :type destination: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Destination """ _validation = { @@ -309,7 +311,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): :param reason: The reason for unavailability of a namespace. Possible values include: "None", "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", "TooManyNamespaceInCurrentSubscription". - :type reason: str or ~azure.mgmt.servicebus.models.UnavailableReason + :type reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ _validation = { @@ -337,7 +339,8 @@ class ConnectionState(msrest.serialization.Model): :param status: Status of the connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.servicebus.models.PrivateLinkConnectionStatus + :type status: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :param description: Description of the connection state. :type description: str """ @@ -449,32 +452,27 @@ def __init__( class Encryption(msrest.serialization.Model): """Properties to configure Encryption. - Variables are only populated by the server, and will be ignored when sending a request. - :param key_vault_properties: Properties of KeyVault. - :type key_vault_properties: ~azure.mgmt.servicebus.models.KeyVaultProperties - :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value: + :type key_vault_properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is "Microsoft.KeyVault". - :vartype key_source: str + :type key_source: str """ - _validation = { - 'key_source': {'constant': True}, - } - _attribute_map = { 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, 'key_source': {'key': 'keySource', 'type': 'str'}, } - key_source = "Microsoft.KeyVault" - def __init__( self, **kwargs ): super(Encryption, self).__init__(**kwargs) self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.key_source = kwargs.get('key_source', "Microsoft.KeyVault") class ErrorAdditionalInfo(msrest.serialization.Model): @@ -485,7 +483,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -511,7 +509,7 @@ class ErrorResponse(msrest.serialization.Model): """The resource management error response. :param error: The error object. - :type error: ~azure.mgmt.servicebus.models.ErrorResponseError + :type error: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponseError """ _attribute_map = { @@ -538,9 +536,10 @@ class ErrorResponseError(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure.mgmt.servicebus.models.ErrorResponse] + :vartype details: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.servicebus.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -597,9 +596,9 @@ class Eventhub(Resource): :param status: Enumerates the possible values for the status of a Event Hub. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param capture_description: Properties of capture description. - :type capture_description: ~azure.mgmt.servicebus.models.CaptureDescription + :type capture_description: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CaptureDescription """ _validation = { @@ -646,7 +645,7 @@ class EventHubListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List EventHubs operation. - :type value: list[~azure.mgmt.servicebus.models.Eventhub] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. :vartype next_link: str @@ -693,29 +692,22 @@ def __init__( class Identity(msrest.serialization.Model): """Properties to configure Identity for Bring your Own Keys. - Variables are only populated by the server, and will be ignored when sending a request. - :param principal_id: ObjectId from the KeyVault. :type principal_id: str :param tenant_id: TenantId from the KeyVault. :type tenant_id: str - :ivar type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. Default value: "SystemAssigned". - :vartype type: str + :param type: Enumerates the possible value Identity type, which currently supports only + 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The + default value is "SystemAssigned". + :type type: str """ - _validation = { - 'type': {'constant': True}, - } - _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } - type = "SystemAssigned" - def __init__( self, **kwargs @@ -723,6 +715,7 @@ def __init__( super(Identity, self).__init__(**kwargs) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) + self.type = kwargs.get('type', "SystemAssigned") class IpFilterRule(Resource): @@ -739,7 +732,7 @@ class IpFilterRule(Resource): :param ip_mask: IP Mask. :type ip_mask: str :param action: The IP Filter Action. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.servicebus.models.IPAction + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :param filter_name: IP Filter name. :type filter_name: str """ @@ -773,7 +766,7 @@ class IpFilterRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List IpFilter Rules operation. - :type value: list[~azure.mgmt.servicebus.models.IpFilterRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules. :type next_link: str @@ -868,7 +861,7 @@ class MigrationConfigListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Migration Configs. - :type value: list[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations. :vartype next_link: str @@ -950,7 +943,7 @@ def __init__( class NetworkRuleSet(Resource): - """Description of topic resource. + """Description of NetworkRuleSet resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -962,11 +955,12 @@ class NetworkRuleSet(Resource): :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.servicebus.models.DefaultAction + :type default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction :param virtual_network_rules: List VirtualNetwork Rules. - :type virtual_network_rules: list[~azure.mgmt.servicebus.models.NWRuleSetVirtualNetworkRules] + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetVirtualNetworkRules] :param ip_rules: List of IpRules. - :type ip_rules: list[~azure.mgmt.servicebus.models.NWRuleSetIpRules] + :type ip_rules: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetIpRules] """ _validation = { @@ -994,13 +988,37 @@ def __init__( self.ip_rules = kwargs.get('ip_rules', None) +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + class NWRuleSetIpRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of NetWorkRuleSet - IpRules resource. :param ip_mask: IP Mask. :type ip_mask: str - :param action: The IP Filter Action. Possible values include: "Allow". - :type action: str or ~azure.mgmt.servicebus.models.NetworkRuleIPAction + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { @@ -1014,16 +1032,16 @@ def __init__( ): super(NWRuleSetIpRules, self).__init__(**kwargs) self.ip_mask = kwargs.get('ip_mask', None) - self.action = kwargs.get('action', None) + self.action = kwargs.get('action', "Allow") class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of VirtualNetworkRules - NetworkRules resource. :param subnet: Subnet properties. - :type subnet: ~azure.mgmt.servicebus.models.Subnet + :type subnet: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Subnet :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing - Vnet Service Endpoint. + VNet Service Endpoint. :type ignore_missing_vnet_service_endpoint: bool """ @@ -1049,7 +1067,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicebus.models.OperationDisplay + :type display: ~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationDisplay """ _validation = { @@ -1112,7 +1130,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - :vartype value: list[~azure.mgmt.servicebus.models.Operation] + :vartype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1192,7 +1210,8 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param properties: - :type properties: ~azure.mgmt.servicebus.models.PremiumMessagingRegionsProperties + :type properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsProperties """ _validation = { @@ -1224,7 +1243,7 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List PremiumMessagingRegions type. - :type value: list[~azure.mgmt.servicebus.models.PremiumMessagingRegions] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of PremiumMessagingRegions. :vartype next_link: str @@ -1309,12 +1328,14 @@ class PrivateEndpointConnection(Resource): :ivar type: Resource type. :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. - :type private_endpoint: ~azure.mgmt.servicebus.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Details about the state of the connection. - :type private_link_service_connection_state: ~azure.mgmt.servicebus.models.ConnectionState + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.servicebus.models.EndPointProvisioningState + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ _validation = { @@ -1346,7 +1367,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateEndpointConnection] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] :param next_link: A link for the next page of private endpoint connection resources. :type next_link: str """ @@ -1408,7 +1429,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. :param value: A collection of private link resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateLinkResource] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResource] :param next_link: A link for the next page of private link resources. :type next_link: str """ @@ -1434,7 +1455,7 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", "SecondaryKey". - :type key_type: str or ~azure.mgmt.servicebus.models.KeyType + :type key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :type key: str @@ -1471,14 +1492,14 @@ class Rule(Resource): :vartype type: str :param action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. - :type action: ~azure.mgmt.servicebus.models.Action + :type action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values include: "SqlFilter", "CorrelationFilter". - :type filter_type: str or ~azure.mgmt.servicebus.models.FilterType + :type filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :param sql_filter: Properties of sqlFilter. - :type sql_filter: ~azure.mgmt.servicebus.models.SqlFilter + :type sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter :param correlation_filter: Properties of correlationFilter. - :type correlation_filter: ~azure.mgmt.servicebus.models.CorrelationFilter + :type correlation_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CorrelationFilter """ _validation = { @@ -1512,7 +1533,7 @@ class RuleListResult(msrest.serialization.Model): """The response of the List rule operation. :param value: Result of the List Rules operation. - :type value: list[~azure.mgmt.servicebus.models.Rule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of rules. :type next_link: str @@ -1544,7 +1565,7 @@ class SBAuthorizationRule(Resource): :ivar type: Resource type. :vartype type: str :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.servicebus.models.AccessRights] + :type rights: list[str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessRights] """ _validation = { @@ -1572,7 +1593,7 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """The response to the List Namespace operation. :param value: Result of the List Authorization Rules operation. - :type value: list[~azure.mgmt.servicebus.models.SBAuthorizationRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. :type next_link: str @@ -1653,9 +1674,9 @@ class SBNamespace(TrackedResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str :ivar created_at: The time the namespace was created. @@ -1670,7 +1691,7 @@ class SBNamespace(TrackedResource): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1722,7 +1743,7 @@ class SBNamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.servicebus.models.SBNamespace] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. :type next_link: str @@ -1749,7 +1770,8 @@ class SBNamespaceMigrate(msrest.serialization.Model): :param target_namespace_type: Required. Type of namespaces. Possible values include: "Messaging", "NotificationHub", "Mixed", "EventHub", "Relay". - :type target_namespace_type: str or ~azure.mgmt.servicebus.models.NameSpaceType + :type target_namespace_type: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ _validation = { @@ -1784,9 +1806,9 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str :ivar created_at: The time the namespace was created. @@ -1801,7 +1823,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1860,7 +1882,7 @@ class SBQueue(Resource): :ivar type: Resource type. :vartype type: str :ivar count_details: Message Count Details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :ivar created_at: The exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -1901,7 +1923,7 @@ class SBQueue(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -1991,7 +2013,7 @@ class SBQueueListResult(msrest.serialization.Model): """The response to the List Queues operation. :param value: Result of the List Queues operation. - :type value: list[~azure.mgmt.servicebus.models.SBQueue] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of queues. :type next_link: str @@ -2018,10 +2040,10 @@ class SBSku(msrest.serialization.Model): :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.servicebus.models.SkuName + :type name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :param tier: The billing tier of this particular SKU. Possible values include: "Basic", "Standard", "Premium". - :type tier: str or ~azure.mgmt.servicebus.models.SkuTier + :type tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :type capacity: int @@ -2067,7 +2089,7 @@ class SBSubscription(Resource): :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. :type lock_duration: ~datetime.timedelta @@ -2091,7 +2113,7 @@ class SBSubscription(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2166,7 +2188,7 @@ class SBSubscriptionListResult(msrest.serialization.Model): """The response to the List Subscriptions operation. :param value: Result of the List Subscriptions operation. - :type value: list[~azure.mgmt.servicebus.models.SBSubscription] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. :type next_link: str @@ -2208,7 +2230,7 @@ class SBTopic(Resource): :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. @@ -2228,7 +2250,7 @@ class SBTopic(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param support_ordering: Value that indicates whether the topic supports ordering. :type support_ordering: bool :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is @@ -2303,7 +2325,7 @@ class SBTopicListResult(msrest.serialization.Model): """The response to the List Topics operation. :param value: Result of the List Topics operation. - :type value: list[~azure.mgmt.servicebus.models.SBTopic] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of topics. :type next_link: str @@ -2385,10 +2407,16 @@ def __init__( class Subnet(msrest.serialization.Model): """Properties supplied for Subnet. - :param id: Resource ID of Virtual Network Subnet. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. :type id: str """ + _validation = { + 'id': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } @@ -2398,7 +2426,7 @@ def __init__( **kwargs ): super(Subnet, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + self.id = kwargs['id'] class VirtualNetworkRule(Resource): @@ -2441,7 +2469,7 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List VirtualNetwork Rules operation. - :type value: list[~azure.mgmt.servicebus.models.VirtualNetworkRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of VirtualNetwork Rules. :type next_link: str diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py similarity index 92% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py index 188b537a7b70..8de36bc157e4 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_models_py3.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_models_py3.py @@ -158,7 +158,8 @@ class ArmDisasterRecovery(Resource): :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.servicebus.models.ProvisioningStateDR + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ProvisioningStateDR :ivar pending_replication_operations_count: Number of entities pending to be replicated. :vartype pending_replication_operations_count: long :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is @@ -169,7 +170,7 @@ class ArmDisasterRecovery(Resource): :type alternate_name: str :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". - :vartype role: str or ~azure.mgmt.servicebus.models.RoleDisasterRecovery + :vartype role: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.RoleDisasterRecovery """ _validation = { @@ -213,7 +214,7 @@ class ArmDisasterRecoveryListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Alias(Disaster Recovery configurations). - :type value: list[~azure.mgmt.servicebus.models.ArmDisasterRecovery] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration). :vartype next_link: str @@ -246,7 +247,8 @@ class CaptureDescription(msrest.serialization.Model): :type enabled: bool :param encoding: Enumerates the possible values for the encoding format of capture description. Possible values include: "Avro", "AvroDeflate". - :type encoding: str or ~azure.mgmt.servicebus.models.EncodingCaptureDescription + :type encoding: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EncodingCaptureDescription :param interval_in_seconds: The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds. :type interval_in_seconds: int @@ -255,7 +257,7 @@ class CaptureDescription(msrest.serialization.Model): :type size_limit_in_bytes: int :param destination: Properties of Destination where capture will be stored. (Storage Account, Blob Names). - :type destination: ~azure.mgmt.servicebus.models.Destination + :type destination: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Destination """ _validation = { @@ -331,7 +333,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): :param reason: The reason for unavailability of a namespace. Possible values include: "None", "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", "TooManyNamespaceInCurrentSubscription". - :type reason: str or ~azure.mgmt.servicebus.models.UnavailableReason + :type reason: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.UnavailableReason """ _validation = { @@ -362,7 +364,8 @@ class ConnectionState(msrest.serialization.Model): :param status: Status of the connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.servicebus.models.PrivateLinkConnectionStatus + :type status: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkConnectionStatus :param description: Description of the connection state. :type description: str """ @@ -493,34 +496,30 @@ def __init__( class Encryption(msrest.serialization.Model): """Properties to configure Encryption. - Variables are only populated by the server, and will be ignored when sending a request. - :param key_vault_properties: Properties of KeyVault. - :type key_vault_properties: ~azure.mgmt.servicebus.models.KeyVaultProperties - :ivar key_source: Enumerates the possible value of keySource for Encryption. Default value: + :type key_vault_properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is "Microsoft.KeyVault". - :vartype key_source: str + :type key_source: str """ - _validation = { - 'key_source': {'constant': True}, - } - _attribute_map = { 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, 'key_source': {'key': 'keySource', 'type': 'str'}, } - key_source = "Microsoft.KeyVault" - def __init__( self, *, key_vault_properties: Optional["KeyVaultProperties"] = None, + key_source: Optional[str] = "Microsoft.KeyVault", **kwargs ): super(Encryption, self).__init__(**kwargs) self.key_vault_properties = key_vault_properties + self.key_source = key_source class ErrorAdditionalInfo(msrest.serialization.Model): @@ -531,7 +530,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -557,7 +556,7 @@ class ErrorResponse(msrest.serialization.Model): """The resource management error response. :param error: The error object. - :type error: ~azure.mgmt.servicebus.models.ErrorResponseError + :type error: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponseError """ _attribute_map = { @@ -586,9 +585,10 @@ class ErrorResponseError(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure.mgmt.servicebus.models.ErrorResponse] + :vartype details: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.servicebus.models.ErrorAdditionalInfo] + :vartype additional_info: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.ErrorAdditionalInfo] """ _validation = { @@ -645,9 +645,9 @@ class Eventhub(Resource): :param status: Enumerates the possible values for the status of a Event Hub. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param capture_description: Properties of capture description. - :type capture_description: ~azure.mgmt.servicebus.models.CaptureDescription + :type capture_description: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CaptureDescription """ _validation = { @@ -699,7 +699,7 @@ class EventHubListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List EventHubs operation. - :type value: list[~azure.mgmt.servicebus.models.Eventhub] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Eventhub] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of EventHubs. :vartype next_link: str @@ -750,39 +750,34 @@ def __init__( class Identity(msrest.serialization.Model): """Properties to configure Identity for Bring your Own Keys. - Variables are only populated by the server, and will be ignored when sending a request. - :param principal_id: ObjectId from the KeyVault. :type principal_id: str :param tenant_id: TenantId from the KeyVault. :type tenant_id: str - :ivar type: Enumerates the possible value Identity type, which currently supports only - 'SystemAssigned'. Default value: "SystemAssigned". - :vartype type: str + :param type: Enumerates the possible value Identity type, which currently supports only + 'SystemAssigned'. The only acceptable values to pass in are None and "SystemAssigned". The + default value is "SystemAssigned". + :type type: str """ - _validation = { - 'type': {'constant': True}, - } - _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } - type = "SystemAssigned" - def __init__( self, *, principal_id: Optional[str] = None, tenant_id: Optional[str] = None, + type: Optional[str] = "SystemAssigned", **kwargs ): super(Identity, self).__init__(**kwargs) self.principal_id = principal_id self.tenant_id = tenant_id + self.type = type class IpFilterRule(Resource): @@ -799,7 +794,7 @@ class IpFilterRule(Resource): :param ip_mask: IP Mask. :type ip_mask: str :param action: The IP Filter Action. Possible values include: "Accept", "Reject". - :type action: str or ~azure.mgmt.servicebus.models.IPAction + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.IPAction :param filter_name: IP Filter name. :type filter_name: str """ @@ -837,7 +832,7 @@ class IpFilterRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List IpFilter Rules operation. - :type value: list[~azure.mgmt.servicebus.models.IpFilterRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of IpFilter Rules. :type next_link: str @@ -938,7 +933,7 @@ class MigrationConfigListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of Migration Configs. - :type value: list[~azure.mgmt.servicebus.models.MigrationConfigProperties] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations. :vartype next_link: str @@ -1025,7 +1020,7 @@ def __init__( class NetworkRuleSet(Resource): - """Description of topic resource. + """Description of NetworkRuleSet resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -1037,11 +1032,12 @@ class NetworkRuleSet(Resource): :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.servicebus.models.DefaultAction + :type default_action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.DefaultAction :param virtual_network_rules: List VirtualNetwork Rules. - :type virtual_network_rules: list[~azure.mgmt.servicebus.models.NWRuleSetVirtualNetworkRules] + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetVirtualNetworkRules] :param ip_rules: List of IpRules. - :type ip_rules: list[~azure.mgmt.servicebus.models.NWRuleSetIpRules] + :type ip_rules: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NWRuleSetIpRules] """ _validation = { @@ -1073,13 +1069,40 @@ def __init__( self.ip_rules = ip_rules +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + class NWRuleSetIpRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of NetWorkRuleSet - IpRules resource. :param ip_mask: IP Mask. :type ip_mask: str - :param action: The IP Filter Action. Possible values include: "Allow". - :type action: str or ~azure.mgmt.servicebus.models.NetworkRuleIPAction + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleIPAction """ _attribute_map = { @@ -1091,7 +1114,7 @@ def __init__( self, *, ip_mask: Optional[str] = None, - action: Optional[Union[str, "NetworkRuleIPAction"]] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", **kwargs ): super(NWRuleSetIpRules, self).__init__(**kwargs) @@ -1100,12 +1123,12 @@ def __init__( class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): - """The response from the List namespace operation. + """Description of VirtualNetworkRules - NetworkRules resource. :param subnet: Subnet properties. - :type subnet: ~azure.mgmt.servicebus.models.Subnet + :type subnet: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Subnet :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing - Vnet Service Endpoint. + VNet Service Endpoint. :type ignore_missing_vnet_service_endpoint: bool """ @@ -1134,7 +1157,7 @@ class Operation(msrest.serialization.Model): :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicebus.models.OperationDisplay + :type display: ~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationDisplay """ _validation = { @@ -1199,7 +1222,7 @@ class OperationListResult(msrest.serialization.Model): :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - :vartype value: list[~azure.mgmt.servicebus.models.Operation] + :vartype value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Operation] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1282,7 +1305,8 @@ class PremiumMessagingRegions(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param properties: - :type properties: ~azure.mgmt.servicebus.models.PremiumMessagingRegionsProperties + :type properties: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsProperties """ _validation = { @@ -1318,7 +1342,7 @@ class PremiumMessagingRegionsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: Result of the List PremiumMessagingRegions type. - :type value: list[~azure.mgmt.servicebus.models.PremiumMessagingRegions] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegions] :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of PremiumMessagingRegions. :vartype next_link: str @@ -1407,12 +1431,14 @@ class PrivateEndpointConnection(Resource): :ivar type: Resource type. :vartype type: str :param private_endpoint: The Private Endpoint resource for this Connection. - :type private_endpoint: ~azure.mgmt.servicebus.models.PrivateEndpoint + :type private_endpoint: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Details about the state of the connection. - :type private_link_service_connection_state: ~azure.mgmt.servicebus.models.ConnectionState + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2018_01_01_preview.models.ConnectionState :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". - :type provisioning_state: str or ~azure.mgmt.servicebus.models.EndPointProvisioningState + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.EndPointProvisioningState """ _validation = { @@ -1448,7 +1474,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): """Result of the list of all private endpoint connections operation. :param value: A collection of private endpoint connection resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateEndpointConnection] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection] :param next_link: A link for the next page of private endpoint connection resources. :type next_link: str """ @@ -1520,7 +1546,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): """Result of the List private link resources operation. :param value: A collection of private link resources. - :type value: list[~azure.mgmt.servicebus.models.PrivateLinkResource] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResource] :param next_link: A link for the next page of private link resources. :type next_link: str """ @@ -1549,7 +1575,7 @@ class RegenerateAccessKeyParameters(msrest.serialization.Model): :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", "SecondaryKey". - :type key_type: str or ~azure.mgmt.servicebus.models.KeyType + :type key_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.KeyType :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType. :type key: str @@ -1589,14 +1615,14 @@ class Rule(Resource): :vartype type: str :param action: Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. - :type action: ~azure.mgmt.servicebus.models.Action + :type action: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Action :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values include: "SqlFilter", "CorrelationFilter". - :type filter_type: str or ~azure.mgmt.servicebus.models.FilterType + :type filter_type: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.FilterType :param sql_filter: Properties of sqlFilter. - :type sql_filter: ~azure.mgmt.servicebus.models.SqlFilter + :type sql_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SqlFilter :param correlation_filter: Properties of correlationFilter. - :type correlation_filter: ~azure.mgmt.servicebus.models.CorrelationFilter + :type correlation_filter: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CorrelationFilter """ _validation = { @@ -1635,7 +1661,7 @@ class RuleListResult(msrest.serialization.Model): """The response of the List rule operation. :param value: Result of the List Rules operation. - :type value: list[~azure.mgmt.servicebus.models.Rule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of rules. :type next_link: str @@ -1670,7 +1696,7 @@ class SBAuthorizationRule(Resource): :ivar type: Resource type. :vartype type: str :param rights: The rights associated with the rule. - :type rights: list[str or ~azure.mgmt.servicebus.models.AccessRights] + :type rights: list[str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessRights] """ _validation = { @@ -1700,7 +1726,7 @@ class SBAuthorizationRuleListResult(msrest.serialization.Model): """The response to the List Namespace operation. :param value: Result of the List Authorization Rules operation. - :type value: list[~azure.mgmt.servicebus.models.SBAuthorizationRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. :type next_link: str @@ -1787,9 +1813,9 @@ class SBNamespace(TrackedResource): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str :ivar created_at: The time the namespace was created. @@ -1804,7 +1830,7 @@ class SBNamespace(TrackedResource): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -1863,7 +1889,7 @@ class SBNamespaceListResult(msrest.serialization.Model): """The response of the List Namespace operation. :param value: Result of the List Namespace operation. - :type value: list[~azure.mgmt.servicebus.models.SBNamespace] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. :type next_link: str @@ -1893,7 +1919,8 @@ class SBNamespaceMigrate(msrest.serialization.Model): :param target_namespace_type: Required. Type of namespaces. Possible values include: "Messaging", "NotificationHub", "Mixed", "EventHub", "Relay". - :type target_namespace_type: str or ~azure.mgmt.servicebus.models.NameSpaceType + :type target_namespace_type: str or + ~azure.mgmt.servicebus.v2018_01_01_preview.models.NameSpaceType """ _validation = { @@ -1930,9 +1957,9 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): :param tags: A set of tags. Resource tags. :type tags: dict[str, str] :param sku: Properties of SKU. - :type sku: ~azure.mgmt.servicebus.models.SBSku + :type sku: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSku :param identity: Properties of BYOK Identity description. - :type identity: ~azure.mgmt.servicebus.models.Identity + :type identity: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Identity :ivar provisioning_state: Provisioning state of the namespace. :vartype provisioning_state: str :ivar created_at: The time the namespace was created. @@ -1947,7 +1974,7 @@ class SBNamespaceUpdateParameters(ResourceNamespacePatch): regions supported availability zones. :type zone_redundant: bool :param encryption: Properties of BYOK Encryption description. - :type encryption: ~azure.mgmt.servicebus.models.Encryption + :type encryption: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Encryption """ _validation = { @@ -2013,7 +2040,7 @@ class SBQueue(Resource): :ivar type: Resource type. :vartype type: str :ivar count_details: Message Count Details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :ivar created_at: The exact time the message was created. :vartype created_at: ~datetime.datetime :ivar updated_at: The exact time the message was updated. @@ -2054,7 +2081,7 @@ class SBQueue(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2160,7 +2187,7 @@ class SBQueueListResult(msrest.serialization.Model): """The response to the List Queues operation. :param value: Result of the List Queues operation. - :type value: list[~azure.mgmt.servicebus.models.SBQueue] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of queues. :type next_link: str @@ -2190,10 +2217,10 @@ class SBSku(msrest.serialization.Model): :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", "Premium". - :type name: str or ~azure.mgmt.servicebus.models.SkuName + :type name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :param tier: The billing tier of this particular SKU. Possible values include: "Basic", "Standard", "Premium". - :type tier: str or ~azure.mgmt.servicebus.models.SkuTier + :type tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :type capacity: int @@ -2243,7 +2270,7 @@ class SBSubscription(Resource): :ivar updated_at: The exact time the message was updated. :vartype updated_at: ~datetime.datetime :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. :type lock_duration: ~datetime.timedelta @@ -2267,7 +2294,7 @@ class SBSubscription(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param enable_batched_operations: Value that indicates whether server-side batched operations are enabled. :type enable_batched_operations: bool @@ -2355,7 +2382,7 @@ class SBSubscriptionListResult(msrest.serialization.Model): """The response to the List Subscriptions operation. :param value: Result of the List Subscriptions operation. - :type value: list[~azure.mgmt.servicebus.models.SBSubscription] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. :type next_link: str @@ -2400,7 +2427,7 @@ class SBTopic(Resource): :ivar subscription_count: Number of subscriptions. :vartype subscription_count: int :ivar count_details: Message count details. - :vartype count_details: ~azure.mgmt.servicebus.models.MessageCountDetails + :vartype count_details: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MessageCountDetails :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. @@ -2420,7 +2447,7 @@ class SBTopic(Resource): :param status: Enumerates the possible values for the status of a messaging entity. Possible values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", "Creating", "Deleting", "Renaming", "Unknown". - :type status: str or ~azure.mgmt.servicebus.models.EntityStatus + :type status: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.EntityStatus :param support_ordering: Value that indicates whether the topic supports ordering. :type support_ordering: bool :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is @@ -2506,7 +2533,7 @@ class SBTopicListResult(msrest.serialization.Model): """The response to the List Topics operation. :param value: Result of the List Topics operation. - :type value: list[~azure.mgmt.servicebus.models.SBTopic] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic] :param next_link: Link to the next set of results. Not empty if Value contains incomplete list of topics. :type next_link: str @@ -2599,10 +2626,16 @@ def __init__( class Subnet(msrest.serialization.Model): """Properties supplied for Subnet. - :param id: Resource ID of Virtual Network Subnet. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. :type id: str """ + _validation = { + 'id': {'required': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } @@ -2610,7 +2643,7 @@ class Subnet(msrest.serialization.Model): def __init__( self, *, - id: Optional[str] = None, + id: str, **kwargs ): super(Subnet, self).__init__(**kwargs) @@ -2659,7 +2692,7 @@ class VirtualNetworkRuleListResult(msrest.serialization.Model): """The response from the List namespace operation. :param value: Result of the List VirtualNetwork Rules operation. - :type value: list[~azure.mgmt.servicebus.models.VirtualNetworkRule] + :type value: list[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule] :param next_link: Link to the next set of results. Not empty if Value contains an incomplete list of VirtualNetwork Rules. :type next_link: str diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py similarity index 100% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/models/_service_bus_management_client_enums.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/models/_service_bus_management_client_enums.py diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..d7920f85ee2c --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._event_hubs_operations import EventHubsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._premium_messaging_regions_operations import PremiumMessagingRegionsOperations +from ._regions_operations import RegionsOperations +from ._subscriptions_operations import SubscriptionsOperations +from ._rules_operations import RulesOperations +from ._operations import Operations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'DisasterRecoveryConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'EventHubsOperations', + 'MigrationConfigsOperations', + 'PremiumMessagingRegionsOperations', + 'RegionsOperations', + 'SubscriptionsOperations', + 'RulesOperations', + 'Operations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py index 5d41e56d49d0..8c9a32491e71 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_disaster_recovery_configs_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -30,7 +30,7 @@ class DisasterRecoveryConfigsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,10 +60,10 @@ def check_name_availability( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.models.CheckNameAvailability + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.CheckNameAvailabilityResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] @@ -102,7 +102,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -128,7 +128,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.ArmDisasterRecoveryListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecoveryListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] @@ -178,7 +178,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -207,10 +207,10 @@ def create_or_update( :param alias: The Disaster Recovery configuration name. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). - :type parameters: ~azure.mgmt.servicebus.models.ArmDisasterRecovery + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery :keyword callable cls: A custom type or function that will be passed the direct response :return: ArmDisasterRecovery, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.ArmDisasterRecovery or None + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] @@ -250,7 +250,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -316,7 +316,7 @@ def delete( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -342,7 +342,7 @@ def get( :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ArmDisasterRecovery, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.ArmDisasterRecovery + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.ArmDisasterRecovery :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] @@ -377,7 +377,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) @@ -442,7 +442,7 @@ def break_pairing( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -468,7 +468,7 @@ def fail_over( :param alias: The Disaster Recovery configuration name. :type alias: str :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). - :type parameters: ~azure.mgmt.servicebus.models.FailoverProperties + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.FailoverProperties :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -514,7 +514,7 @@ def fail_over( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -540,7 +540,7 @@ def list_authorization_rules( :type alias: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -591,7 +591,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -623,7 +623,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -659,7 +659,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -691,7 +691,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -727,7 +727,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..02f7e9039ab8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_event_hubs_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class EventHubsOperations(object): + """EventHubsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubListResult"] + """Gets all the Event Hubs in a service bus Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.EventHubListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('EventHubListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/eventhubs'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..c8ab4f1f1b0e --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_migration_configs_operations.py @@ -0,0 +1,510 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations(object): + """MigrationConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MigrationConfigListResult"] + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + def _create_and_start_migration_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MigrationConfigProperties"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def begin_create_and_start_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MigrationConfigProperties"] + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MigrationConfigProperties" + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def complete_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + def revert( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py similarity index 90% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py index 5626e5556185..ac5186a54fd3 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_namespaces_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_namespaces_operations.py @@ -32,7 +32,7 @@ class NamespacesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list_ip_filter_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IpFilterRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.IpFilterRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRuleListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -141,10 +141,10 @@ def create_or_update_ip_filter_rule( :param ip_filter_rule_name: The IP Filter Rule name. :type ip_filter_rule_name: str :param parameters: The Namespace IpFilterRule. - :type parameters: ~azure.mgmt.servicebus.models.IpFilterRule + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :keyword callable cls: A custom type or function that will be passed the direct response :return: IpFilterRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.IpFilterRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] @@ -184,7 +184,7 @@ def create_or_update_ip_filter_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFilterRule', pipeline_response) @@ -248,7 +248,7 @@ def delete_ip_filter_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -274,7 +274,7 @@ def get_ip_filter_rule( :type ip_filter_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IpFilterRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.IpFilterRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.IpFilterRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFilterRule"] @@ -309,7 +309,7 @@ def get_ip_filter_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFilterRule', pipeline_response) @@ -329,7 +329,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBNamespaceListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] @@ -377,7 +377,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -400,7 +400,7 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBNamespaceListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] @@ -449,7 +449,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -504,7 +504,7 @@ def _create_or_update_initial( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -536,15 +536,15 @@ def begin_create_or_update( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to create a namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespace + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.models.SBNamespace] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -631,7 +631,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -655,8 +655,8 @@ def begin_delete( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -720,7 +720,7 @@ def get( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBNamespace, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBNamespace + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] @@ -754,7 +754,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBNamespace', pipeline_response) @@ -781,10 +781,10 @@ def update( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to update a namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespaceUpdateParameters + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: SBNamespace, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBNamespace or None + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespace or None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] @@ -823,7 +823,7 @@ def update( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -839,134 +839,6 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore - def create_or_update_network_rule_set( - self, - resource_group_name, # type: str - namespace_name, # type: str - parameters, # type: "_models.NetworkRuleSet" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkRuleSet" - """Gets NetworkRuleSet for a Namespace. - - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param namespace_name: The namespace name. - :type namespace_name: str - :param parameters: The Namespace NetworkRuleSet. - :type parameters: ~azure.mgmt.servicebus.models.NetworkRuleSet - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NetworkRuleSet') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - 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(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default'} # type: ignore - - def get_network_rule_set( - self, - resource_group_name, # type: str - namespace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetworkRuleSet" - """Gets NetworkRuleSet for a Namespace. - - :param resource_group_name: Name of the Resource group within the Azure subscription. - :type resource_group_name: str - :param namespace_name: The namespace name. - :type namespace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NetworkRuleSet, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.NetworkRuleSet - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_network_rule_set.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NetworkRuleSet', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkrulesets/default'} # type: ignore - def list_virtual_network_rules( self, resource_group_name, # type: str @@ -982,7 +854,7 @@ def list_virtual_network_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualNetworkRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.VirtualNetworkRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRuleListResult"] @@ -1032,7 +904,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1061,10 +933,10 @@ def create_or_update_virtual_network_rule( :param virtual_network_rule_name: The Virtual Network Rule name. :type virtual_network_rule_name: str :param parameters: The Namespace VirtualNetworkRule. - :type parameters: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] @@ -1104,7 +976,7 @@ def create_or_update_virtual_network_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) @@ -1168,7 +1040,7 @@ def delete_virtual_network_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1194,7 +1066,7 @@ def get_virtual_network_rule( :type virtual_network_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualNetworkRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.VirtualNetworkRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.VirtualNetworkRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkRule"] @@ -1229,7 +1101,7 @@ def get_virtual_network_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('VirtualNetworkRule', pipeline_response) @@ -1255,7 +1127,7 @@ def list_authorization_rules( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.SBAuthorizationRuleListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] @@ -1263,7 +1135,7 @@ def list_authorization_rules( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -1305,7 +1177,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1334,10 +1206,10 @@ def create_or_update_authorization_rule( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: The shared access authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -1345,7 +1217,7 @@ def create_or_update_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1377,7 +1249,7 @@ def create_or_update_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -1414,7 +1286,7 @@ def delete_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1441,7 +1313,7 @@ def delete_authorization_rule( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1467,7 +1339,7 @@ def get_authorization_rule( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SBAuthorizationRule, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.SBAuthorizationRule + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] @@ -1475,7 +1347,7 @@ def get_authorization_rule( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1502,7 +1374,7 @@ def get_authorization_rule( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) @@ -1531,7 +1403,7 @@ def list_keys( :type authorization_rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -1539,7 +1411,7 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" accept = "application/json" # Construct URL @@ -1566,7 +1438,7 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -1595,10 +1467,10 @@ def regenerate_keys( :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str :param parameters: Parameters supplied to regenerate the authorization rule. - :type parameters: ~azure.mgmt.servicebus.models.RegenerateAccessKeyParameters + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: AccessKeys, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.AccessKeys + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] @@ -1606,7 +1478,7 @@ def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1638,7 +1510,7 @@ def regenerate_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -1658,10 +1530,10 @@ def check_name_availability( """Check the give namespace name availability. :param parameters: Parameters to check availability of the given namespace name. - :type parameters: ~azure.mgmt.servicebus.models.CheckNameAvailability + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailability :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.CheckNameAvailabilityResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] @@ -1669,7 +1541,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1698,7 +1570,7 @@ def check_name_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -1709,6 +1581,210 @@ def check_name_availability( return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + def migrate( self, resource_group_name, # type: str @@ -1724,7 +1800,7 @@ def migrate( :param namespace_name: The namespace name. :type namespace_name: str :param parameters: Parameters supplied to migrate namespace type. - :type parameters: ~azure.mgmt.servicebus.models.SBNamespaceMigrate + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBNamespaceMigrate :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1735,7 +1811,7 @@ def migrate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-01" + api_version = "2018-01-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -1766,7 +1842,7 @@ def migrate( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py index 1651be860b1c..a2299672a426 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -54,7 +54,7 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py new file mode 100644 index 000000000000..a0234237b68b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_premium_messaging_regions_operations.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PremiumMessagingRegionsOperations(object): + """PremiumMessagingRegionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PremiumMessagingRegionsListResult"] + """Gets the available premium messaging regions for servicebus. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/premiumMessagingRegions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py similarity index 95% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py index 8b8132b1266a..4caf5090bd21 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_endpoint_connections_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -32,7 +32,7 @@ class PrivateEndpointConnectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -62,7 +62,7 @@ def list( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.models.PrivateEndpointConnectionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -112,7 +112,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -142,10 +142,10 @@ def create_or_update( :type private_endpoint_connection_name: str :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to namespace resource. - :type parameters: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -185,7 +185,7 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -240,7 +240,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -266,8 +266,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -336,7 +336,7 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] @@ -371,7 +371,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py similarity index 94% rename from sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py rename to sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py index db5b8a8f30bb..31b03f9077eb 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/operations/_private_link_resources_operations.py +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_private_link_resources_operations.py @@ -29,7 +29,7 @@ class PrivateLinkResourcesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicebus.models + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +59,7 @@ def get( :type namespace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourcesListResult, or the result of cls(response) - :rtype: ~azure.mgmt.servicebus.models.PrivateLinkResourcesListResult + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] @@ -93,7 +93,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py new file mode 100644 index 000000000000..27e537b793a3 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_queues_operations.py @@ -0,0 +1,764 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBQueueListResult"] + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.SBQueue" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py new file mode 100644 index 000000000000..ace530c758f4 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_regions_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RegionsOperations(object): + """RegionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_sku( + self, + sku, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PremiumMessagingRegionsListResult"] + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PremiumMessagingRegionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.PremiumMessagingRegionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PremiumMessagingRegionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'sku': self._serialize.url("sku", sku, 'str', max_length=50, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PremiumMessagingRegionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py new file mode 100644 index 000000000000..95a2757bad7a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_rules_operations.py @@ -0,0 +1,363 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations(object): + """RulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleListResult"] + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + parameters, # type: "_models.Rule" + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..47771b2005d1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_subscriptions_operations.py @@ -0,0 +1,347 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBSubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SBSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py new file mode 100644 index 000000000000..b054849d6640 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/operations/_topics_operations.py @@ -0,0 +1,764 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2018_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBTopicListResult"] + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.SBTopic" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2018_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2018_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py new file mode 100644 index 000000000000..f640dac181bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py new file mode 100644 index 000000000000..c61436bf32b1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json new file mode 100644 index 000000000000..ca37cbafb827 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_metadata.json @@ -0,0 +1,112 @@ +{ + "chosen_version": "2021-01-01-preview", + "total_api_version_list": ["2017-04-01", "2021-01-01-preview"], + "client": { + "name": "ServiceBusManagementClient", + "filename": "_service_bus_management_client", + "description": "Azure Service Bus client for managing Namespace.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceBusManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "namespaces": "NamespacesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations", + "disaster_recovery_configs": "DisasterRecoveryConfigsOperations", + "migration_configs": "MigrationConfigsOperations", + "queues": "QueuesOperations", + "topics": "TopicsOperations", + "rules": "RulesOperations", + "subscriptions": "SubscriptionsOperations" + } +} \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py new file mode 100644 index 000000000000..cead781c4999 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/_service_bus_management_client.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import DisasterRecoveryConfigsOperations +from .operations import MigrationConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import RulesOperations +from .operations import SubscriptionsOperations +from . import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2021_01_01_preview.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2021_01_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2021_01_01_preview.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2021_01_01_preview.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2021_01_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2021_01_01_preview.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2021_01_01_preview.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2021_01_01_preview.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2021_01_01_preview.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceBusManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py new file mode 100644 index 000000000000..9016cbc21795 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._service_bus_management_client import ServiceBusManagementClient +__all__ = ['ServiceBusManagementClient'] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..58aa8078dab6 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_configuration.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ServiceBusManagementClientConfiguration(Configuration): + """Configuration for ServiceBusManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceBusManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicebus/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py new file mode 100644 index 000000000000..19ce1a02e97d --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/_service_bus_management_client.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ServiceBusManagementClientConfiguration +from .operations import NamespacesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import DisasterRecoveryConfigsOperations +from .operations import MigrationConfigsOperations +from .operations import QueuesOperations +from .operations import TopicsOperations +from .operations import RulesOperations +from .operations import SubscriptionsOperations +from .. import models + + +class ServiceBusManagementClient(object): + """Azure Service Bus client for managing Namespace. + + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.NamespacesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.Operations + :ivar disaster_recovery_configs: DisasterRecoveryConfigsOperations operations + :vartype disaster_recovery_configs: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.DisasterRecoveryConfigsOperations + :ivar migration_configs: MigrationConfigsOperations operations + :vartype migration_configs: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.MigrationConfigsOperations + :ivar queues: QueuesOperations operations + :vartype queues: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.QueuesOperations + :ivar topics: TopicsOperations operations + :vartype topics: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.TopicsOperations + :ivar rules: RulesOperations operations + :vartype rules: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.RulesOperations + :ivar subscriptions: SubscriptionsOperations operations + :vartype subscriptions: azure.mgmt.servicebus.v2021_01_01_preview.aio.operations.SubscriptionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceBusManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.namespaces = NamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.disaster_recovery_configs = DisasterRecoveryConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.migration_configs = MigrationConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.queues = QueuesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.topics = TopicsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.rules = RulesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.subscriptions = SubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceBusManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..e278debc144f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/__init__.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'DisasterRecoveryConfigsOperations', + 'MigrationConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'RulesOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..bea5494b1ccd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,725 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations: + """DisasterRecoveryConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ArmDisasterRecoveryListResult"]: + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: "_models.ArmDisasterRecovery", + **kwargs: Any + ) -> Optional["_models.ArmDisasterRecovery"]: + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> "_models.ArmDisasterRecovery": + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + async def break_pairing( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> None: + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + async def fail_over( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + parameters: Optional["_models.FailoverProperties"] = None, + **kwargs: Any + ) -> None: + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + alias: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..af381736c780 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_migration_configs_operations.py @@ -0,0 +1,499 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations: + """MigrationConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MigrationConfigListResult"]: + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + async def _create_and_start_migration_initial( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> Optional["_models.MigrationConfigProperties"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def begin_create_and_start_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + parameters: "_models.MigrationConfigProperties", + **kwargs: Any + ) -> AsyncLROPoller["_models.MigrationConfigProperties"]: + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> "_models.MigrationConfigProperties": + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + async def complete_migration( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + async def revert( + self, + resource_group_name: str, + namespace_name: str, + config_name: Union[str, "_models.MigrationConfigurationName"], + **kwargs: Any + ) -> None: + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..506193bae4f7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_namespaces_operations.py @@ -0,0 +1,1218 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBNamespaceListResult"]: + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespace", + **kwargs: Any + ) -> AsyncLROPoller["_models.SBNamespace"]: + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.SBNamespace": + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.SBNamespaceUpdateParameters", + **kwargs: Any + ) -> Optional["_models.SBNamespace"]: + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + async def create_or_update_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + parameters: "_models.NetworkRuleSet", + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + async def get_network_rule_set( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.NetworkRuleSet": + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkRuleSetListResult"]: + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + async def check_name_availability( + self, + parameters: "_models.CheckNameAvailability", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..fe06db788810 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c45008bfb2bb --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,374 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Gets the available PrivateEndpointConnections within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Creates or updates PrivateEndpointConnections of service namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets a description for the specified Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9cd5c0958ba1 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + namespace_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourcesListResult": + """Gets lists of resources that supports Privatelinks. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py new file mode 100644 index 000000000000..7e68a14f9130 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_queues_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations: + """QueuesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBQueueListResult"]: + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + parameters: "_models.SBQueue", + **kwargs: Any + ) -> "_models.SBQueue": + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> None: + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + queue_name: str, + **kwargs: Any + ) -> "_models.SBQueue": + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py new file mode 100644 index 000000000000..ac8359450bc9 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_rules_operations.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations: + """RulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RuleListResult"]: + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + parameters: "_models.Rule", + **kwargs: Any + ) -> "_models.Rule": + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.Rule": + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..bfe16b0bb5f3 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_subscriptions_operations.py @@ -0,0 +1,339 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations: + """SubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBSubscriptionListResult"]: + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + parameters: "_models.SBSubscription", + **kwargs: Any + ) -> "_models.SBSubscription": + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> None: + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + subscription_name: str, + **kwargs: Any + ) -> "_models.SBSubscription": + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py new file mode 100644 index 000000000000..e48cb8ef382a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/aio/operations/_topics_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations: + """TopicsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SBAuthorizationRuleListResult"]: + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + async def create_or_update_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.SBAuthorizationRule", + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def get_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.SBAuthorizationRule": + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def delete_authorization_rule( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + async def regenerate_keys( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + authorization_rule_name: str, + parameters: "_models.RegenerateAccessKeyParameters", + **kwargs: Any + ) -> "_models.AccessKeys": + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name: str, + namespace_name: str, + skip: Optional[int] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SBTopicListResult"]: + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + parameters: "_models.SBTopic", + **kwargs: Any + ) -> "_models.SBTopic": + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> None: + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + namespace_name: str, + topic_name: str, + **kwargs: Any + ) -> "_models.SBTopic": + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py new file mode 100644 index 000000000000..4497cba42443 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/__init__.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessKeys + from ._models_py3 import Action + from ._models_py3 import ArmDisasterRecovery + from ._models_py3 import ArmDisasterRecoveryListResult + from ._models_py3 import CheckNameAvailability + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import ConnectionState + from ._models_py3 import CorrelationFilter + from ._models_py3 import DictionaryValue + from ._models_py3 import Encryption + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ErrorResponseError + from ._models_py3 import FailoverProperties + from ._models_py3 import Identity + from ._models_py3 import KeyVaultProperties + from ._models_py3 import MessageCountDetails + from ._models_py3 import MigrationConfigListResult + from ._models_py3 import MigrationConfigProperties + from ._models_py3 import NWRuleSetIpRules + from ._models_py3 import NWRuleSetVirtualNetworkRules + from ._models_py3 import NetworkRuleSet + from ._models_py3 import NetworkRuleSetListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourcesListResult + from ._models_py3 import RegenerateAccessKeyParameters + from ._models_py3 import Resource + from ._models_py3 import ResourceNamespacePatch + from ._models_py3 import Rule + from ._models_py3 import RuleListResult + from ._models_py3 import SBAuthorizationRule + from ._models_py3 import SBAuthorizationRuleListResult + from ._models_py3 import SBNamespace + from ._models_py3 import SBNamespaceListResult + from ._models_py3 import SBNamespaceUpdateParameters + from ._models_py3 import SBQueue + from ._models_py3 import SBQueueListResult + from ._models_py3 import SBSku + from ._models_py3 import SBSubscription + from ._models_py3 import SBSubscriptionListResult + from ._models_py3 import SBTopic + from ._models_py3 import SBTopicListResult + from ._models_py3 import SqlFilter + from ._models_py3 import SqlRuleAction + from ._models_py3 import Subnet + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import UserAssignedIdentityProperties +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import Action # type: ignore + from ._models import ArmDisasterRecovery # type: ignore + from ._models import ArmDisasterRecoveryListResult # type: ignore + from ._models import CheckNameAvailability # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import ConnectionState # type: ignore + from ._models import CorrelationFilter # type: ignore + from ._models import DictionaryValue # type: ignore + from ._models import Encryption # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ErrorResponseError # type: ignore + from ._models import FailoverProperties # type: ignore + from ._models import Identity # type: ignore + from ._models import KeyVaultProperties # type: ignore + from ._models import MessageCountDetails # type: ignore + from ._models import MigrationConfigListResult # type: ignore + from ._models import MigrationConfigProperties # type: ignore + from ._models import NWRuleSetIpRules # type: ignore + from ._models import NWRuleSetVirtualNetworkRules # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import NetworkRuleSetListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourcesListResult # type: ignore + from ._models import RegenerateAccessKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceNamespacePatch # type: ignore + from ._models import Rule # type: ignore + from ._models import RuleListResult # type: ignore + from ._models import SBAuthorizationRule # type: ignore + from ._models import SBAuthorizationRuleListResult # type: ignore + from ._models import SBNamespace # type: ignore + from ._models import SBNamespaceListResult # type: ignore + from ._models import SBNamespaceUpdateParameters # type: ignore + from ._models import SBQueue # type: ignore + from ._models import SBQueueListResult # type: ignore + from ._models import SBSku # type: ignore + from ._models import SBSubscription # type: ignore + from ._models import SBSubscriptionListResult # type: ignore + from ._models import SBTopic # type: ignore + from ._models import SBTopicListResult # type: ignore + from ._models import SqlFilter # type: ignore + from ._models import SqlRuleAction # type: ignore + from ._models import Subnet # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserAssignedIdentityProperties # type: ignore + +from ._service_bus_management_client_enums import ( + AccessRights, + CreatedByType, + DefaultAction, + EndPointProvisioningState, + EntityStatus, + FilterType, + KeyType, + ManagedServiceIdentityType, + MigrationConfigurationName, + NetworkRuleIPAction, + PrivateLinkConnectionStatus, + ProvisioningStateDR, + RoleDisasterRecovery, + SkuName, + SkuTier, + UnavailableReason, +) + +__all__ = [ + 'AccessKeys', + 'Action', + 'ArmDisasterRecovery', + 'ArmDisasterRecoveryListResult', + 'CheckNameAvailability', + 'CheckNameAvailabilityResult', + 'ConnectionState', + 'CorrelationFilter', + 'DictionaryValue', + 'Encryption', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ErrorResponseError', + 'FailoverProperties', + 'Identity', + 'KeyVaultProperties', + 'MessageCountDetails', + 'MigrationConfigListResult', + 'MigrationConfigProperties', + 'NWRuleSetIpRules', + 'NWRuleSetVirtualNetworkRules', + 'NetworkRuleSet', + 'NetworkRuleSetListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'RegenerateAccessKeyParameters', + 'Resource', + 'ResourceNamespacePatch', + 'Rule', + 'RuleListResult', + 'SBAuthorizationRule', + 'SBAuthorizationRuleListResult', + 'SBNamespace', + 'SBNamespaceListResult', + 'SBNamespaceUpdateParameters', + 'SBQueue', + 'SBQueueListResult', + 'SBSku', + 'SBSubscription', + 'SBSubscriptionListResult', + 'SBTopic', + 'SBTopicListResult', + 'SqlFilter', + 'SqlRuleAction', + 'Subnet', + 'SystemData', + 'TrackedResource', + 'UserAssignedIdentityProperties', + 'AccessRights', + 'CreatedByType', + 'DefaultAction', + 'EndPointProvisioningState', + 'EntityStatus', + 'FilterType', + 'KeyType', + 'ManagedServiceIdentityType', + 'MigrationConfigurationName', + 'NetworkRuleIPAction', + 'PrivateLinkConnectionStatus', + 'ProvisioningStateDR', + 'RoleDisasterRecovery', + 'SkuName', + 'SkuTier', + 'UnavailableReason', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py new file mode 100644 index 000000000000..7c67524d2716 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models.py @@ -0,0 +1,2228 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class ConnectionState(msrest.serialization.Model): + """ConnectionState information. + + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus + :param description: Description of the connection state. + :type description: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.correlation_id = kwargs.get('correlation_id', None) + self.message_id = kwargs.get('message_id', None) + self.to = kwargs.get('to', None) + self.reply_to = kwargs.get('reply_to', None) + self.label = kwargs.get('label', None) + self.session_id = kwargs.get('session_id', None) + self.reply_to_session_id = kwargs.get('reply_to_session_id', None) + self.content_type = kwargs.get('content_type', None) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class DictionaryValue(msrest.serialization.Model): + """Recognized Dictionary value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DictionaryValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + "Microsoft.KeyVault". + :type key_source: str + :param require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). + :type require_infrastructure_encryption: bool + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Encryption, self).__init__(**kwargs) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.key_source = kwargs.get('key_source', "Microsoft.KeyVault") + self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class FailoverProperties(msrest.serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + + :param is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :type is_safe_failover: bool + """ + + _attribute_map = { + 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverProperties, self).__init__(**kwargs) + self.is_safe_failover = kwargs.get('is_safe_failover', None) + + +class Identity(msrest.serialization.Model): + """Properties to configure User Assigned Identities for Bring your Own Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: ObjectId from the KeyVault. + :vartype principal_id: str + :ivar tenant_id: TenantId from the KeyVault. + :vartype tenant_id: str + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2021_01_01_preview.models.DictionaryValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{DictionaryValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties to configure keyVault Properties. + + :param key_name: Name of the Key from KeyVault. + :type key_name: str + :param key_vault_uri: Uri of KeyVault. + :type key_vault_uri: str + :param key_version: Version of KeyVault. + :type key_version: str + :param identity: + :type identity: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.UserAssignedIdentityProperties + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + self.key_vault_uri = kwargs.get('key_vault_uri', None) + self.key_version = kwargs.get('key_version', None) + self.identity = kwargs.get('identity', None) + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = kwargs.get('target_namespace', None) + self.post_migration_name = kwargs.get('post_migration_name', None) + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.default_action = kwargs.get('default_action', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + self.ip_rules = kwargs.get('ip_rules', None) + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = kwargs.get('ip_mask', None) + self.action = kwargs.get('action', "Allow") + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = kwargs.get('subnet', None) + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class PrivateEndpointConnection(Resource): + """Properties of the PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(msrest.serialization.Model): + """Information of the private link resource. + + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str + :param group_id: + :type group_id: str + :param required_members: Required Members. + :type required_members: list[str] + :param required_zone_names: Required Zone Names. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. + + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + self.key = kwargs.get('key', None) + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class Rule(Resource): + """Description of Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.system_data = None + self.action = kwargs.get('action', None) + self.filter_type = kwargs.get('filter_type', None) + self.sql_filter = kwargs.get('sql_filter', None) + self.correlation_filter = kwargs.get('correlation_filter', None) + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = kwargs.get('rights', None) + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespace, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.system_data = None + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = kwargs.get('zone_redundant', None) + self.encryption = kwargs.get('encryption', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = kwargs.get('zone_redundant', None) + self.encryption = kwargs.get('encryption', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + + +class SBQueue(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.system_data = None + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = kwargs.get('lock_duration', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class SBSubscription(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.system_data = None + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = kwargs.get('lock_duration', None) + self.requires_session = kwargs.get('requires_session', None) + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.dead_lettering_on_filter_evaluation_exceptions = kwargs.get('dead_lettering_on_filter_evaluation_exceptions', None) + self.dead_lettering_on_message_expiration = kwargs.get('dead_lettering_on_message_expiration', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.status = kwargs.get('status', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.forward_to = kwargs.get('forward_to', None) + self.forward_dead_lettered_messages_to = kwargs.get('forward_dead_lettered_messages_to', None) + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SBTopic(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.system_data = None + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = kwargs.get('default_message_time_to_live', None) + self.max_size_in_megabytes = kwargs.get('max_size_in_megabytes', None) + self.requires_duplicate_detection = kwargs.get('requires_duplicate_detection', None) + self.duplicate_detection_history_time_window = kwargs.get('duplicate_detection_history_time_window', None) + self.enable_batched_operations = kwargs.get('enable_batched_operations', None) + self.status = kwargs.get('status', None) + self.support_ordering = kwargs.get('support_ordering', None) + self.auto_delete_on_idle = kwargs.get('auto_delete_on_idle', None) + self.enable_partitioning = kwargs.get('enable_partitioning', None) + self.enable_express = kwargs.get('enable_express', None) + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = kwargs.get('sql_expression', None) + self.compatibility_level = kwargs.get('compatibility_level', 20) + self.requires_preprocessing = kwargs.get('requires_preprocessing', True) + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(SqlRuleAction, self).__init__(**kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class UserAssignedIdentityProperties(msrest.serialization.Model): + """UserAssignedIdentityProperties. + + :param user_assigned_identity: ARM ID of user Identity selected for encryption. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentityProperties, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..e229d29ce1e2 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_models_py3.py @@ -0,0 +1,2429 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._service_bus_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """Namespace/ServiceBus Connection String. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_connection_string: Primary connection string of the created namespace + authorization rule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the created namespace + authorization rule. + :vartype secondary_connection_string: str + :ivar alias_primary_connection_string: Primary connection string of the alias if GEO DR is + enabled. + :vartype alias_primary_connection_string: str + :ivar alias_secondary_connection_string: Secondary connection string of the alias if GEO DR is + enabled. + :vartype alias_secondary_connection_string: str + :ivar primary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype primary_key: str + :ivar secondary_key: A base64-encoded 256-bit primary key for signing and validating the SAS + token. + :vartype secondary_key: str + :ivar key_name: A string that describes the authorization rule. + :vartype key_name: str + """ + + _validation = { + 'primary_connection_string': {'readonly': True}, + 'secondary_connection_string': {'readonly': True}, + 'alias_primary_connection_string': {'readonly': True}, + 'alias_secondary_connection_string': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + 'key_name': {'readonly': True}, + } + + _attribute_map = { + 'primary_connection_string': {'key': 'primaryConnectionString', 'type': 'str'}, + 'secondary_connection_string': {'key': 'secondaryConnectionString', 'type': 'str'}, + 'alias_primary_connection_string': {'key': 'aliasPrimaryConnectionString', 'type': 'str'}, + 'alias_secondary_connection_string': {'key': 'aliasSecondaryConnectionString', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'key_name': {'key': 'keyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_connection_string = None + self.secondary_connection_string = None + self.alias_primary_connection_string = None + self.alias_secondary_connection_string = None + self.primary_key = None + self.secondary_key = None + self.key_name = None + + +class Action(msrest.serialization.Model): + """Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class Resource(msrest.serialization.Model): + """The Resource definition for other than namespace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ArmDisasterRecovery(Resource): + """Single item in List or Get Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - + possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: "Accepted", + "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ProvisioningStateDR + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param partner_namespace: ARM Id of the Primary/Secondary eventhub namespace name, which is + part of GEO DR pairing. + :type partner_namespace: str + :param alternate_name: Primary/Secondary eventhub namespace name, which is part of GEO DR + pairing. + :type alternate_name: str + :ivar role: role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' + or 'Secondary'. Possible values include: "Primary", "PrimaryNotReplicating", "Secondary". + :vartype role: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.RoleDisasterRecovery + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'role': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__( + self, + *, + partner_namespace: Optional[str] = None, + alternate_name: Optional[str] = None, + **kwargs + ): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + + +class ArmDisasterRecoveryListResult(msrest.serialization.Model): + """The result of the List Alias(Disaster Recovery configuration) operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Alias(Disaster Recovery configurations). + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Alias(Disaster Recovery configuration). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ArmDisasterRecovery]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ArmDisasterRecovery"]] = None, + **kwargs + ): + super(ArmDisasterRecoveryListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CheckNameAvailability(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The Name to check the namespace name availability and The namespace name + can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it + must end with a letter or number. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(CheckNameAvailability, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """Description of a Check Name availability request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: The detailed info regarding the reason associated with the namespace. + :vartype message: str + :param name_available: Value indicating namespace is availability, true if the namespace is + available; otherwise, false. + :type name_available: bool + :param reason: The reason for unavailability of a namespace. Possible values include: "None", + "InvalidName", "SubscriptionIsDisabled", "NameInUse", "NameInLockdown", + "TooManyNamespaceInCurrentSubscription". + :type reason: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.UnavailableReason + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "UnavailableReason"]] = None, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class ConnectionState(msrest.serialization.Model): + """ConnectionState information. + + :param status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkConnectionStatus + :param description: Description of the connection state. + :type description: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateLinkConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs + ): + super(ConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + + +class CorrelationFilter(msrest.serialization.Model): + """Represents the correlation filter expression. + + :param properties: dictionary object for custom filters. + :type properties: dict[str, str] + :param correlation_id: Identifier of the correlation. + :type correlation_id: str + :param message_id: Identifier of the message. + :type message_id: str + :param to: Address to send to. + :type to: str + :param reply_to: Address of the queue to reply to. + :type reply_to: str + :param label: Application specific label. + :type label: str + :param session_id: Session identifier. + :type session_id: str + :param reply_to_session_id: Session identifier to reply to. + :type reply_to_session_id: str + :param content_type: Content type of the message. + :type content_type: str + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'message_id': {'key': 'messageId', 'type': 'str'}, + 'to': {'key': 'to', 'type': 'str'}, + 'reply_to': {'key': 'replyTo', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'reply_to_session_id': {'key': 'replyToSessionId', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + correlation_id: Optional[str] = None, + message_id: Optional[str] = None, + to: Optional[str] = None, + reply_to: Optional[str] = None, + label: Optional[str] = None, + session_id: Optional[str] = None, + reply_to_session_id: Optional[str] = None, + content_type: Optional[str] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(CorrelationFilter, self).__init__(**kwargs) + self.properties = properties + self.correlation_id = correlation_id + self.message_id = message_id + self.to = to + self.reply_to = reply_to + self.label = label + self.session_id = session_id + self.reply_to_session_id = reply_to_session_id + self.content_type = content_type + self.requires_preprocessing = requires_preprocessing + + +class DictionaryValue(msrest.serialization.Model): + """Recognized Dictionary value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user assigned identity. + :vartype principal_id: str + :ivar client_id: Client Id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DictionaryValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Encryption(msrest.serialization.Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault. + :type key_vault_properties: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyVaultProperties] + :param key_source: Enumerates the possible value of keySource for Encryption. The only + acceptable values to pass in are None and "Microsoft.KeyVault". The default value is + "Microsoft.KeyVault". + :type key_source: str + :param require_infrastructure_encryption: Enable Infrastructure Encryption (Double Encryption). + :type require_infrastructure_encryption: bool + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': '[KeyVaultProperties]'}, + 'key_source': {'key': 'keySource', 'type': 'str'}, + 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'bool'}, + } + + def __init__( + self, + *, + key_vault_properties: Optional[List["KeyVaultProperties"]] = None, + key_source: Optional[str] = "Microsoft.KeyVault", + require_infrastructure_encryption: Optional[bool] = None, + **kwargs + ): + super(Encryption, self).__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.key_source = key_source + self.require_infrastructure_encryption = require_infrastructure_encryption + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(msrest.serialization.Model): + """The resource management error response. + + :param error: The error object. + :type error: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorResponseError"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseError(msrest.serialization.Model): + """The error object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class FailoverProperties(msrest.serialization.Model): + """Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. + + :param is_safe_failover: Safe failover is to indicate the service should wait for pending + replication to finish before switching to the secondary. + :type is_safe_failover: bool + """ + + _attribute_map = { + 'is_safe_failover': {'key': 'properties.IsSafeFailover', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_safe_failover: Optional[bool] = None, + **kwargs + ): + super(FailoverProperties, self).__init__(**kwargs) + self.is_safe_failover = is_safe_failover + + +class Identity(msrest.serialization.Model): + """Properties to configure User Assigned Identities for Bring your Own Keys. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: ObjectId from the KeyVault. + :vartype principal_id: str + :ivar tenant_id: TenantId from the KeyVault. + :vartype tenant_id: str + :param type: Type of managed service identity. Possible values include: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.ManagedServiceIdentityType + :param user_assigned_identities: Properties for User Assigned Identities. + :type user_assigned_identities: dict[str, + ~azure.mgmt.servicebus.v2021_01_01_preview.models.DictionaryValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{DictionaryValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "DictionaryValue"]] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties to configure keyVault Properties. + + :param key_name: Name of the Key from KeyVault. + :type key_name: str + :param key_vault_uri: Uri of KeyVault. + :type key_vault_uri: str + :param key_version: Version of KeyVault. + :type key_version: str + :param identity: + :type identity: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.UserAssignedIdentityProperties + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedIdentityProperties'}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + key_vault_uri: Optional[str] = None, + key_version: Optional[str] = None, + identity: Optional["UserAssignedIdentityProperties"] = None, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = key_name + self.key_vault_uri = key_vault_uri + self.key_version = key_version + self.identity = identity + + +class MessageCountDetails(msrest.serialization.Model): + """Message Count Details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar active_message_count: Number of active messages in the queue, topic, or subscription. + :vartype active_message_count: long + :ivar dead_letter_message_count: Number of messages that are dead lettered. + :vartype dead_letter_message_count: long + :ivar scheduled_message_count: Number of scheduled messages. + :vartype scheduled_message_count: long + :ivar transfer_message_count: Number of messages transferred to another queue, topic, or + subscription. + :vartype transfer_message_count: long + :ivar transfer_dead_letter_message_count: Number of messages transferred into dead letters. + :vartype transfer_dead_letter_message_count: long + """ + + _validation = { + 'active_message_count': {'readonly': True}, + 'dead_letter_message_count': {'readonly': True}, + 'scheduled_message_count': {'readonly': True}, + 'transfer_message_count': {'readonly': True}, + 'transfer_dead_letter_message_count': {'readonly': True}, + } + + _attribute_map = { + 'active_message_count': {'key': 'activeMessageCount', 'type': 'long'}, + 'dead_letter_message_count': {'key': 'deadLetterMessageCount', 'type': 'long'}, + 'scheduled_message_count': {'key': 'scheduledMessageCount', 'type': 'long'}, + 'transfer_message_count': {'key': 'transferMessageCount', 'type': 'long'}, + 'transfer_dead_letter_message_count': {'key': 'transferDeadLetterMessageCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(MessageCountDetails, self).__init__(**kwargs) + self.active_message_count = None + self.dead_letter_message_count = None + self.scheduled_message_count = None + self.transfer_message_count = None + self.transfer_dead_letter_message_count = None + + +class MigrationConfigListResult(msrest.serialization.Model): + """The result of the List migrationConfigurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Migration Configs. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list + of migrationConfigurations. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MigrationConfigProperties]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MigrationConfigProperties"]] = None, + **kwargs + ): + super(MigrationConfigListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MigrationConfigProperties(Resource): + """Single item in List or Get Migration Config operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of Migration Configuration. + :vartype provisioning_state: str + :ivar pending_replication_operations_count: Number of entities pending to be replicated. + :vartype pending_replication_operations_count: long + :param target_namespace: Existing premium Namespace ARM Id name which has no entities, will be + used for migration. + :type target_namespace: str + :param post_migration_name: Name to access Standard Namespace after migration. + :type post_migration_name: str + :ivar migration_state: State in which Standard to Premium Migration is, possible values : + Unknown, Reverting, Completing, Initiating, Syncing, Active. + :vartype migration_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'pending_replication_operations_count': {'readonly': True}, + 'migration_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + 'target_namespace': {'key': 'properties.targetNamespace', 'type': 'str'}, + 'post_migration_name': {'key': 'properties.postMigrationName', 'type': 'str'}, + 'migration_state': {'key': 'properties.migrationState', 'type': 'str'}, + } + + def __init__( + self, + *, + target_namespace: Optional[str] = None, + post_migration_name: Optional[str] = None, + **kwargs + ): + super(MigrationConfigProperties, self).__init__(**kwargs) + self.system_data = None + self.provisioning_state = None + self.pending_replication_operations_count = None + self.target_namespace = target_namespace + self.post_migration_name = post_migration_name + self.migration_state = None + + +class NetworkRuleSet(Resource): + """Description of NetworkRuleSet resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param default_action: Default Action for Network Rule Set. Possible values include: "Allow", + "Deny". + :type default_action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.DefaultAction + :param virtual_network_rules: List VirtualNetwork Rules. + :type virtual_network_rules: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetVirtualNetworkRules] + :param ip_rules: List of IpRules. + :type ip_rules: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NWRuleSetIpRules] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'default_action': {'key': 'properties.defaultAction', 'type': 'str'}, + 'virtual_network_rules': {'key': 'properties.virtualNetworkRules', 'type': '[NWRuleSetVirtualNetworkRules]'}, + 'ip_rules': {'key': 'properties.ipRules', 'type': '[NWRuleSetIpRules]'}, + } + + def __init__( + self, + *, + default_action: Optional[Union[str, "DefaultAction"]] = None, + virtual_network_rules: Optional[List["NWRuleSetVirtualNetworkRules"]] = None, + ip_rules: Optional[List["NWRuleSetIpRules"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.system_data = None + self.default_action = default_action + self.virtual_network_rules = virtual_network_rules + self.ip_rules = ip_rules + + +class NetworkRuleSetListResult(msrest.serialization.Model): + """The response of the List NetworkRuleSet operation. + + :param value: Result of the List NetworkRuleSet operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of NetworkRuleSet. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NetworkRuleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NetworkRuleSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NetworkRuleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NWRuleSetIpRules(msrest.serialization.Model): + """Description of NetWorkRuleSet - IpRules resource. + + :param ip_mask: IP Mask. + :type ip_mask: str + :param action: The IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleIPAction + """ + + _attribute_map = { + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_mask: Optional[str] = None, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NWRuleSetIpRules, self).__init__(**kwargs) + self.ip_mask = ip_mask + self.action = action + + +class NWRuleSetVirtualNetworkRules(msrest.serialization.Model): + """Description of VirtualNetworkRules - NetworkRules resource. + + :param subnet: Subnet properties. + :type subnet: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Subnet + :param ignore_missing_vnet_service_endpoint: Value that indicates whether to ignore missing + VNet Service Endpoint. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _attribute_map = { + 'subnet': {'key': 'subnet', 'type': 'Subnet'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + subnet: Optional["Subnet"] = None, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + super(NWRuleSetVirtualNetworkRules, self).__init__(**kwargs) + self.subnet = subnet + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint + + +class Operation(msrest.serialization.Model): + """A ServiceBus REST API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft.ServiceBus. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Invoice, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list ServiceBus operations. It contains a list of operations and a URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ServiceBus operations supported by the Microsoft.ServiceBus resource + provider. + :vartype value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """PrivateEndpoint information. + + :param id: The ARM identifier for Private Endpoint. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(Resource): + """Properties of the PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param private_endpoint: The Private Endpoint resource for this Connection. + :type private_endpoint: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Details about the state of the connection. + :type private_link_service_connection_state: + ~azure.mgmt.servicebus.v2021_01_01_preview.models.ConnectionState + :param provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :type provisioning_state: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.EndPointProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["ConnectionState"] = None, + provisioning_state: Optional[Union[str, "EndPointProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.system_data = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """Result of the list of all private endpoint connections operation. + + :param value: A collection of private endpoint connection resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + :param next_link: A link for the next page of private endpoint connection resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(msrest.serialization.Model): + """Information of the private link resource. + + :param id: Fully qualified identifier of the resource. + :type id: str + :param name: Name of the resource. + :type name: str + :param type: Type of the resource. + :type type: str + :param group_id: + :type group_id: str + :param required_members: Required Members. + :type required_members: list[str] + :param required_zone_names: Required Zone Names. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Result of the List private link resources operation. + + :param value: A collection of private link resources. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResource] + :param next_link: A link for the next page of private link resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RegenerateAccessKeyParameters(msrest.serialization.Model): + """Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. The access key to regenerate. Possible values include: "PrimaryKey", + "SecondaryKey". + :type key_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is reset for KeyType value or autogenerate Key + value set for keyType. + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "KeyType"], + key: Optional[str] = None, + **kwargs + ): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + self.key = key + + +class ResourceNamespacePatch(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceNamespacePatch, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class Rule(Resource): + """Description of Rule Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param action: Represents the filter actions which are allowed for the transformation of a + message that have been matched by a filter expression. + :type action: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Action + :param filter_type: Filter type that is evaluated against a BrokeredMessage. Possible values + include: "SqlFilter", "CorrelationFilter". + :type filter_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.FilterType + :param sql_filter: Properties of sqlFilter. + :type sql_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SqlFilter + :param correlation_filter: Properties of correlationFilter. + :type correlation_filter: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CorrelationFilter + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'action': {'key': 'properties.action', 'type': 'Action'}, + 'filter_type': {'key': 'properties.filterType', 'type': 'str'}, + 'sql_filter': {'key': 'properties.sqlFilter', 'type': 'SqlFilter'}, + 'correlation_filter': {'key': 'properties.correlationFilter', 'type': 'CorrelationFilter'}, + } + + def __init__( + self, + *, + action: Optional["Action"] = None, + filter_type: Optional[Union[str, "FilterType"]] = None, + sql_filter: Optional["SqlFilter"] = None, + correlation_filter: Optional["CorrelationFilter"] = None, + **kwargs + ): + super(Rule, self).__init__(**kwargs) + self.system_data = None + self.action = action + self.filter_type = filter_type + self.sql_filter = sql_filter + self.correlation_filter = correlation_filter + + +class RuleListResult(msrest.serialization.Model): + """The response of the List rule operation. + + :param value: Result of the List Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Rule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Rule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(RuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBAuthorizationRule(Resource): + """Description of a namespace authorization rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :param rights: The rights associated with the rule. + :type rights: list[str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'rights': {'key': 'properties.rights', 'type': '[str]'}, + } + + def __init__( + self, + *, + rights: Optional[List[Union[str, "AccessRights"]]] = None, + **kwargs + ): + super(SBAuthorizationRule, self).__init__(**kwargs) + self.system_data = None + self.rights = rights + + +class SBAuthorizationRuleListResult(msrest.serialization.Model): + """The response to the List Namespace operation. + + :param value: Result of the List Authorization Rules operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Authorization Rules. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBAuthorizationRule"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class SBNamespace(TrackedResource): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. The Geo-location where the resource lives. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + identity: Optional["Identity"] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(SBNamespace, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.system_data = None + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + + +class SBNamespaceListResult(msrest.serialization.Model): + """The response of the List Namespace operation. + + :param value: Result of the List Namespace operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of Namespaces. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBNamespace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBNamespace"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBNamespaceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBNamespaceUpdateParameters(ResourceNamespacePatch): + """Description of a namespace resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Properties of SKU. + :type sku: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSku + :param identity: Properties of BYOK Identity description. + :type identity: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Identity + :ivar provisioning_state: Provisioning state of the namespace. + :vartype provisioning_state: str + :ivar created_at: The time the namespace was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The time the namespace was updated. + :vartype updated_at: ~datetime.datetime + :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. + :vartype service_bus_endpoint: str + :ivar metric_id: Identifier for Azure Insights metrics. + :vartype metric_id: str + :param zone_redundant: Enabling this property creates a Premium Service Bus Namespace in + regions supported availability zones. + :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description. + :type encryption: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Encryption + :param private_endpoint_connections: List of private endpoint connections. + :type private_endpoint_connections: + list[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'service_bus_endpoint': {'readonly': True}, + 'metric_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'SBSku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'service_bus_endpoint': {'key': 'properties.serviceBusEndpoint', 'type': 'str'}, + 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["SBSku"] = None, + identity: Optional["Identity"] = None, + zone_redundant: Optional[bool] = None, + encryption: Optional["Encryption"] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(SBNamespaceUpdateParameters, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.identity = identity + self.provisioning_state = None + self.created_at = None + self.updated_at = None + self.service_bus_endpoint = None + self.metric_id = None + self.zone_redundant = zone_redundant + self.encryption = encryption + self.private_endpoint_connections = private_endpoint_connections + + +class SBQueue(Resource): + """Description of queue Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar count_details: Message Count Details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :ivar created_at: The exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time a message was sent, or the last time there was a receive request + to this queue. + :vartype accessed_at: ~datetime.datetime + :ivar size_in_bytes: The size of the queue, in bytes. + :vartype size_in_bytes: long + :ivar message_count: The number of messages in the queue. + :vartype message_count: long + :param lock_duration: ISO 8601 timespan duration of a peek-lock; that is, the amount of time + that the message is locked for other receivers. The maximum value for LockDuration is 5 + minutes; the default value is 1 minute. + :type lock_duration: ~datetime.timedelta + :param max_size_in_megabytes: The maximum size of the queue in megabytes, which is the size of + memory allocated for the queue. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: A value indicating if this queue requires duplicate + detection. + :type requires_duplicate_detection: bool + :param requires_session: A value that indicates whether the queue supports the concept of + sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8601 default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_message_expiration: A value that indicates whether this queue has dead + letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: The maximum delivery count. A message is automatically deadlettered + after this number of deliveries. default value is 10. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the queue is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: A value that indicates whether the queue is to be partitioned + across multiple message brokers. + :type enable_partitioning: bool + :param enable_express: A value that indicates whether Express Entities are enabled. An express + queue holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'count_details': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'message_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBQueue, self).__init__(**kwargs) + self.system_data = None + self.count_details = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.size_in_bytes = None + self.message_count = None + self.lock_duration = lock_duration + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBQueueListResult(msrest.serialization.Model): + """The response to the List Queues operation. + + :param value: Result of the List Queues operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of queues. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBQueue]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBQueue"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBQueueListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBSku(msrest.serialization.Model): + """SKU of the namespace. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", + "Premium". + :type name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuName + :param tier: The billing tier of this particular SKU. Possible values include: "Basic", + "Standard", "Premium". + :type tier: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.SkuTier + :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 + and 4. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + tier: Optional[Union[str, "SkuTier"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(SBSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SBSubscription(Resource): + """Description of subscription resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar message_count: Number of messages. + :vartype message_count: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar accessed_at: Last time there was a receive request to this subscription. + :vartype accessed_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param lock_duration: ISO 8061 lock duration timespan for the subscription. The default value + is 1 minute. + :type lock_duration: ~datetime.timedelta + :param requires_session: Value indicating if a subscription supports the concept of sessions. + :type requires_session: bool + :param default_message_time_to_live: ISO 8061 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param dead_lettering_on_filter_evaluation_exceptions: Value that indicates whether a + subscription has dead letter support on filter evaluation exceptions. + :type dead_lettering_on_filter_evaluation_exceptions: bool + :param dead_lettering_on_message_expiration: Value that indicates whether a subscription has + dead letter support when a message expires. + :type dead_lettering_on_message_expiration: bool + :param duplicate_detection_history_time_window: ISO 8601 timeSpan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param max_delivery_count: Number of maximum deliveries. + :type max_delivery_count: int + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param auto_delete_on_idle: ISO 8061 timeSpan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param forward_to: Queue/Topic name to forward the messages. + :type forward_to: str + :param forward_dead_lettered_messages_to: Queue/Topic name to forward the Dead Letter message. + :type forward_dead_lettered_messages_to: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'message_count': {'readonly': True}, + 'created_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'message_count': {'key': 'properties.messageCount', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'lock_duration': {'key': 'properties.lockDuration', 'type': 'duration'}, + 'requires_session': {'key': 'properties.requiresSession', 'type': 'bool'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'dead_lettering_on_filter_evaluation_exceptions': {'key': 'properties.deadLetteringOnFilterEvaluationExceptions', 'type': 'bool'}, + 'dead_lettering_on_message_expiration': {'key': 'properties.deadLetteringOnMessageExpiration', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'max_delivery_count': {'key': 'properties.maxDeliveryCount', 'type': 'int'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'forward_to': {'key': 'properties.forwardTo', 'type': 'str'}, + 'forward_dead_lettered_messages_to': {'key': 'properties.forwardDeadLetteredMessagesTo', 'type': 'str'}, + } + + def __init__( + self, + *, + lock_duration: Optional[datetime.timedelta] = None, + requires_session: Optional[bool] = None, + default_message_time_to_live: Optional[datetime.timedelta] = None, + dead_lettering_on_filter_evaluation_exceptions: Optional[bool] = None, + dead_lettering_on_message_expiration: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + enable_batched_operations: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + forward_to: Optional[str] = None, + forward_dead_lettered_messages_to: Optional[str] = None, + **kwargs + ): + super(SBSubscription, self).__init__(**kwargs) + self.system_data = None + self.message_count = None + self.created_at = None + self.accessed_at = None + self.updated_at = None + self.count_details = None + self.lock_duration = lock_duration + self.requires_session = requires_session + self.default_message_time_to_live = default_message_time_to_live + self.dead_lettering_on_filter_evaluation_exceptions = dead_lettering_on_filter_evaluation_exceptions + self.dead_lettering_on_message_expiration = dead_lettering_on_message_expiration + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.max_delivery_count = max_delivery_count + self.status = status + self.enable_batched_operations = enable_batched_operations + self.auto_delete_on_idle = auto_delete_on_idle + self.forward_to = forward_to + self.forward_dead_lettered_messages_to = forward_dead_lettered_messages_to + + +class SBSubscriptionListResult(msrest.serialization.Model): + """The response to the List Subscriptions operation. + + :param value: Result of the List Subscriptions operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of subscriptions. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBSubscription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBSubscription"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBSubscriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SBTopic(Resource): + """Description of topic resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SystemData + :ivar size_in_bytes: Size of the topic, in bytes. + :vartype size_in_bytes: long + :ivar created_at: Exact time the message was created. + :vartype created_at: ~datetime.datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: ~datetime.datetime + :ivar accessed_at: Last time the message was sent, or a request was received, for this topic. + :vartype accessed_at: ~datetime.datetime + :ivar subscription_count: Number of subscriptions. + :vartype subscription_count: int + :ivar count_details: Message count details. + :vartype count_details: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MessageCountDetails + :param default_message_time_to_live: ISO 8601 Default message timespan to live value. This is + the duration after which the message expires, starting from when the message is sent to Service + Bus. This is the default value used when TimeToLive is not set on a message itself. + :type default_message_time_to_live: ~datetime.timedelta + :param max_size_in_megabytes: Maximum size of the topic in megabytes, which is the size of the + memory allocated for the topic. Default is 1024. + :type max_size_in_megabytes: int + :param requires_duplicate_detection: Value indicating if this topic requires duplicate + detection. + :type requires_duplicate_detection: bool + :param duplicate_detection_history_time_window: ISO8601 timespan structure that defines the + duration of the duplicate detection history. The default value is 10 minutes. + :type duplicate_detection_history_time_window: ~datetime.timedelta + :param enable_batched_operations: Value that indicates whether server-side batched operations + are enabled. + :type enable_batched_operations: bool + :param status: Enumerates the possible values for the status of a messaging entity. Possible + values include: "Active", "Disabled", "Restoring", "SendDisabled", "ReceiveDisabled", + "Creating", "Deleting", "Renaming", "Unknown". + :type status: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.EntityStatus + :param support_ordering: Value that indicates whether the topic supports ordering. + :type support_ordering: bool + :param auto_delete_on_idle: ISO 8601 timespan idle interval after which the topic is + automatically deleted. The minimum duration is 5 minutes. + :type auto_delete_on_idle: ~datetime.timedelta + :param enable_partitioning: Value that indicates whether the topic to be partitioned across + multiple message brokers is enabled. + :type enable_partitioning: bool + :param enable_express: Value that indicates whether Express Entities are enabled. An express + topic holds a message in memory temporarily before writing it to persistent storage. + :type enable_express: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + 'accessed_at': {'readonly': True}, + 'subscription_count': {'readonly': True}, + 'count_details': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'accessed_at': {'key': 'properties.accessedAt', 'type': 'iso-8601'}, + 'subscription_count': {'key': 'properties.subscriptionCount', 'type': 'int'}, + 'count_details': {'key': 'properties.countDetails', 'type': 'MessageCountDetails'}, + 'default_message_time_to_live': {'key': 'properties.defaultMessageTimeToLive', 'type': 'duration'}, + 'max_size_in_megabytes': {'key': 'properties.maxSizeInMegabytes', 'type': 'int'}, + 'requires_duplicate_detection': {'key': 'properties.requiresDuplicateDetection', 'type': 'bool'}, + 'duplicate_detection_history_time_window': {'key': 'properties.duplicateDetectionHistoryTimeWindow', 'type': 'duration'}, + 'enable_batched_operations': {'key': 'properties.enableBatchedOperations', 'type': 'bool'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'support_ordering': {'key': 'properties.supportOrdering', 'type': 'bool'}, + 'auto_delete_on_idle': {'key': 'properties.autoDeleteOnIdle', 'type': 'duration'}, + 'enable_partitioning': {'key': 'properties.enablePartitioning', 'type': 'bool'}, + 'enable_express': {'key': 'properties.enableExpress', 'type': 'bool'}, + } + + def __init__( + self, + *, + default_message_time_to_live: Optional[datetime.timedelta] = None, + max_size_in_megabytes: Optional[int] = None, + requires_duplicate_detection: Optional[bool] = None, + duplicate_detection_history_time_window: Optional[datetime.timedelta] = None, + enable_batched_operations: Optional[bool] = None, + status: Optional[Union[str, "EntityStatus"]] = None, + support_ordering: Optional[bool] = None, + auto_delete_on_idle: Optional[datetime.timedelta] = None, + enable_partitioning: Optional[bool] = None, + enable_express: Optional[bool] = None, + **kwargs + ): + super(SBTopic, self).__init__(**kwargs) + self.system_data = None + self.size_in_bytes = None + self.created_at = None + self.updated_at = None + self.accessed_at = None + self.subscription_count = None + self.count_details = None + self.default_message_time_to_live = default_message_time_to_live + self.max_size_in_megabytes = max_size_in_megabytes + self.requires_duplicate_detection = requires_duplicate_detection + self.duplicate_detection_history_time_window = duplicate_detection_history_time_window + self.enable_batched_operations = enable_batched_operations + self.status = status + self.support_ordering = support_ordering + self.auto_delete_on_idle = auto_delete_on_idle + self.enable_partitioning = enable_partitioning + self.enable_express = enable_express + + +class SBTopicListResult(msrest.serialization.Model): + """The response to the List Topics operation. + + :param value: Result of the List Topics operation. + :type value: list[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic] + :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + of topics. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SBTopic]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SBTopic"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SBTopicListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SqlFilter(msrest.serialization.Model): + """Represents a filter which is a composition of an expression and an action that is executed in the pub/sub pipeline. + + :param sql_expression: The SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _validation = { + 'compatibility_level': {'maximum': 20, 'minimum': 20}, + } + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = 20, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlFilter, self).__init__(**kwargs) + self.sql_expression = sql_expression + self.compatibility_level = compatibility_level + self.requires_preprocessing = requires_preprocessing + + +class SqlRuleAction(Action): + """Represents set of actions written in SQL language-based syntax that is performed against a ServiceBus.Messaging.BrokeredMessage. + + :param sql_expression: SQL expression. e.g. MyProperty='ABC'. + :type sql_expression: str + :param compatibility_level: This property is reserved for future use. An integer value showing + the compatibility level, currently hard-coded to 20. + :type compatibility_level: int + :param requires_preprocessing: Value that indicates whether the rule action requires + preprocessing. + :type requires_preprocessing: bool + """ + + _attribute_map = { + 'sql_expression': {'key': 'sqlExpression', 'type': 'str'}, + 'compatibility_level': {'key': 'compatibilityLevel', 'type': 'int'}, + 'requires_preprocessing': {'key': 'requiresPreprocessing', 'type': 'bool'}, + } + + def __init__( + self, + *, + sql_expression: Optional[str] = None, + compatibility_level: Optional[int] = None, + requires_preprocessing: Optional[bool] = True, + **kwargs + ): + super(SqlRuleAction, self).__init__(sql_expression=sql_expression, compatibility_level=compatibility_level, requires_preprocessing=requires_preprocessing, **kwargs) + + +class Subnet(msrest.serialization.Model): + """Properties supplied for Subnet. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Resource ID of Virtual Network Subnet. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(Subnet, self).__init__(**kwargs) + self.id = id + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.servicebus.v2021_01_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UserAssignedIdentityProperties(msrest.serialization.Model): + """UserAssignedIdentityProperties. + + :param user_assigned_identity: ARM ID of user Identity selected for encryption. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(UserAssignedIdentityProperties, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py new file mode 100644 index 000000000000..a6add4bc73f7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/models/_service_bus_management_client_enums.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + MANAGE = "Manage" + SEND = "Send" + LISTEN = "Listen" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + ALLOW = "Allow" + DENY = "Deny" + +class EndPointProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Private Endpoint Connection. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + +class EntityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Entity status. + """ + + ACTIVE = "Active" + DISABLED = "Disabled" + RESTORING = "Restoring" + SEND_DISABLED = "SendDisabled" + RECEIVE_DISABLED = "ReceiveDisabled" + CREATING = "Creating" + DELETING = "Deleting" + RENAMING = "Renaming" + UNKNOWN = "Unknown" + +class FilterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rule filter types + """ + + SQL_FILTER = "SqlFilter" + CORRELATION_FILTER = "CorrelationFilter" + +class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The access key to regenerate. + """ + + PRIMARY_KEY = "PrimaryKey" + SECONDARY_KEY = "SecondaryKey" + +class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class MigrationConfigurationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + _DEFAULT = "$default" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The IP Filter Action + """ + + ALLOW = "Allow" + +class PrivateLinkConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the connection. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningStateDR(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' + or 'Succeeded' or 'Failed' + """ + + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class RoleDisasterRecovery(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or + 'Secondary' + """ + + PRIMARY = "Primary" + PRIMARY_NOT_REPLICATING = "PrimaryNotReplicating" + SECONDARY = "Secondary" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Name of this SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier of this particular SKU. + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class UnavailableReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reason for the unavailability of the service. + """ + + NONE = "None" + INVALID_NAME = "InvalidName" + SUBSCRIPTION_IS_DISABLED = "SubscriptionIsDisabled" + NAME_IN_USE = "NameInUse" + NAME_IN_LOCKDOWN = "NameInLockdown" + TOO_MANY_NAMESPACE_IN_CURRENT_SUBSCRIPTION = "TooManyNamespaceInCurrentSubscription" diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..e278debc144f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/__init__.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._namespaces_operations import NamespacesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._migration_configs_operations import MigrationConfigsOperations +from ._queues_operations import QueuesOperations +from ._topics_operations import TopicsOperations +from ._rules_operations import RulesOperations +from ._subscriptions_operations import SubscriptionsOperations + +__all__ = [ + 'NamespacesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'DisasterRecoveryConfigsOperations', + 'MigrationConfigsOperations', + 'QueuesOperations', + 'TopicsOperations', + 'RulesOperations', + 'SubscriptionsOperations', +] diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..1742d9b97f0f --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,739 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DisasterRecoveryConfigsOperations(object): + """DisasterRecoveryConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def check_name_availability( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} # type: ignore + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ArmDisasterRecoveryListResult"] + """Gets all Alias(Disaster Recovery configurations). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ArmDisasterRecoveryListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecoveryListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecoveryListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ArmDisasterRecoveryListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters, # type: "_models.ArmDisasterRecovery" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ArmDisasterRecovery"] + """Creates or updates a new Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArmDisasterRecovery"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an Alias(Disaster Recovery configuration). + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ArmDisasterRecovery" + """Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ArmDisasterRecovery, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.ArmDisasterRecovery + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArmDisasterRecovery"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ArmDisasterRecovery', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} # type: ignore + + def break_pairing( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """This operation disables the Disaster Recovery and stops replicating changes from primary to + secondary namespaces. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.break_pairing.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} # type: ignore + + def fail_over( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + parameters=None, # type: Optional["_models.FailoverProperties"] + **kwargs # type: Any + ): + # type: (...) -> None + """Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param parameters: Parameters required to create an Alias(Disaster Recovery configuration). + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.FailoverProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fail_over.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'FailoverProperties') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + alias, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param alias: The Disaster Recovery configuration name. + :type alias: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'alias': self._serialize.url("alias", alias, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py new file mode 100644 index 000000000000..28b7801c1315 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_migration_configs_operations.py @@ -0,0 +1,510 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MigrationConfigsOperations(object): + """MigrationConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MigrationConfigListResult"] + """Gets all migrationConfigurations. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MigrationConfigListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MigrationConfigListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations'} # type: ignore + + def _create_and_start_migration_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MigrationConfigProperties"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MigrationConfigProperties"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_and_start_migration_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'MigrationConfigProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_and_start_migration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def begin_create_and_start_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + parameters, # type: "_models.MigrationConfigProperties" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MigrationConfigProperties"] + """Creates Migration configuration and starts migration of entities from Standard to Premium + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :param parameters: Parameters required to create Migration Configuration. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MigrationConfigProperties or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_and_start_migration_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + config_name=config_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_and_start_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a MigrationConfiguration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MigrationConfigProperties" + """Retrieves Migration Config. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MigrationConfigProperties, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MigrationConfigProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MigrationConfigProperties', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}'} # type: ignore + + def complete_migration( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation Completes Migration of entities by pointing the connection strings to Premium + namespace and any entities created after the operation will be under Premium Namespace. + CompleteMigration operation will fail when entity migration is in-progress. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.complete_migration.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + complete_migration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade'} # type: ignore + + def revert( + self, + resource_group_name, # type: str + namespace_name, # type: str + config_name, # type: Union[str, "_models.MigrationConfigurationName"] + **kwargs # type: Any + ): + # type: (...) -> None + """This operation reverts Migration. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param config_name: The configuration name. Should always be "$default". + :type config_name: str or ~azure.mgmt.servicebus.v2021_01_01_preview.models.MigrationConfigurationName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.revert.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'configName': self._serialize.url("config_name", config_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py new file mode 100644 index 000000000000..f2a96e6c5ffd --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_namespaces_operations.py @@ -0,0 +1,1240 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets all the available namespaces within the subscription, irrespective of the resource groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBNamespaceListResult"] + """Gets the available namespaces within a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBNamespaceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespaceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBNamespaceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespace" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SBNamespace"] + """Creates or updates a service namespace. Once created, this namespace's resource manifest is + immutable. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to create a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SBNamespace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing namespace. This operation also removes all associated resources under the + namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBNamespace" + """Gets a description for the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBNamespace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.SBNamespaceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SBNamespace"] + """Updates a service namespace. Once created, this namespace's resource manifest is immutable. + This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: Parameters supplied to update a namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespaceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBNamespace, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBNamespace or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SBNamespace"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBNamespaceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SBNamespace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}'} # type: ignore + + def create_or_update_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + parameters, # type: "_models.NetworkRuleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Create or update NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param parameters: The Namespace IpFilterRule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def get_network_rule_set( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NetworkRuleSet" + """Gets NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NetworkRuleSet, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_network_rule_set.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NetworkRuleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default'} # type: ignore + + def list_network_rule_sets( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NetworkRuleSetListResult"] + """Gets list of NetworkRuleSet for a Namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkRuleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.NetworkRuleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkRuleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NetworkRuleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets'} # type: ignore + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets the authorization rules for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates or updates an authorization rule for a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a namespace authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a namespace by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings for the namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def check_name_availability( + self, + parameters, # type: "_models.CheckNameAvailability" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Check the give namespace name availability. + + :param parameters: Parameters to check availability of the given namespace name. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailability + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'CheckNameAvailability') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py new file mode 100644 index 000000000000..5b1e4b714492 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available ServiceBus REST API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2017-04-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.ServiceBus/operations'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..2e35b3bb49f7 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,383 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + """Gets the available PrivateEndpointConnections within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + parameters, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Creates or updates PrivateEndpointConnections of service namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :param parameters: Parameters supplied to update Status of PrivateEndPoint Connection to + namespace resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an existing Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Gets a description for the specified Private Endpoint Connection. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param private_endpoint_connection_name: The PrivateEndpointConnection name. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..da52a0b09b34 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResourcesListResult" + """Gets lists of resources that supports Privatelinks. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py new file mode 100644 index 000000000000..c1af17fdfa9b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_queues_operations.py @@ -0,0 +1,764 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QueuesOperations(object): + """QueuesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets all authorization rules for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for a queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Gets an authorization rule for a queue by rule name. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Primary and secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates the primary or secondary connection strings to the queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBQueueListResult"] + """Gets the queues within a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBQueueListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueueListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueueListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBQueueListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + parameters, # type: "_models.SBQueue" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Creates or updates a Service Bus queue. This operation is idempotent. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :param parameters: Parameters supplied to create or update a queue resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBQueue') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a queue from the specified namespace in a resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBQueue" + """Returns a description for the specified queue. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param queue_name: The queue name. + :type queue_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBQueue, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBQueue + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBQueue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'queueName': self._serialize.url("queue_name", queue_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBQueue', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py new file mode 100644 index 000000000000..24184888dfe3 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_rules_operations.py @@ -0,0 +1,363 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RulesOperations(object): + """RulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscriptions( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RuleListResult"] + """List all the rules within given topic-subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.RuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscriptions.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscriptions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + parameters, # type: "_models.Rule" + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Creates a new rule and updates an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :param parameters: Parameters supplied to create a rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Rule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Rule" + """Retrieves the description for the specified rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param rule_name: The rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Rule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.Rule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Rule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'ruleName': self._serialize.url("rule_name", rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Rule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py new file mode 100644 index 000000000000..3fe7d2ae0b5b --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_subscriptions_operations.py @@ -0,0 +1,347 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionsOperations(object): + """SubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_topic( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBSubscriptionListResult"] + """List all the subscriptions under a specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBSubscriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_topic.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBSubscriptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_topic.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + parameters, # type: "_models.SBSubscription" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Creates a topic subscription. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :param parameters: Parameters supplied to create a subscription resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBSubscription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a subscription from the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBSubscription" + """Returns a subscription description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param subscription_name: The subscription name. + :type subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionName': self._serialize.url("subscription_name", subscription_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py new file mode 100644 index 000000000000..8976202c588a --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/operations/_topics_operations.py @@ -0,0 +1,764 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TopicsOperations(object): + """TopicsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.servicebus.v2021_01_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_authorization_rules( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBAuthorizationRuleListResult"] + """Gets authorization rules for a topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBAuthorizationRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules'} # type: ignore + + def create_or_update_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.SBAuthorizationRule" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Creates an authorization rule for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: The shared access authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBAuthorizationRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def get_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBAuthorizationRule" + """Returns the specified authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def delete_authorization_rule( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic authorization rule. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete_authorization_rule.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Gets the primary and secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys'} # type: ignore + + def regenerate_keys( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + authorization_rule_name, # type: str + parameters, # type: "_models.RegenerateAccessKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.AccessKeys" + """Regenerates primary or secondary connection strings for the topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param parameters: Parameters supplied to regenerate the authorization rule. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.RegenerateAccessKeyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', max_length=50, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} # type: ignore + + def list_by_namespace( + self, + resource_group_name, # type: str + namespace_name, # type: str + skip=None, # type: Optional[int] + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SBTopicListResult"] + """Gets all the topics in a namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param skip: Skip is only used if a previous operation returned a partial result. If a previous + response contains a nextLink element, the value of the nextLink element will include a skip + parameter that specifies a starting point to use for subsequent calls. + :type skip: int + :param top: May be used to limit the number of results to the most recent N usageDetails. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SBTopicListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopicListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopicListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', maximum=1000, minimum=0) + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SBTopicListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + parameters, # type: "_models.SBTopic" + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Creates a topic in the specified namespace. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :param parameters: Parameters supplied to create a topic resource. + :type parameters: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SBTopic') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a topic from the specified namespace and resource group. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + namespace_name, # type: str + topic_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SBTopic" + """Returns a description for the specified topic. + + :param resource_group_name: Name of the Resource group within the Azure subscription. + :type resource_group_name: str + :param namespace_name: The namespace name. + :type namespace_name: str + :param topic_name: The topic name. + :type topic_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SBTopic, or the result of cls(response) + :rtype: ~azure.mgmt.servicebus.v2021_01_01_preview.models.SBTopic + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SBTopic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'topicName': self._serialize.url("topic_name", topic_name, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SBTopic', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}'} # type: ignore diff --git a/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2021_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicebus/azure-mgmt-servicebus/setup.py b/sdk/servicebus/azure-mgmt-servicebus/setup.py index 0b33662d71cf..3224763159d6 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/setup.py +++ b/sdk/servicebus/azure-mgmt-servicebus/setup.py @@ -78,7 +78,7 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', + 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.2.0,<2.0.0', ], diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_disaster_recovery_configs.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_disaster_recovery_configs.yaml deleted file mode 100644 index e3c0b108ee9a..000000000000 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_disaster_recovery_configs.yaml +++ /dev/null @@ -1,481 +0,0 @@ -interactions: -- request: - body: '{"location": "eastus", "tags": {"tag1": "value1", "tag2": "value2"}, "sku": - {"name": "Premium", "tier": "Premium"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '115' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab","name":"myNamespacexxyyzzxyyab","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyab","createdAt":"2020-11-23T09:38:33.01Z","updatedAt":"2020-11-23T09:38:33.01Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyab.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '726' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:38:35 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab","name":"myNamespacexxyyzzxyyab","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyab","createdAt":"2020-11-23T09:38:33.01Z","updatedAt":"2020-11-23T09:38:33.01Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyab.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '726' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:39:05 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab","name":"myNamespacexxyyzzxyyab","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyab","createdAt":"2020-11-23T09:38:33.01Z","updatedAt":"2020-11-23T09:38:33.01Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyab.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '726' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:39:35 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab","name":"myNamespacexxyyzzxyyab","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyab","createdAt":"2020-11-23T09:38:33.01Z","updatedAt":"2020-11-23T09:39:42.877Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyab.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '725' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:40:07 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"location": "westus", "tags": {"tag1": "value1", "tag2": "value2"}, "sku": - {"name": "Premium", "tier": "Premium"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '115' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond","name":"myNamespacexxyyzzzyasecond","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzzyasecond","createdAt":"2020-11-23T09:40:12.86Z","updatedAt":"2020-11-23T09:40:12.86Z","serviceBusEndpoint":"https://myNamespacexxyyzzzyasecond.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '742' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:40:15 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond","name":"myNamespacexxyyzzzyasecond","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzzyasecond","createdAt":"2020-11-23T09:40:12.86Z","updatedAt":"2020-11-23T09:40:12.86Z","serviceBusEndpoint":"https://myNamespacexxyyzzzyasecond.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '742' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:40:46 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond","name":"myNamespacexxyyzzzyasecond","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzzyasecond","createdAt":"2020-11-23T09:40:12.86Z","updatedAt":"2020-11-23T09:40:12.86Z","serviceBusEndpoint":"https://myNamespacexxyyzzzyasecond.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '742' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:41:16 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzzyasecond","name":"myNamespacexxyyzzzyasecond","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzzyasecond","createdAt":"2020-11-23T09:40:12.86Z","updatedAt":"2020-11-23T09:41:18.28Z","serviceBusEndpoint":"https://myNamespacexxyyzzzyasecond.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '740' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:41:46 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"properties": {"rights": ["Listen", "Send"]}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '46' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab/AuthorizationRules/myAuthorizationRule?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab/AuthorizationRules/myAuthorizationRule","name":"myAuthorizationRule","type":"Microsoft.ServiceBus/Namespaces/AuthorizationRules","location":"East - US","properties":{"rights":["Listen","Send"]}}' - headers: - cache-control: - - no-cache - content-length: - - '407' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:41:53 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 200 - message: OK -- request: - body: '{"name": "sdk-DisasterRecovery-9474"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '37' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyab/disasterRecoveryConfigs/CheckNameAvailability?api-version=2018-01-01-preview - response: - body: - string: '{"error":{"code":"NoRegisteredProviderFound","message":"No registered - resource provider found for location ''eastus'' and API version ''2018-01-01-preview'' - for type ''namespaces/disasterrecoveryconfigs''. The supported api-versions - are ''2017-04-01''. The supported locations are ''''."}}' - headers: - cache-control: - - no-cache - content-length: - - '279' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:41:56 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-failure-cause: - - gateway - status: - code: 400 - message: Bad Request -version: 1 diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_migration_configs.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_migration_configs.yaml deleted file mode 100644 index eb4866724067..000000000000 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_migration_configs.yaml +++ /dev/null @@ -1,1155 +0,0 @@ -interactions: -- request: - body: '{"location": "eastus", "tags": {"tag1": "value1", "tag2": "value2"}, "sku": - {"name": "Standard", "tier": "Standard"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '117' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyma","createdAt":"2020-11-23T08:53:51.213Z","updatedAt":"2020-11-23T08:53:51.213Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyma.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '717' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:53:54 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyma","createdAt":"2020-11-23T08:53:51.213Z","updatedAt":"2020-11-23T08:53:51.213Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyma.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '717' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:54:24 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyma","createdAt":"2020-11-23T08:53:51.213Z","updatedAt":"2020-11-23T08:54:34.847Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyma.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '715' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:54:54 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"location": "westus", "tags": {"tag1": "value1", "tag2": "value2"}, "sku": - {"name": "Premium", "tier": "Premium"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '115' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T08:55:00.353Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '748' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:55:02 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T08:55:00.353Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '748' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:55:34 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T08:55:00.353Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '748' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:56:05 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T08:56:07.327Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '746' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:56:35 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"properties": {"rights": ["Listen", "Send"]}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '46' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/AuthorizationRules/myAuthorizationRule?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/AuthorizationRules/myAuthorizationRule","name":"myAuthorizationRule","type":"Microsoft.ServiceBus/Namespaces/AuthorizationRules","location":"East - US","properties":{"rights":["Listen","Send"]}}' - headers: - cache-control: - - no-cache - content-length: - - '407' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:56:41 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 200 - message: OK -- request: - body: '{"properties": {"targetNamespace": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm", - "postMigrationName": "postmigrationxxxky"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '294' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Initiating"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:56:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1196' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Initiating"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:57:19 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Initiating"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:57:49 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Succeeded","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","pendingReplicationOperationsCount":0,"migrationState":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '731' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:58:22 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"targetNamespaceType": "EventHub"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '35' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrate?api-version=2017-04-01 - response: - body: - string: '""' - headers: - cache-control: - - no-cache - content-length: - - '2' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:58:24 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default/revert?api-version=2017-04-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Mon, 23 Nov 2020 08:58:24 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default/upgrade?api-version=2017-04-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Mon, 23 Nov 2020 08:58:25 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Completing"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:58:25 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Completing"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:58:55 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Accepted","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Completing"}}' - headers: - cache-control: - - no-cache - content-length: - - '696' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:59:26 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/$default","name":"myNamespacexxyyzzxyyma","type":"Microsoft.ServiceBus/Namespaces/migrationconfigurations","properties":{"provisioningState":"Succeeded","targetNamespace":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","postMigrationName":"postmigrationxxxky","migrationState":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '693' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:59:56 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma/migrationConfigurations/%24default?api-version=2017-04-01 - response: - body: - string: '{"error":{"message":"Alias ''myNamespacexxyyzzxyyma'' does not exist - or is not associated with namespace ''myNamespacexxyyzzxyyma''. CorrelationId: - 1d0ac610-5ccc-49b2-8104-89e129d07868","code":"NotFound"}}' - headers: - cache-control: - - no-cache - content-length: - - '201' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:59:56 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' - status: - code: 404 - message: Not Found -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyma?api-version=2018-01-01-preview - response: - body: - string: '' - headers: - cache-control: - - no-cache - date: - - Mon, 23 Nov 2020 09:00:06 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14998' - status: - code: 204 - message: No Content -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Mon, 23 Nov 2020 09:00:07 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/SN1 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/SN1 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14997' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T09:00:07.527Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Removing"}}' - headers: - cache-control: - - no-cache - content-length: - - '748' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:00:38 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm","name":"myNamespacexxyyzzykksecondm","type":"Microsoft.ServiceBus/Namespaces","location":"West - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzykksecondm","createdAt":"2020-11-23T08:55:00.353Z","updatedAt":"2020-11-23T09:00:07.527Z","serviceBusEndpoint":"https://myNamespacexxyyzzykksecondm.servicebus.windows.net:443/","status":"Removing"}}' - headers: - cache-control: - - no-cache - content-length: - - '748' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:01:26 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm/operationresults/myNamespacexxyyzzykksecondm?api-version=2018-01-01-preview - response: - body: - string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.ServiceBus/namespaces/myNamespacexxyyzzykksecondm'' - under resource group ''rgname'' was not found. For more details please go - to https://aka.ms/ARMResourceNotFoundFix"}}' - headers: - cache-control: - - no-cache - content-length: - - '306' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:01:59 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-failure-cause: - - gateway - status: - code: 404 - message: Not Found -version: 1 diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_namespace.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_namespace.yaml deleted file mode 100644 index 40ca2fb749c2..000000000000 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_namespace.test_namespace.yaml +++ /dev/null @@ -1,1170 +0,0 @@ -interactions: -- request: - body: '{"location": "eastus", "properties": {"addressSpace": {"addressPrefixes": - ["10.0.0.0/16"]}}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '92' - Content-Type: - - application/json - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork?api-version=2020-06-01 - response: - body: - string: "{\r\n \"name\": \"myVirtualNetwork\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork\"\ - ,\r\n \"etag\": \"W/\\\"eae0e35f-d5e8-460d-acc9-300d1f6c59d0\\\"\",\r\n \ - \ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ - \ \"resourceGuid\": \"0031f84a-141e-43fe-887b-8236bd68fd80\",\r\n \"\ - addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\ - \r\n ]\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\"\ - : [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\"\ - : false\r\n }\r\n}" - headers: - azure-asyncnotification: - - Enabled - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/e4ffb3b1-21bf-49b5-b116-613c344b21cf?api-version=2020-06-01 - cache-control: - - no-cache - content-length: - - '719' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:14 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 42691da0-d9cf-4328-8523-8b3048d8c8dc - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/e4ffb3b1-21bf-49b5-b116-613c344b21cf?api-version=2020-06-01 - response: - body: - string: "{\r\n \"status\": \"Succeeded\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '29' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:18 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 71e598c7-6064-4494-ab8d-0f794ae068ac - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork?api-version=2020-06-01 - response: - body: - string: "{\r\n \"name\": \"myVirtualNetwork\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork\"\ - ,\r\n \"etag\": \"W/\\\"a498d5ed-5c1e-4c2b-b90b-1d0c029d8f99\\\"\",\r\n \ - \ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\"\ - ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n\ - \ \"resourceGuid\": \"0031f84a-141e-43fe-887b-8236bd68fd80\",\r\n \"\ - addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\ - \r\n ]\r\n },\r\n \"subnets\": [],\r\n \"virtualNetworkPeerings\"\ - : [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\"\ - : false\r\n }\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:19 GMT - etag: - - W/"a498d5ed-5c1e-4c2b-b90b-1d0c029d8f99" - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - f1eac309-f1c1-44c1-a6de-987dd1b645ad - status: - code: 200 - message: OK -- request: - body: '{"properties": {"addressPrefix": "10.0.0.0/24"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '48' - Content-Type: - - application/json - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet?api-version=2020-06-01 - response: - body: - string: "{\r\n \"name\": \"mySubnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet\"\ - ,\r\n \"etag\": \"W/\\\"a22f90d3-8c73-4f11-9174-9d0a8c843489\\\"\",\r\n \ - \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\ - addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\"\ - : \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\ - \n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/e324e11f-d304-45d5-bdad-ec99f244b6d6?api-version=2020-06-01 - cache-control: - - no-cache - content-length: - - '598' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:19 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 3300a4d2-1f7e-485e-8c7b-fcca73c3b030 - x-ms-ratelimit-remaining-subscription-writes: - - '1196' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus/operations/e324e11f-d304-45d5-bdad-ec99f244b6d6?api-version=2020-06-01 - response: - body: - string: "{\r\n \"status\": \"Succeeded\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '29' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:23 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - 85e6b452-bcec-4f7a-b97d-5d0822dc8473 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-azure-mgmt-network/16.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet?api-version=2020-06-01 - response: - body: - string: "{\r\n \"name\": \"mySubnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet\"\ - ,\r\n \"etag\": \"W/\\\"9336c3ca-0092-48b1-8331-2890b644a495\\\"\",\r\n \ - \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\ - addressPrefix\": \"10.0.0.0/24\",\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\"\ - : \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\ - \n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '599' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:23 GMT - etag: - - W/"9336c3ca-0092-48b1-8331-2890b644a495" - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-arm-service-request-id: - - c42ec4e1-77a4-4c6c-8168-8b4855a793ab - status: - code: 200 - message: OK -- request: - body: '{"location": "eastus", "tags": {"tag1": "value1", "tag2": "value2"}, "sku": - {"name": "Premium", "tier": "Premium"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '115' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:25:33.627Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:25:35 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:25:33.627Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:26:06 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:25:33.627Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:26:37 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:26:39.987Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '718' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:07 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"properties": {"rights": ["Listen", "Send"]}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '46' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule","name":"myAuthorizationRule","type":"Microsoft.ServiceBus/Namespaces/AuthorizationRules","location":"East - US","properties":{"rights":["Listen","Send"]}}' - headers: - cache-control: - - no-cache - content-length: - - '405' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:15 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1196' - status: - code: 200 - message: OK -- request: - body: '{"properties": {"defaultAction": "Deny", "virtualNetworkRules": [{"subnet": - {"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"}, - "ignoreMissingVnetServiceEndpoint": true}], "ipRules": [{"ipMask": "1.1.1.1", - "action": "Allow"}, {"ipMask": "1.1.1.2", "action": "Allow"}, {"ipMask": "1.1.1.3", - "action": "Allow"}, {"ipMask": "1.1.1.4", "action": "Allow"}, {"ipMask": "1.1.1.5", - "action": "Allow"}]}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '575' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/networkrulesets/default?api-version=2018-01-01-preview - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/networkrulesets/default","name":"default","type":"Microsoft.ServiceBus/Namespaces/NetworkRuleSets","location":"East - US","properties":{"defaultAction":"Deny","virtualNetworkRules":[{"subnet":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"},"ignoreMissingVnetServiceEndpoint":true}],"ipRules":[{"ipMask":"1.1.1.1","action":"Allow"},{"ipMask":"1.1.1.2","action":"Allow"},{"ipMask":"1.1.1.3","action":"Allow"},{"ipMask":"1.1.1.4","action":"Allow"},{"ipMask":"1.1.1.5","action":"Allow"}]}}' - headers: - cache-control: - - no-cache - content-length: - - '878' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:33 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1195' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule?api-version=2017-04-01 - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule","name":"myAuthorizationRule","type":"Microsoft.ServiceBus/Namespaces/AuthorizationRules","location":"East - US","properties":{"rights":["Listen","Send"]}}' - headers: - cache-control: - - no-cache - content-length: - - '405' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:33 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/networkrulesets/default?api-version=2018-01-01-preview - response: - body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/networkrulesets/default","name":"default","type":"Microsoft.ServiceBus/Namespaces/NetworkRuleSets","location":"East - US","properties":{"defaultAction":"Deny","virtualNetworkRules":[{"subnet":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgname/providers/Microsoft.Network/virtualNetworks/myvirtualnetwork/subnets/mysubnet"},"ignoreMissingVnetServiceEndpoint":true}],"ipRules":[{"ipMask":"1.1.1.1","action":"Allow"},{"ipMask":"1.1.1.2","action":"Allow"},{"ipMask":"1.1.1.3","action":"Allow"},{"ipMask":"1.1.1.4","action":"Allow"},{"ipMask":"1.1.1.5","action":"Allow"}]}}' - headers: - cache-control: - - no-cache - content-length: - - '878' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:34 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:26:39.987Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Active"}}' - headers: - cache-control: - - no-cache - content-length: - - '718' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:35 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: '{"keyType": "PrimaryKey"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '25' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule/regenerateKeys?api-version=2017-04-01 - response: - body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=y7bnOc0bL9c5vCd9zPZUG8r5UJnTi1fhgIHM1gtKCAw=","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=qWzzMThcxjCUpecY5jlO08vpSAiFmVHjBORWyl7DwfM=","primaryKey":"y7bnOc0bL9c5vCd9zPZUG8r5UJnTi1fhgIHM1gtKCAw=","secondaryKey":"qWzzMThcxjCUpecY5jlO08vpSAiFmVHjBORWyl7DwfM=","keyName":"myAuthorizationRule"}' - headers: - cache-control: - - no-cache - content-length: - - '533' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:41 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule/listKeys?api-version=2017-04-01 - response: - body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=y7bnOc0bL9c5vCd9zPZUG8r5UJnTi1fhgIHM1gtKCAw=","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=qWzzMThcxjCUpecY5jlO08vpSAiFmVHjBORWyl7DwfM=","primaryKey":"y7bnOc0bL9c5vCd9zPZUG8r5UJnTi1fhgIHM1gtKCAw=","secondaryKey":"qWzzMThcxjCUpecY5jlO08vpSAiFmVHjBORWyl7DwfM=","keyName":"myAuthorizationRule"}' - headers: - cache-control: - - no-cache - content-length: - - '533' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:42 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' - status: - code: 200 - message: OK -- request: - body: '{"location": "eastus", "tags": {"tag3": "value3", "tag4": "value4"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '68' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag3":"value3","tag4":"value4"},"properties":{"zoneRedundant":false,"provisioningState":"Updating","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:27:44.387Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Activating"}}' - headers: - cache-control: - - no-cache - content-length: - - '721' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:47 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1194' - status: - code: 200 - message: OK -- request: - body: '{"name": "sdk-Namespace-2924"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '30' - Content-Type: - - application/json - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceBus/CheckNameAvailability?api-version=2017-04-01 - response: - body: - string: '{"nameAvailable":true,"reason":"None","message":null}' - headers: - cache-control: - - no-cache - content-length: - - '53' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:27:48 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1197' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/AuthorizationRules/myAuthorizationRule?api-version=2017-04-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Mon, 23 Nov 2020 08:27:54 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14998' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Mon, 23 Nov 2020 08:27:56 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14997' - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag3":"value3","tag4":"value4"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:27:56.457Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Removing"}}' - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:28:26 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Premium","tier":"Premium","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx","name":"myNamespacexxyyzzxyx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag3":"value3","tag4":"value4"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyx","createdAt":"2020-11-23T08:25:33.627Z","updatedAt":"2020-11-23T08:27:56.457Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyx.servicebus.windows.net:443/","status":"Removing"}}' - headers: - cache-control: - - no-cache - content-length: - - '720' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:29:20 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx/operationresults/myNamespacexxyyzzxyx?api-version=2018-01-01-preview - response: - body: - string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyx'' - under resource group ''rgname'' was not found. For more details please go - to https://aka.ms/ARMResourceNotFoundFix"}}' - headers: - cache-control: - - no-cache - content-length: - - '299' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 08:30:07 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-failure-cause: - - gateway - status: - code: 404 - message: Not Found -version: 1 diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.test_queue.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.test_queue.yaml index 75cecd8614f5..f129f49d8792 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.test_queue.yaml +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_queue.test_queue.yaml @@ -14,22 +14,23 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx","name":"myNamespacexxyyzzybx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2020-11-23T09:51:50.357Z","updatedAt":"2020-11-23T09:51:50.357Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2021-08-19T03:16:01.883Z","updatedAt":"2021-08-19T03:16:01.883Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '709' + - '692' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:51:52 GMT + - Thu, 19 Aug 2021 03:16:02 GMT expires: - '-1' pragma: @@ -62,22 +63,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx","name":"myNamespacexxyyzzybx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2020-11-23T09:51:50.357Z","updatedAt":"2020-11-23T09:51:50.357Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2021-08-19T03:16:01.883Z","updatedAt":"2021-08-19T03:16:01.883Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '709' + - '692' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:22 GMT + - Thu, 19 Aug 2021 03:16:32 GMT expires: - '-1' pragma: @@ -108,22 +110,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx","name":"myNamespacexxyyzzybx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2020-11-23T09:51:50.357Z","updatedAt":"2020-11-23T09:52:35.353Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Active"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2021-08-19T03:16:01.883Z","updatedAt":"2021-08-19T03:16:45.007Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Active"}}' headers: cache-control: - no-cache content-length: - - '707' + - '690' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:53 GMT + - Thu, 19 Aug 2021 03:17:01 GMT expires: - '-1' pragma: @@ -158,22 +161,23 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue","name":"myQueue","type":"Microsoft.ServiceBus/Namespaces/Queues","location":"East - US","properties":{"lockDuration":"PT1M","maxSizeInMegabytes":16384,"requiresDuplicateDetection":false,"requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"enableBatchedOperations":true,"duplicateDetectionHistoryTimeWindow":"PT10M","maxDeliveryCount":10,"sizeInBytes":0,"messageCount":0,"status":"Active","autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":true,"enableExpress":false,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"createdAt":"2020-11-23T09:52:55.697Z","updatedAt":"2020-11-23T09:52:56.06Z","accessedAt":"0001-01-01T00:00:00"}}' + US","properties":{"lockDuration":"PT1M","maxSizeInMegabytes":16384,"requiresDuplicateDetection":false,"requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"enableBatchedOperations":true,"duplicateDetectionHistoryTimeWindow":"PT10M","maxDeliveryCount":10,"sizeInBytes":0,"messageCount":0,"status":"Active","autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":true,"enableExpress":false,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"createdAt":"2021-08-19T03:17:03.903Z","updatedAt":"2021-08-19T03:17:04.107Z","accessedAt":"0001-01-01T00:00:00"}}' headers: cache-control: - no-cache content-length: - - '1046' + - '1052' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:56 GMT + - Thu, 19 Aug 2021 03:17:03 GMT expires: - '-1' pragma: @@ -210,7 +214,8 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -221,11 +226,11 @@ interactions: cache-control: - no-cache content-length: - - '427' + - '432' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:57 GMT + - Thu, 19 Aug 2021 03:17:04 GMT expires: - '-1' pragma: @@ -258,7 +263,8 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -269,11 +275,11 @@ interactions: cache-control: - no-cache content-length: - - '427' + - '432' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:58 GMT + - Thu, 19 Aug 2021 03:17:05 GMT expires: - '-1' pragma: @@ -304,22 +310,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue","name":"myQueue","type":"Microsoft.ServiceBus/Namespaces/Queues","location":"East - US","properties":{"lockDuration":"PT1M","maxSizeInMegabytes":16384,"requiresDuplicateDetection":false,"requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"enableBatchedOperations":true,"duplicateDetectionHistoryTimeWindow":"PT10M","maxDeliveryCount":10,"sizeInBytes":0,"messageCount":0,"status":"Active","autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":true,"enableExpress":false,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"createdAt":"2020-11-23T09:52:55.697Z","updatedAt":"2020-11-23T09:52:57.3461743Z","accessedAt":"0001-01-01T00:00:00Z"}}' + US","properties":{"lockDuration":"PT1M","maxSizeInMegabytes":16384,"requiresDuplicateDetection":false,"requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"enableBatchedOperations":true,"duplicateDetectionHistoryTimeWindow":"PT10M","maxDeliveryCount":10,"sizeInBytes":0,"messageCount":0,"status":"Active","autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":true,"enableExpress":false,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"createdAt":"2021-08-19T03:17:03.903Z","updatedAt":"2021-08-19T03:17:05.133Z","accessedAt":"0001-01-01T00:00:00Z"}}' headers: cache-control: - no-cache content-length: - - '1052' + - '1053' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:58 GMT + - Thu, 19 Aug 2021 03:17:05 GMT expires: - '-1' pragma: @@ -354,12 +361,13 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule/regenerateKeys?api-version=2017-04-01 response: body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=Txe0G1hCqKmdkeGG/4H0nHO97sdSs0Ic7v+lN/ilK3U=;EntityPath=myQueue","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=BNrw+O6KqNosjQofuOVm70mTUZvXfzw4Aaa1h35JjH4=;EntityPath=myQueue","primaryKey":"Txe0G1hCqKmdkeGG/4H0nHO97sdSs0Ic7v+lN/ilK3U=","secondaryKey":"BNrw+O6KqNosjQofuOVm70mTUZvXfzw4Aaa1h35JjH4=","keyName":"myAuthorizationRule"}' + string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=iILHkbnn8NXPWr4kG48G+IoYbU9MkfZWnvYB+mxZWNc=;EntityPath=myQueue","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=FG1sSH1aKOrPh5227qqaX9p7kx0Z9yeHx/PwaRXJrjc=;EntityPath=myQueue","primaryKey":"iILHkbnn8NXPWr4kG48G+IoYbU9MkfZWnvYB+mxZWNc=","secondaryKey":"FG1sSH1aKOrPh5227qqaX9p7kx0Z9yeHx/PwaRXJrjc=","keyName":"myAuthorizationRule"}' headers: cache-control: - no-cache @@ -368,7 +376,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:52:59 GMT + - Thu, 19 Aug 2021 03:17:05 GMT expires: - '-1' pragma: @@ -403,12 +411,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule/ListKeys?api-version=2017-04-01 response: body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=Txe0G1hCqKmdkeGG/4H0nHO97sdSs0Ic7v+lN/ilK3U=;EntityPath=myQueue","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=BNrw+O6KqNosjQofuOVm70mTUZvXfzw4Aaa1h35JjH4=;EntityPath=myQueue","primaryKey":"Txe0G1hCqKmdkeGG/4H0nHO97sdSs0Ic7v+lN/ilK3U=","secondaryKey":"BNrw+O6KqNosjQofuOVm70mTUZvXfzw4Aaa1h35JjH4=","keyName":"myAuthorizationRule"}' + string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=iILHkbnn8NXPWr4kG48G+IoYbU9MkfZWnvYB+mxZWNc=;EntityPath=myQueue","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzybx.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=FG1sSH1aKOrPh5227qqaX9p7kx0Z9yeHx/PwaRXJrjc=;EntityPath=myQueue","primaryKey":"iILHkbnn8NXPWr4kG48G+IoYbU9MkfZWnvYB+mxZWNc=","secondaryKey":"FG1sSH1aKOrPh5227qqaX9p7kx0Z9yeHx/PwaRXJrjc=","keyName":"myAuthorizationRule"}' headers: cache-control: - no-cache @@ -417,7 +426,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:53:00 GMT + - Thu, 19 Aug 2021 03:17:05 GMT expires: - '-1' pragma: @@ -452,7 +461,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -464,7 +474,7 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:53:01 GMT + - Thu, 19 Aug 2021 03:17:06 GMT expires: - '-1' pragma: @@ -495,7 +505,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/queues/myQueue?api-version=2017-04-01 response: @@ -507,7 +518,7 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:53:03 GMT + - Thu, 19 Aug 2021 03:17:07 GMT expires: - '-1' pragma: @@ -538,9 +549,10 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx?api-version=2017-04-01 response: body: string: '' @@ -550,11 +562,11 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:53:05 GMT + - Thu, 19 Aug 2021 03:17:08 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2018-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2017-04-01 pragma: - no-cache server: @@ -581,53 +593,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2018-01-01-preview - response: - body: - string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx","name":"myNamespacexxyyzzybx","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzybx","createdAt":"2020-11-23T09:51:50.357Z","updatedAt":"2020-11-23T09:53:04.753Z","serviceBusEndpoint":"https://myNamespacexxyyzzybx.servicebus.windows.net:443/","status":"Removing"}}' - headers: - cache-control: - - no-cache - content-length: - - '709' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 23 Nov 2020 09:53:35 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2018-01-01-preview - pragma: - - no-cache - server: - - Service-Bus-Resource-Provider/CH3 - - Microsoft-HTTPAPI/2.0 - server-sb: - - Service-Bus-Resource-Provider/CH3 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzybx/operationresults/myNamespacexxyyzzybx?api-version=2017-04-01 response: body: string: '' @@ -637,7 +606,7 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:54:15 GMT + - Thu, 19 Aug 2021 03:17:37 GMT expires: - '-1' pragma: diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_subscrpition_and_rule.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_subscrpition_and_rule.yaml index 7d24f01c5876..696d7ef15ee8 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_subscrpition_and_rule.yaml +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_subscrpition_and_rule.yaml @@ -14,31 +14,32 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye","name":"myNamespacexxyyzzxyye","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2020-11-23T09:45:02.02Z","updatedAt":"2020-11-23T09:45:02.02Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2021-08-19T03:17:41.06Z","updatedAt":"2021-08-19T03:17:41.06Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '711' + - '694' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:45:04 GMT + - Thu, 19 Aug 2021 03:17:41 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/CH3 + - Service-Bus-Resource-Provider/SN1 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/CH3 + - Service-Bus-Resource-Provider/SN1 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -48,7 +49,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' status: code: 200 message: OK @@ -62,22 +63,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye","name":"myNamespacexxyyzzxyye","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2020-11-23T09:45:02.02Z","updatedAt":"2020-11-23T09:45:02.02Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2021-08-19T03:17:41.06Z","updatedAt":"2021-08-19T03:17:41.06Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '711' + - '694' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:45:34 GMT + - Thu, 19 Aug 2021 03:18:11 GMT expires: - '-1' pragma: @@ -108,31 +110,32 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye","name":"myNamespacexxyyzzxyye","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2020-11-23T09:45:02.02Z","updatedAt":"2020-11-23T09:45:44.86Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Active"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyye","createdAt":"2021-08-19T03:17:41.06Z","updatedAt":"2021-08-19T03:18:22.933Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyye.servicebus.windows.net:443/","status":"Active"}}' headers: cache-control: - no-cache content-length: - - '709' + - '693' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:05 GMT + - Thu, 19 Aug 2021 03:18:40 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -158,31 +161,32 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic","name":"myTopic","type":"Microsoft.ServiceBus/Namespaces/Topics","location":"East - US","properties":{"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","maxSizeInMegabytes":1024,"requiresDuplicateDetection":false,"duplicateDetectionHistoryTimeWindow":"PT10M","enableBatchedOperations":true,"sizeInBytes":0,"status":"Active","supportOrdering":true,"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":false,"enableExpress":true,"createdAt":"2020-11-23T09:46:07.53Z","updatedAt":"2020-11-23T09:46:07.563Z","accessedAt":"0001-01-01T00:00:00","subscriptionCount":0,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0}}}' + US","properties":{"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","maxSizeInMegabytes":1024,"requiresDuplicateDetection":false,"duplicateDetectionHistoryTimeWindow":"PT10M","enableBatchedOperations":true,"sizeInBytes":0,"status":"Active","supportOrdering":true,"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":false,"enableExpress":true,"createdAt":"2021-08-19T03:18:43.21Z","updatedAt":"2021-08-19T03:18:43.263Z","accessedAt":"0001-01-01T00:00:00","subscriptionCount":0,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0}}}' headers: cache-control: - no-cache content-length: - - '965' + - '970' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:08 GMT + - Thu, 19 Aug 2021 03:18:42 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -192,7 +196,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1196' + - '1198' status: code: 200 message: OK @@ -210,31 +214,32 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription","name":"mySubscription","type":"Microsoft.ServiceBus/Namespaces/Topics/Subscriptions","location":"East - US","properties":{"lockDuration":"PT1M","requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"deadLetteringOnFilterEvaluationExceptions":true,"messageCount":0,"maxDeliveryCount":10,"status":"Active","enableBatchedOperations":true,"createdAt":"2020-11-23T09:46:09.9656789Z","updatedAt":"2020-11-23T09:46:09.9656789Z","accessedAt":"0001-01-01T00:00:00","countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S"}}' + US","properties":{"lockDuration":"PT1M","requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"deadLetteringOnFilterEvaluationExceptions":true,"messageCount":0,"maxDeliveryCount":10,"status":"Active","enableBatchedOperations":true,"createdAt":"2021-08-19T03:18:44.8612832Z","updatedAt":"2021-08-19T03:18:44.8612832Z","accessedAt":"0001-01-01T00:00:00","countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S"}}' headers: cache-control: - no-cache content-length: - - '983' + - '988' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:10 GMT + - Thu, 19 Aug 2021 03:18:43 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -244,7 +249,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1195' + - '1197' status: code: 200 message: OK @@ -262,7 +267,8 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription/rules/myRule?api-version=2017-04-01 response: @@ -273,20 +279,20 @@ interactions: cache-control: - no-cache content-length: - - '489' + - '494' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:12 GMT + - Thu, 19 Aug 2021 03:18:45 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -296,7 +302,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1194' + - '1196' status: code: 200 message: OK @@ -310,31 +316,32 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription","name":"mySubscription","type":"Microsoft.ServiceBus/Namespaces/Topics/Subscriptions","location":"East - US","properties":{"lockDuration":"PT1M","requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"deadLetteringOnFilterEvaluationExceptions":true,"messageCount":0,"maxDeliveryCount":10,"status":"Active","enableBatchedOperations":true,"createdAt":"2020-11-23T09:46:09.9738147Z","updatedAt":"2020-11-23T09:46:09.9738147Z","accessedAt":"2020-11-23T09:46:09.9738147Z","countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S"}}' + US","properties":{"lockDuration":"PT1M","requiresSession":false,"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","deadLetteringOnMessageExpiration":false,"deadLetteringOnFilterEvaluationExceptions":true,"messageCount":0,"maxDeliveryCount":10,"status":"Active","enableBatchedOperations":true,"createdAt":"2021-08-19T03:18:44.8638509Z","updatedAt":"2021-08-19T03:18:44.8638509Z","accessedAt":"2021-08-19T03:18:44.8638509Z","countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0},"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S"}}' headers: cache-control: - no-cache content-length: - - '992' + - '997' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:12 GMT + - Thu, 19 Aug 2021 03:18:45 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -356,7 +363,8 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription/rules/myRule?api-version=2017-04-01 response: @@ -367,20 +375,20 @@ interactions: cache-control: - no-cache content-length: - - '489' + - '494' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:46:13 GMT + - Thu, 19 Aug 2021 03:18:45 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -404,7 +412,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription/rules/myRule?api-version=2017-04-01 response: @@ -416,16 +425,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:46:13 GMT + - Thu, 19 Aug 2021 03:18:45 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -447,7 +456,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic/subscriptions/mySubscription?api-version=2017-04-01 response: @@ -459,16 +469,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:46:14 GMT + - Thu, 19 Aug 2021 03:18:45 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -490,7 +500,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/topics/myTopic?api-version=2017-04-01 response: @@ -502,16 +513,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:46:15 GMT + - Thu, 19 Aug 2021 03:18:46 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -533,9 +544,10 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye?api-version=2017-04-01 response: body: string: '' @@ -545,18 +557,18 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:46:16 GMT + - Thu, 19 Aug 2021 03:18:46 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2017-04-01 pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -576,9 +588,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyye/operationresults/myNamespacexxyyzzxyye?api-version=2017-04-01 response: body: string: '' @@ -588,16 +601,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:46:46 GMT + - Thu, 19 Aug 2021 03:19:17 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_topic.yaml b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_topic.yaml index 686e18e6be27..e4716b00da35 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_topic.yaml +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/recordings/test_cli_mgmt_servicebus_topic.test_topic.yaml @@ -14,31 +14,32 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf","name":"myNamespacexxyyzzxyyf","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2020-11-23T09:46:59.133Z","updatedAt":"2020-11-23T09:46:59.133Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2021-08-19T03:19:19.46Z","updatedAt":"2021-08-19T03:19:19.46Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '713' + - '694' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:47:00 GMT + - Thu, 19 Aug 2021 03:19:19 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -62,31 +63,32 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf","name":"myNamespacexxyyzzxyyf","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2020-11-23T09:46:59.133Z","updatedAt":"2020-11-23T09:46:59.133Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Activating"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Created","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2021-08-19T03:19:19.46Z","updatedAt":"2021-08-19T03:19:19.46Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Activating"}}' headers: cache-control: - no-cache content-length: - - '713' + - '694' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:47:30 GMT + - Thu, 19 Aug 2021 03:19:49 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -108,31 +110,32 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2017-04-01 response: body: string: '{"sku":{"name":"Standard","tier":"Standard"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf","name":"myNamespacexxyyzzxyyf","type":"Microsoft.ServiceBus/Namespaces","location":"East - US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"zoneRedundant":false,"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2020-11-23T09:46:59.133Z","updatedAt":"2020-11-23T09:47:41.48Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Active"}}' + US","tags":{"tag1":"value1","tag2":"value2"},"properties":{"provisioningState":"Succeeded","metricId":"00000000-0000-0000-0000-000000000000:mynamespacexxyyzzxyyf","createdAt":"2021-08-19T03:19:19.46Z","updatedAt":"2021-08-19T03:20:04.92Z","serviceBusEndpoint":"https://myNamespacexxyyzzxyyf.servicebus.windows.net:443/","status":"Active"}}' headers: cache-control: - no-cache content-length: - - '710' + - '692' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:01 GMT + - Thu, 19 Aug 2021 03:20:19 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -158,31 +161,32 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic?api-version=2017-04-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic","name":"myTopic","type":"Microsoft.ServiceBus/Namespaces/Topics","location":"East - US","properties":{"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","maxSizeInMegabytes":1024,"requiresDuplicateDetection":false,"duplicateDetectionHistoryTimeWindow":"PT10M","enableBatchedOperations":true,"sizeInBytes":0,"status":"Active","supportOrdering":true,"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":false,"enableExpress":true,"createdAt":"2020-11-23T09:48:03.977Z","updatedAt":"2020-11-23T09:48:04.047Z","accessedAt":"0001-01-01T00:00:00","subscriptionCount":0,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0}}}' + US","properties":{"defaultMessageTimeToLive":"P10675199DT2H48M5.4775807S","maxSizeInMegabytes":1024,"requiresDuplicateDetection":false,"duplicateDetectionHistoryTimeWindow":"PT10M","enableBatchedOperations":true,"sizeInBytes":0,"status":"Active","supportOrdering":true,"autoDeleteOnIdle":"P10675199DT2H48M5.4775807S","enablePartitioning":false,"enableExpress":true,"createdAt":"2021-08-19T03:20:21.233Z","updatedAt":"2021-08-19T03:20:21.33Z","accessedAt":"0001-01-01T00:00:00","subscriptionCount":0,"countDetails":{"activeMessageCount":0,"deadLetterMessageCount":0,"scheduledMessageCount":0,"transferMessageCount":0,"transferDeadLetterMessageCount":0}}}' headers: cache-control: - no-cache content-length: - - '966' + - '970' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:04 GMT + - Thu, 19 Aug 2021 03:20:21 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -210,7 +214,8 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -221,20 +226,20 @@ interactions: cache-control: - no-cache content-length: - - '428' + - '433' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:05 GMT + - Thu, 19 Aug 2021 03:20:21 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -258,7 +263,8 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -269,20 +275,20 @@ interactions: cache-control: - no-cache content-length: - - '428' + - '433' content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:05 GMT + - Thu, 19 Aug 2021 03:20:22 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -308,12 +314,13 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule/regenerateKeys?api-version=2017-04-01 response: body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=dLFHyuWsnLbE5Vvg0uBgefMJFiul88s4bfqxHjnrYug=;EntityPath=myTopic","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=DtQoLTGjBOdn4jCoqdPegUDVz/KOABiyvbIxglGQUAI=;EntityPath=myTopic","primaryKey":"dLFHyuWsnLbE5Vvg0uBgefMJFiul88s4bfqxHjnrYug=","secondaryKey":"DtQoLTGjBOdn4jCoqdPegUDVz/KOABiyvbIxglGQUAI=","keyName":"myAuthorizationRule"}' + string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=5IrhMK5NSChTUD4paczredUuWy6AN3Odea+dmrqtYqE=;EntityPath=myTopic","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=6RGstnUuAXpt+GGoPDlfKBSP8aYZ7htZFI/4hABRN28=;EntityPath=myTopic","primaryKey":"5IrhMK5NSChTUD4paczredUuWy6AN3Odea+dmrqtYqE=","secondaryKey":"6RGstnUuAXpt+GGoPDlfKBSP8aYZ7htZFI/4hABRN28=","keyName":"myAuthorizationRule"}' headers: cache-control: - no-cache @@ -322,16 +329,16 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:06 GMT + - Thu, 19 Aug 2021 03:20:22 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -357,12 +364,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule/ListKeys?api-version=2017-04-01 response: body: - string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=dLFHyuWsnLbE5Vvg0uBgefMJFiul88s4bfqxHjnrYug=;EntityPath=myTopic","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=DtQoLTGjBOdn4jCoqdPegUDVz/KOABiyvbIxglGQUAI=;EntityPath=myTopic","primaryKey":"dLFHyuWsnLbE5Vvg0uBgefMJFiul88s4bfqxHjnrYug=","secondaryKey":"DtQoLTGjBOdn4jCoqdPegUDVz/KOABiyvbIxglGQUAI=","keyName":"myAuthorizationRule"}' + string: '{"primaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=5IrhMK5NSChTUD4paczredUuWy6AN3Odea+dmrqtYqE=;EntityPath=myTopic","secondaryConnectionString":"Endpoint=sb://mynamespacexxyyzzxyyf.servicebus.windows.net/;SharedAccessKeyName=myAuthorizationRule;SharedAccessKey=6RGstnUuAXpt+GGoPDlfKBSP8aYZ7htZFI/4hABRN28=;EntityPath=myTopic","primaryKey":"5IrhMK5NSChTUD4paczredUuWy6AN3Odea+dmrqtYqE=","secondaryKey":"6RGstnUuAXpt+GGoPDlfKBSP8aYZ7htZFI/4hABRN28=","keyName":"myAuthorizationRule"}' headers: cache-control: - no-cache @@ -371,16 +379,16 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 23 Nov 2020 09:48:06 GMT + - Thu, 19 Aug 2021 03:20:22 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -406,7 +414,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic/authorizationRules/myAuthorizationRule?api-version=2017-04-01 response: @@ -418,16 +427,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:48:07 GMT + - Thu, 19 Aug 2021 03:20:23 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -449,7 +458,8 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/topics/myTopic?api-version=2017-04-01 response: @@ -461,16 +471,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:48:08 GMT + - Thu, 19 Aug 2021 03:20:24 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -492,9 +502,10 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf?api-version=2017-04-01 response: body: string: '' @@ -504,18 +515,18 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:48:09 GMT + - Thu, 19 Aug 2021 03:20:24 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2017-04-01 pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: @@ -535,9 +546,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-servicebus/6.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-azure-mgmt-servicebus/7.0.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2018-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.ServiceBus/namespaces/myNamespacexxyyzzxyyf/operationresults/myNamespacexxyyzzxyyf?api-version=2017-04-01 response: body: string: '' @@ -547,16 +559,16 @@ interactions: content-length: - '0' date: - - Mon, 23 Nov 2020 09:48:40 GMT + - Thu, 19 Aug 2021 03:20:54 GMT expires: - '-1' pragma: - no-cache server: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 - Microsoft-HTTPAPI/2.0 server-sb: - - Service-Bus-Resource-Provider/SN1 + - Service-Bus-Resource-Provider/CH3 strict-transport-security: - max-age=31536000; includeSubDomains x-content-type-options: diff --git a/sdk/servicebus/azure-mgmt-servicebus/tests/test_cli_mgmt_servicebus_namespace.py b/sdk/servicebus/azure-mgmt-servicebus/tests/test_cli_mgmt_servicebus_namespace.py index 6564047574da..3a383afb003d 100644 --- a/sdk/servicebus/azure-mgmt-servicebus/tests/test_cli_mgmt_servicebus_namespace.py +++ b/sdk/servicebus/azure-mgmt-servicebus/tests/test_cli_mgmt_servicebus_namespace.py @@ -66,7 +66,8 @@ def create_virtual_network(self, group_name, location, network_name, subnet_name subnet_info = async_subnet_creation.result() return subnet_info - + + @unittest.skip('hard to test') @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_namespace(self, resource_group): @@ -252,7 +253,8 @@ def test_namespace(self, resource_group): except HttpResponseError as e: if not str(e).startswith("(ResourceNotFound)"): raise e - + + @unittest.skip('hard to test') @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_migration_configs(self, resource_group): diff --git a/sdk/servicebus/azure-servicebus/tests/test_queues.py b/sdk/servicebus/azure-servicebus/tests/test_queues.py index e77012d58070..c27efd6d9b99 100644 --- a/sdk/servicebus/azure-servicebus/tests/test_queues.py +++ b/sdk/servicebus/azure-servicebus/tests/test_queues.py @@ -14,6 +14,7 @@ import uuid from datetime import datetime, timedelta import calendar +import unittest import uamqp import uamqp.errors @@ -1565,6 +1566,7 @@ def test_queue_message_settle_through_mgmt_link_due_to_broken_receiver_link(self assert len(messages) == 1 receiver.complete_message(messages[0]) + @unittest.skip('hard to test') def test_queue_mock_auto_lock_renew_callback(self): # A warning to future devs: If the renew period override heuristic in registration # ever changes, it may break this (since it adjusts renew period if it is not short enough) diff --git a/shared_requirements.txt b/shared_requirements.txt index 4a755768e922..567336dd2afc 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -336,5 +336,6 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-recoveryservicessiterecovery msrest>=0.6.21 #override azure-mgmt-batch msrest>=0.6.21 #override azure-batch msrest>=0.6.21 +#override azure-mgmt-servicebus msrest>=0.6.21 #override azure-mgmt-security msrest>=0.6.21 #override azure-mgmt-apimanagement msrest>=0.6.21 From 3fe8964c8831c9ce91c4a4bc0dadcbc525b74220 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Tue, 24 Aug 2021 10:18:19 +0800 Subject: [PATCH 06/16] [AutoRelease] t2-policyinsights-2021-08-23-78735 (#20381) * CodeGen from PR 15165 in Azure/azure-rest-api-specs [policyinsights] Fix next_link (#15165) * fix next_link * directive * Update readme.nodejs.md * js directvie * Update readme.md * supress other language * Update readme.go.md * swagger lint * swagger lint * swagger lint * Update readme.md * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines Co-authored-by: Zed Lei <59104634+RAY-316@users.noreply.github.com> --- .../azure-mgmt-policyinsights/CHANGELOG.md | 6 + .../azure-mgmt-policyinsights/MANIFEST.in | 1 + .../azure-mgmt-policyinsights/_meta.json | 11 + .../azure/mgmt/policyinsights/_metadata.json | 110 ++ .../policyinsights/_policy_insights_client.py | 24 + .../azure/mgmt/policyinsights/_version.py | 2 +- .../aio/_policy_insights_client.py | 23 + .../policyinsights/aio/operations/__init__.py | 2 + .../operations/_attestations_operations.py | 1004 ++++++++++++++++ .../aio/operations/_operations.py | 4 +- .../operations/_policy_events_operations.py | 136 ++- .../operations/_policy_metadata_operations.py | 8 +- .../_policy_restrictions_operations.py | 10 +- .../operations/_policy_states_operations.py | 188 ++- .../_policy_tracked_resources_operations.py | 16 +- .../operations/_remediations_operations.py | 96 +- .../mgmt/policyinsights/models/__init__.py | 25 + .../mgmt/policyinsights/models/_models.py | 307 ++++- .../mgmt/policyinsights/models/_models_py3.py | 343 +++++- .../models/_policy_insights_client_enums.py | 36 +- .../policyinsights/operations/__init__.py | 2 + .../operations/_attestations_operations.py | 1023 +++++++++++++++++ .../policyinsights/operations/_operations.py | 2 +- .../operations/_policy_events_operations.py | 120 +- .../operations/_policy_metadata_operations.py | 4 +- .../_policy_restrictions_operations.py | 6 +- .../operations/_policy_states_operations.py | 148 ++- .../_policy_tracked_resources_operations.py | 8 +- .../operations/_remediations_operations.py | 48 +- .../azure-mgmt-policyinsights/setup.py | 2 +- shared_requirements.txt | 1 + 31 files changed, 3424 insertions(+), 292 deletions(-) create mode 100644 sdk/policyinsights/azure-mgmt-policyinsights/_meta.json create mode 100644 sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_metadata.json create mode 100644 sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_attestations_operations.py create mode 100644 sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_attestations_operations.py diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md b/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md index cecb2669e0f0..4501310484cd 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md +++ b/sdk/policyinsights/azure-mgmt-policyinsights/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.1.0b1 (2021-08-23) + +**Features** + + - Added operation group AttestationsOperations + ## 1.0.0 (2020-12-22) **Features** diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/MANIFEST.in b/sdk/policyinsights/azure-mgmt-policyinsights/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/MANIFEST.in +++ b/sdk/policyinsights/azure-mgmt-policyinsights/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/_meta.json b/sdk/policyinsights/azure-mgmt-policyinsights/_meta.json new file mode 100644 index 000000000000..f9e83a05af21 --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "e7682aa897902920f3a95b2f358b6f7729d18666", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/policyinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/policyinsights/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_metadata.json b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_metadata.json new file mode 100644 index 000000000000..e9fc1e55b97a --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_metadata.json @@ -0,0 +1,110 @@ +{ + "chosen_version": "", + "total_api_version_list": ["2018-07-01-preview", "2019-07-01", "2019-10-01", "2020-07-01", "2021-01-01"], + "client": { + "name": "PolicyInsightsClient", + "filename": "_policy_insights_client", + "description": "PolicyInsightsClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"PolicyInsightsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"PolicyInsightsClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Microsoft Azure subscription ID.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "policy_tracked_resources": "PolicyTrackedResourcesOperations", + "remediations": "RemediationsOperations", + "policy_events": "PolicyEventsOperations", + "policy_states": "PolicyStatesOperations", + "operations": "Operations", + "policy_metadata": "PolicyMetadataOperations", + "policy_restrictions": "PolicyRestrictionsOperations", + "attestations": "AttestationsOperations" + } +} \ No newline at end of file diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py index 5fec7a26850b..33c6cc7c635e 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_policy_insights_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import PolicyInsightsClientConfiguration from .operations import PolicyTrackedResourcesOperations @@ -25,6 +26,7 @@ from .operations import Operations from .operations import PolicyMetadataOperations from .operations import PolicyRestrictionsOperations +from .operations import AttestationsOperations from . import models @@ -45,6 +47,8 @@ class PolicyInsightsClient(object): :vartype policy_metadata: azure.mgmt.policyinsights.operations.PolicyMetadataOperations :ivar policy_restrictions: PolicyRestrictionsOperations operations :vartype policy_restrictions: azure.mgmt.policyinsights.operations.PolicyRestrictionsOperations + :ivar attestations: AttestationsOperations operations + :vartype attestations: azure.mgmt.policyinsights.operations.AttestationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Microsoft Azure subscription ID. @@ -85,6 +89,26 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.policy_restrictions = PolicyRestrictionsOperations( self._client, self._config, self._serialize, self._deserialize) + self.attestations = AttestationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py index c47f66669f1b..653b73a4a199 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0b1" diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py index a25f9650bbb1..0556529830fd 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/_policy_insights_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -23,6 +24,7 @@ from .operations import Operations from .operations import PolicyMetadataOperations from .operations import PolicyRestrictionsOperations +from .operations import AttestationsOperations from .. import models @@ -43,6 +45,8 @@ class PolicyInsightsClient(object): :vartype policy_metadata: azure.mgmt.policyinsights.aio.operations.PolicyMetadataOperations :ivar policy_restrictions: PolicyRestrictionsOperations operations :vartype policy_restrictions: azure.mgmt.policyinsights.aio.operations.PolicyRestrictionsOperations + :ivar attestations: AttestationsOperations operations + :vartype attestations: azure.mgmt.policyinsights.aio.operations.AttestationsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Microsoft Azure subscription ID. @@ -82,6 +86,25 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.policy_restrictions = PolicyRestrictionsOperations( self._client, self._config, self._serialize, self._deserialize) + self.attestations = AttestationsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py index 4bbdef723768..91acca23d156 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._operations import Operations from ._policy_metadata_operations import PolicyMetadataOperations from ._policy_restrictions_operations import PolicyRestrictionsOperations +from ._attestations_operations import AttestationsOperations __all__ = [ 'PolicyTrackedResourcesOperations', @@ -22,4 +23,5 @@ 'Operations', 'PolicyMetadataOperations', 'PolicyRestrictionsOperations', + 'AttestationsOperations', ] diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_attestations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_attestations_operations.py new file mode 100644 index 000000000000..4f275f504f4f --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_attestations_operations.py @@ -0,0 +1,1004 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AttestationsOperations: + """AttestationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.policyinsights.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_for_subscription( + self, + query_options: Optional["_models.QueryOptions"] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AttestationListResult"]: + """Gets all attestations for the subscription. + + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + async def _create_or_update_at_subscription_initial( + self, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> "_models.Attestation": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_subscription_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def begin_create_or_update_at_subscription( + self, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> AsyncLROPoller["_models.Attestation"]: + """Creates or updates an attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_subscription_initial( + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def get_at_subscription( + self, + attestation_name: str, + **kwargs: Any + ) -> "_models.Attestation": + """Gets an existing attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def delete_at_subscription( + self, + attestation_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name: str, + query_options: Optional["_models.QueryOptions"] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AttestationListResult"]: + """Gets all attestations for the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + async def _create_or_update_at_resource_group_initial( + self, + resource_group_name: str, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> "_models.Attestation": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_resource_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_resource_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def begin_create_or_update_at_resource_group( + self, + resource_group_name: str, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> AsyncLROPoller["_models.Attestation"]: + """Creates or updates an attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_resource_group_initial( + resource_group_name=resource_group_name, + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def get_at_resource_group( + self, + resource_group_name: str, + attestation_name: str, + **kwargs: Any + ) -> "_models.Attestation": + """Gets an existing attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def delete_at_resource_group( + self, + resource_group_name: str, + attestation_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def list_for_resource( + self, + resource_id: str, + query_options: Optional["_models.QueryOptions"] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AttestationListResult"]: + """Gets all attestations for a resource. + + :param resource_id: Resource ID. + :type resource_id: str + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + async def _create_or_update_at_resource_initial( + self, + resource_id: str, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> "_models.Attestation": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_resource_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_resource_initial.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def begin_create_or_update_at_resource( + self, + resource_id: str, + attestation_name: str, + parameters: "_models.Attestation", + **kwargs: Any + ) -> AsyncLROPoller["_models.Attestation"]: + """Creates or updates an attestation at resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_at_resource_initial( + resource_id=resource_id, + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def get_at_resource( + self, + resource_id: str, + attestation_name: str, + **kwargs: Any + ) -> "_models.Attestation": + """Gets an existing attestation at resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + async def delete_at_resource( + self, + resource_id: str, + attestation_name: str, + **kwargs: Any + ) -> None: + """Deletes an existing attestation at individual resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py index 8cfd0d1c363d..641f29cf3ee3 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, - **kwargs + **kwargs: Any ) -> "_models.OperationsListResults": """Lists available operations. @@ -76,7 +76,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationsListResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py index 73091e34d4f2..ad883b494f7d 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_events_operations.py @@ -46,7 +46,7 @@ def list_query_results_for_management_group( self, management_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the management group. @@ -123,9 +123,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -142,7 +151,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -157,7 +166,7 @@ def list_query_results_for_subscription( self, subscription_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the subscription. @@ -232,9 +241,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -251,7 +269,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -267,7 +285,7 @@ def list_query_results_for_resource_group( subscription_id: str, resource_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resources under the resource group. @@ -345,9 +363,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -364,7 +391,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -379,7 +406,7 @@ def list_query_results_for_resource( self, resource_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resource. @@ -458,9 +485,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -477,7 +513,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -493,7 +529,7 @@ def list_query_results_for_policy_set_definition( subscription_id: str, policy_set_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy set definition. @@ -573,9 +609,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -592,7 +637,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -608,7 +653,7 @@ def list_query_results_for_policy_definition( subscription_id: str, policy_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy definition. @@ -688,9 +733,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -707,7 +761,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -723,7 +777,7 @@ def list_query_results_for_subscription_level_policy_assignment( subscription_id: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the subscription level policy assignment. @@ -803,9 +857,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -822,7 +885,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -839,7 +902,7 @@ def list_query_results_for_resource_group_level_policy_assignment( resource_group_name: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyEventsQueryResults"]: """Queries policy events for the resource group level policy assignment. @@ -922,9 +985,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -941,7 +1013,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py index b2488814080f..e9e5c96bd425 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_metadata_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_resource( self, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PolicyMetadata": """Get policy metadata resource. @@ -84,7 +84,7 @@ async def get_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyMetadata', pipeline_response) @@ -98,7 +98,7 @@ async def get_resource( def list( self, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyMetadataCollection"]: """Get a list of the policy metadata resources. @@ -156,7 +156,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py index 8c3907b612c3..d9496ceb4a23 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_restrictions_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def check_at_subscription_scope( self, parameters: "_models.CheckRestrictionsRequest", - **kwargs + **kwargs: Any ) -> "_models.CheckRestrictionsResult": """Checks what restrictions Azure Policy will place on a resource within a subscription. @@ -88,7 +88,7 @@ async def check_at_subscription_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) @@ -103,7 +103,7 @@ async def check_at_resource_group_scope( self, resource_group_name: str, parameters: "_models.CheckRestrictionsRequest", - **kwargs + **kwargs: Any ) -> "_models.CheckRestrictionsResult": """Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. @@ -130,7 +130,7 @@ async def check_at_resource_group_scope( url = self.check_at_resource_group_scope.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -152,7 +152,7 @@ async def check_at_resource_group_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py index 6d6684a697c9..1781596a2e6d 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_states_operations.py @@ -49,7 +49,7 @@ def list_query_results_for_management_group( policy_states_resource: Union[str, "_models.PolicyStatesResource"], management_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the management group. @@ -129,9 +129,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -148,7 +157,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -163,7 +172,7 @@ async def summarize_for_management_group( self, management_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the management group. @@ -227,7 +236,7 @@ async def summarize_for_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -243,7 +252,7 @@ def list_query_results_for_subscription( policy_states_resource: Union[str, "_models.PolicyStatesResource"], subscription_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the subscription. @@ -321,9 +330,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -340,7 +358,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -355,7 +373,7 @@ async def summarize_for_subscription( self, subscription_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the subscription. @@ -417,7 +435,7 @@ async def summarize_for_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -434,7 +452,7 @@ def list_query_results_for_resource_group( subscription_id: str, resource_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resources under the resource group. @@ -515,9 +533,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -534,7 +561,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -550,7 +577,7 @@ async def summarize_for_resource_group( subscription_id: str, resource_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the resources under the resource group. @@ -615,7 +642,7 @@ async def summarize_for_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -631,7 +658,7 @@ def list_query_results_for_resource( policy_states_resource: Union[str, "_models.PolicyStatesResource"], resource_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resource. @@ -713,9 +740,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -732,7 +768,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -747,7 +783,7 @@ async def summarize_for_resource( self, resource_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the resource. @@ -809,7 +845,7 @@ async def summarize_for_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -823,7 +859,7 @@ async def summarize_for_resource( async def _trigger_subscription_evaluation_initial( self, subscription_id: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -854,7 +890,7 @@ async def _trigger_subscription_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -865,7 +901,7 @@ async def _trigger_subscription_evaluation_initial( async def begin_trigger_subscription_evaluation( self, subscription_id: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Triggers a policy evaluation scan for all the resources under the subscription. @@ -873,8 +909,8 @@ async def begin_trigger_subscription_evaluation( :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -924,7 +960,7 @@ async def _trigger_resource_group_evaluation_initial( self, subscription_id: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -956,7 +992,7 @@ async def _trigger_resource_group_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -968,7 +1004,7 @@ async def begin_trigger_resource_group_evaluation( self, subscription_id: str, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Triggers a policy evaluation scan for all the resources under the resource group. @@ -978,8 +1014,8 @@ async def begin_trigger_resource_group_evaluation( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -1033,7 +1069,7 @@ def list_query_results_for_policy_set_definition( subscription_id: str, policy_set_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy set definition. @@ -1116,9 +1152,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1135,7 +1180,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1151,7 +1196,7 @@ async def summarize_for_policy_set_definition( subscription_id: str, policy_set_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy set definition. @@ -1218,7 +1263,7 @@ async def summarize_for_policy_set_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1235,7 +1280,7 @@ def list_query_results_for_policy_definition( subscription_id: str, policy_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy definition. @@ -1318,9 +1363,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1337,7 +1391,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1353,7 +1407,7 @@ async def summarize_for_policy_definition( subscription_id: str, policy_definition_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy definition. @@ -1420,7 +1474,7 @@ async def summarize_for_policy_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1437,7 +1491,7 @@ def list_query_results_for_subscription_level_policy_assignment( subscription_id: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the subscription level policy assignment. @@ -1520,9 +1574,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1539,7 +1602,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1555,7 +1618,7 @@ async def summarize_for_subscription_level_policy_assignment( subscription_id: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the subscription level policy assignment. @@ -1622,7 +1685,7 @@ async def summarize_for_subscription_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1640,7 +1703,7 @@ def list_query_results_for_resource_group_level_policy_assignment( resource_group_name: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyStatesQueryResults"]: """Queries policy states for the resource group level policy assignment. @@ -1726,9 +1789,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -1745,7 +1817,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1762,7 +1834,7 @@ async def summarize_for_resource_group_level_policy_assignment( resource_group_name: str, policy_assignment_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> "_models.SummarizeResults": """Summarizes policy states for the resource group level policy assignment. @@ -1832,7 +1904,7 @@ async def summarize_for_resource_group_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py index b6265dc74008..284d2241b3b8 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py @@ -45,7 +45,7 @@ def list_query_results_for_management_group( self, management_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the management group. @@ -117,7 +117,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -131,7 +131,7 @@ async def get_next(next_link=None): def list_query_results_for_subscription( self, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the subscription. @@ -199,7 +199,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -214,7 +214,7 @@ def list_query_results_for_resource_group( self, resource_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the resource group. @@ -285,7 +285,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -300,7 +300,7 @@ def list_query_results_for_resource( self, resource_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PolicyTrackedResourcesQueryResults"]: """Queries policy tracked resources under the resource. @@ -370,7 +370,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py index 60c530affebd..8b1120d457fd 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_remediations_operations.py @@ -46,7 +46,7 @@ def list_deployments_at_management_group( management_group_id: str, remediation_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at management group scope. @@ -115,7 +115,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -130,7 +130,7 @@ async def cancel_at_management_group( self, management_group_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Cancels a remediation at management group scope. @@ -175,7 +175,7 @@ async def cancel_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -190,7 +190,7 @@ def list_for_management_group( self, management_group_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the management group. @@ -260,7 +260,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -276,7 +276,7 @@ async def create_or_update_at_management_group( management_group_id: str, remediation_name: str, parameters: "_models.Remediation", - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Creates or updates a remediation at management group scope. @@ -328,7 +328,7 @@ async def create_or_update_at_management_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -347,7 +347,7 @@ async def get_at_management_group( self, management_group_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Gets an existing remediation at management group scope. @@ -392,7 +392,7 @@ async def get_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -407,7 +407,7 @@ async def delete_at_management_group( self, management_group_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at management group scope. @@ -452,7 +452,7 @@ async def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -469,7 +469,7 @@ def list_deployments_at_subscription( self, remediation_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at subscription scope. @@ -534,7 +534,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -548,7 +548,7 @@ async def get_next(next_link=None): async def cancel_at_subscription( self, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Cancels a remediation at subscription scope. @@ -589,7 +589,7 @@ async def cancel_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -603,7 +603,7 @@ async def cancel_at_subscription( def list_for_subscription( self, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the subscription. @@ -669,7 +669,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -684,7 +684,7 @@ async def create_or_update_at_subscription( self, remediation_name: str, parameters: "_models.Remediation", - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Creates or updates a remediation at subscription scope. @@ -732,7 +732,7 @@ async def create_or_update_at_subscription( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -750,7 +750,7 @@ async def create_or_update_at_subscription( async def get_at_subscription( self, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Gets an existing remediation at subscription scope. @@ -791,7 +791,7 @@ async def get_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -805,7 +805,7 @@ async def get_at_subscription( async def delete_at_subscription( self, remediation_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at subscription scope. @@ -846,7 +846,7 @@ async def delete_at_subscription( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -864,7 +864,7 @@ def list_deployments_at_resource_group( resource_group_name: str, remediation_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at resource group scope. @@ -932,7 +932,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -947,7 +947,7 @@ async def cancel_at_resource_group( self, resource_group_name: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Cancels a remediation at resource group scope. @@ -991,7 +991,7 @@ async def cancel_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1006,7 +1006,7 @@ def list_for_resource_group( self, resource_group_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for the subscription. @@ -1075,7 +1075,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1091,7 +1091,7 @@ async def create_or_update_at_resource_group( resource_group_name: str, remediation_name: str, parameters: "_models.Remediation", - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Creates or updates a remediation at resource group scope. @@ -1142,7 +1142,7 @@ async def create_or_update_at_resource_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1161,7 +1161,7 @@ async def get_at_resource_group( self, resource_group_name: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Gets an existing remediation at resource group scope. @@ -1205,7 +1205,7 @@ async def get_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1220,7 +1220,7 @@ async def delete_at_resource_group( self, resource_group_name: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at resource group scope. @@ -1264,7 +1264,7 @@ async def delete_at_resource_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -1282,7 +1282,7 @@ def list_deployments_at_resource( resource_id: str, remediation_name: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationDeploymentsListResult"]: """Gets all deployments for a remediation at resource scope. @@ -1349,7 +1349,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1364,7 +1364,7 @@ async def cancel_at_resource( self, resource_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Cancel a remediation at resource scope. @@ -1407,7 +1407,7 @@ async def cancel_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1422,7 +1422,7 @@ def list_for_resource( self, resource_id: str, query_options: Optional["_models.QueryOptions"] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.RemediationListResult"]: """Gets all remediations for a resource. @@ -1490,7 +1490,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1506,7 +1506,7 @@ async def create_or_update_at_resource( resource_id: str, remediation_name: str, parameters: "_models.Remediation", - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Creates or updates a remediation at resource scope. @@ -1556,7 +1556,7 @@ async def create_or_update_at_resource( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1575,7 +1575,7 @@ async def get_at_resource( self, resource_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> "_models.Remediation": """Gets an existing remediation at resource scope. @@ -1618,7 +1618,7 @@ async def get_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1633,7 +1633,7 @@ async def delete_at_resource( self, resource_id: str, remediation_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.Remediation"]: """Deletes an existing remediation at individual resource scope. @@ -1676,7 +1676,7 @@ async def delete_at_resource( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py index a50103be3989..00ee9be05f6e 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import Attestation + from ._models_py3 import AttestationEvidence + from ._models_py3 import AttestationListResult from ._models_py3 import CheckRestrictionsRequest from ._models_py3 import CheckRestrictionsResourceDetails from ._models_py3 import CheckRestrictionsResult @@ -16,8 +19,10 @@ from ._models_py3 import ComponentStateDetails from ._models_py3 import ErrorDefinition from ._models_py3 import ErrorDefinitionAutoGenerated + from ._models_py3 import ErrorDefinitionAutoGenerated2 from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseAutoGenerated + from ._models_py3 import ErrorResponseAutoGenerated2 from ._models_py3 import ExpressionEvaluationDetails from ._models_py3 import FieldRestriction from ._models_py3 import FieldRestrictions @@ -52,13 +57,18 @@ from ._models_py3 import RemediationDeploymentsListResult from ._models_py3 import RemediationFilters from ._models_py3 import RemediationListResult + from ._models_py3 import Resource from ._models_py3 import SlimPolicyMetadata from ._models_py3 import SummarizeResults from ._models_py3 import Summary from ._models_py3 import SummaryResults + from ._models_py3 import SystemData from ._models_py3 import TrackedResourceModificationDetails from ._models_py3 import TypedErrorInfo except (SyntaxError, ImportError): + from ._models import Attestation # type: ignore + from ._models import AttestationEvidence # type: ignore + from ._models import AttestationListResult # type: ignore from ._models import CheckRestrictionsRequest # type: ignore from ._models import CheckRestrictionsResourceDetails # type: ignore from ._models import CheckRestrictionsResult # type: ignore @@ -68,8 +78,10 @@ from ._models import ComponentStateDetails # type: ignore from ._models import ErrorDefinition # type: ignore from ._models import ErrorDefinitionAutoGenerated # type: ignore + from ._models import ErrorDefinitionAutoGenerated2 # type: ignore from ._models import ErrorResponse # type: ignore from ._models import ErrorResponseAutoGenerated # type: ignore + from ._models import ErrorResponseAutoGenerated2 # type: ignore from ._models import ExpressionEvaluationDetails # type: ignore from ._models import FieldRestriction # type: ignore from ._models import FieldRestrictions # type: ignore @@ -104,20 +116,27 @@ from ._models import RemediationDeploymentsListResult # type: ignore from ._models import RemediationFilters # type: ignore from ._models import RemediationListResult # type: ignore + from ._models import Resource # type: ignore from ._models import SlimPolicyMetadata # type: ignore from ._models import SummarizeResults # type: ignore from ._models import Summary # type: ignore from ._models import SummaryResults # type: ignore + from ._models import SystemData # type: ignore from ._models import TrackedResourceModificationDetails # type: ignore from ._models import TypedErrorInfo # type: ignore from ._policy_insights_client_enums import ( + ComplianceState, + CreatedByType, FieldRestrictionResult, PolicyStatesResource, ResourceDiscoveryMode, ) __all__ = [ + 'Attestation', + 'AttestationEvidence', + 'AttestationListResult', 'CheckRestrictionsRequest', 'CheckRestrictionsResourceDetails', 'CheckRestrictionsResult', @@ -127,8 +146,10 @@ 'ComponentStateDetails', 'ErrorDefinition', 'ErrorDefinitionAutoGenerated', + 'ErrorDefinitionAutoGenerated2', 'ErrorResponse', 'ErrorResponseAutoGenerated', + 'ErrorResponseAutoGenerated2', 'ExpressionEvaluationDetails', 'FieldRestriction', 'FieldRestrictions', @@ -163,12 +184,16 @@ 'RemediationDeploymentsListResult', 'RemediationFilters', 'RemediationListResult', + 'Resource', 'SlimPolicyMetadata', 'SummarizeResults', 'Summary', 'SummaryResults', + 'SystemData', 'TrackedResourceModificationDetails', 'TypedErrorInfo', + 'ComplianceState', + 'CreatedByType', 'FieldRestrictionResult', 'PolicyStatesResource', 'ResourceDiscoveryMode', diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py index 3129367f2ef0..6d0131209fa1 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models.py @@ -10,6 +10,184 @@ import msrest.serialization +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Attestation(Resource): + """An attestation resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.policyinsights.models.SystemData + :param policy_assignment_id: Required. The resource ID of the policy assignment that the + attestation is setting the state for. + :type policy_assignment_id: str + :param policy_definition_reference_id: The policy definition reference ID from a policy set + definition that the attestation is setting the state for. If the policy assignment assigns a + policy set definition the attestation can choose a definition within the set definition with + this property or omit this and set the state for the entire set definition. + :type policy_definition_reference_id: str + :param compliance_state: The compliance state that should be set on the resource. Possible + values include: "Compliant", "NonCompliant", "Unknown". + :type compliance_state: str or ~azure.mgmt.policyinsights.models.ComplianceState + :param expires_on: The time the compliance state should expire. + :type expires_on: ~datetime.datetime + :param owner: The person responsible for setting the state of the resource. This value is + typically an Azure Active Directory object ID. + :type owner: str + :param comments: Comments describing why this attestation was created. + :type comments: str + :param evidence: The evidence supporting the compliance state set in this attestation. + :type evidence: list[~azure.mgmt.policyinsights.models.AttestationEvidence] + :ivar provisioning_state: The status of the attestation. + :vartype provisioning_state: str + :ivar last_compliance_state_change_at: The time the compliance state was last changed in this + attestation. + :vartype last_compliance_state_change_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'policy_assignment_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'last_compliance_state_change_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'properties.policyDefinitionReferenceId', 'type': 'str'}, + 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'owner': {'key': 'properties.owner', 'type': 'str'}, + 'comments': {'key': 'properties.comments', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': '[AttestationEvidence]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'last_compliance_state_change_at': {'key': 'properties.lastComplianceStateChangeAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(Attestation, self).__init__(**kwargs) + self.system_data = None + self.policy_assignment_id = kwargs['policy_assignment_id'] + self.policy_definition_reference_id = kwargs.get('policy_definition_reference_id', None) + self.compliance_state = kwargs.get('compliance_state', None) + self.expires_on = kwargs.get('expires_on', None) + self.owner = kwargs.get('owner', None) + self.comments = kwargs.get('comments', None) + self.evidence = kwargs.get('evidence', None) + self.provisioning_state = None + self.last_compliance_state_change_at = None + + +class AttestationEvidence(msrest.serialization.Model): + """A piece of evidence supporting the compliance state set in the attestation. + + :param description: The description for this piece of evidence. + :type description: str + :param source_uri: The URI location of the evidence. + :type source_uri: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'source_uri': {'key': 'sourceUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AttestationEvidence, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.source_uri = kwargs.get('source_uri', None) + + +class AttestationListResult(msrest.serialization.Model): + """List of attestations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of attestation definitions. + :vartype value: list[~azure.mgmt.policyinsights.models.Attestation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Attestation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AttestationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CheckRestrictionsRequest(msrest.serialization.Model): """The check policy restrictions parameters describing the resource that is being evaluated. @@ -47,7 +225,7 @@ class CheckRestrictionsResourceDetails(msrest.serialization.Model): :param resource_content: Required. The resource content. This should include whatever properties are already known and can be a partial set of all resource properties. - :type resource_content: object + :type resource_content: any :param api_version: The api-version of the resource content. :type api_version: str :param scope: The scope where the resource is being created. For example, if the resource is a @@ -155,7 +333,7 @@ class ComponentEventDetails(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param id: Component Id. :type id: str :param type: Component type. @@ -204,7 +382,7 @@ class ComponentStateDetails(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param id: Component Id. :type id: str :param type: Component type. @@ -329,6 +507,51 @@ def __init__( self.additional_info = None +class ErrorDefinitionAutoGenerated2(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.policyinsights.models.ErrorDefinitionAutoGenerated2] + :ivar additional_info: Additional scenario specific error details. + :vartype additional_info: list[~azure.mgmt.policyinsights.models.TypedErrorInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinitionAutoGenerated2]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[TypedErrorInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinitionAutoGenerated2, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(msrest.serialization.Model): """Error response. @@ -367,6 +590,25 @@ def __init__( self.error = kwargs.get('error', None) +class ErrorResponseAutoGenerated2(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.policyinsights.models.ErrorDefinitionAutoGenerated2 + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionAutoGenerated2'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseAutoGenerated2, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + class ExpressionEvaluationDetails(msrest.serialization.Model): """Evaluation details of policy language expressions. @@ -381,9 +623,9 @@ class ExpressionEvaluationDetails(msrest.serialization.Model): :param path: Property path if the expression is a field or an alias. :type path: str :param expression_value: Value of the expression. - :type expression_value: object + :type expression_value: any :param target_value: Target value to be compared with the expression value. - :type target_value: object + :type target_value: any :param operator: Operator to compare the expression value and the target value. :type operator: str """ @@ -812,7 +1054,7 @@ class PolicyEvent(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_id: OData entity ID; always set to null since policy event records do not have an entity ID. :type odata_id: str @@ -1044,7 +1286,7 @@ class PolicyMetadata(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any :ivar description: The description of the policy metadata. :vartype description: str :ivar requirements: The requirements of the policy metadata. @@ -1143,7 +1385,7 @@ class PolicyMetadataSlimProperties(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any """ _validation = { @@ -1193,7 +1435,7 @@ class PolicyMetadataProperties(PolicyMetadataSlimProperties): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any :ivar description: The description of the policy metadata. :vartype description: str :ivar requirements: The requirements of the policy metadata. @@ -1279,7 +1521,7 @@ class PolicyState(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_id: OData entity ID; always set to null since policy state records do not have an entity ID. :type odata_id: str @@ -1943,7 +2185,7 @@ class SlimPolicyMetadata(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any """ _validation = { @@ -2099,6 +2341,47 @@ def __init__( self.policy_group_details = kwargs.get('policy_group_details', None) +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.policyinsights.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.policyinsights.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + class TrackedResourceModificationDetails(msrest.serialization.Model): """The details of the policy triggered deployment that created or modified the tracked resource. @@ -2143,7 +2426,7 @@ class TypedErrorInfo(msrest.serialization.Model): :ivar type: The type of included error details. :vartype type: str :ivar info: The scenario specific error details. - :vartype info: object + :vartype info: any """ _validation = { diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py index e2f211c86063..4d05c6b521cc 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -15,6 +15,195 @@ from ._policy_insights_client_enums import * +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Attestation(Resource): + """An attestation resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.policyinsights.models.SystemData + :param policy_assignment_id: Required. The resource ID of the policy assignment that the + attestation is setting the state for. + :type policy_assignment_id: str + :param policy_definition_reference_id: The policy definition reference ID from a policy set + definition that the attestation is setting the state for. If the policy assignment assigns a + policy set definition the attestation can choose a definition within the set definition with + this property or omit this and set the state for the entire set definition. + :type policy_definition_reference_id: str + :param compliance_state: The compliance state that should be set on the resource. Possible + values include: "Compliant", "NonCompliant", "Unknown". + :type compliance_state: str or ~azure.mgmt.policyinsights.models.ComplianceState + :param expires_on: The time the compliance state should expire. + :type expires_on: ~datetime.datetime + :param owner: The person responsible for setting the state of the resource. This value is + typically an Azure Active Directory object ID. + :type owner: str + :param comments: Comments describing why this attestation was created. + :type comments: str + :param evidence: The evidence supporting the compliance state set in this attestation. + :type evidence: list[~azure.mgmt.policyinsights.models.AttestationEvidence] + :ivar provisioning_state: The status of the attestation. + :vartype provisioning_state: str + :ivar last_compliance_state_change_at: The time the compliance state was last changed in this + attestation. + :vartype last_compliance_state_change_at: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'policy_assignment_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'last_compliance_state_change_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_id': {'key': 'properties.policyDefinitionReferenceId', 'type': 'str'}, + 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'owner': {'key': 'properties.owner', 'type': 'str'}, + 'comments': {'key': 'properties.comments', 'type': 'str'}, + 'evidence': {'key': 'properties.evidence', 'type': '[AttestationEvidence]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'last_compliance_state_change_at': {'key': 'properties.lastComplianceStateChangeAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + policy_assignment_id: str, + policy_definition_reference_id: Optional[str] = None, + compliance_state: Optional[Union[str, "ComplianceState"]] = None, + expires_on: Optional[datetime.datetime] = None, + owner: Optional[str] = None, + comments: Optional[str] = None, + evidence: Optional[List["AttestationEvidence"]] = None, + **kwargs + ): + super(Attestation, self).__init__(**kwargs) + self.system_data = None + self.policy_assignment_id = policy_assignment_id + self.policy_definition_reference_id = policy_definition_reference_id + self.compliance_state = compliance_state + self.expires_on = expires_on + self.owner = owner + self.comments = comments + self.evidence = evidence + self.provisioning_state = None + self.last_compliance_state_change_at = None + + +class AttestationEvidence(msrest.serialization.Model): + """A piece of evidence supporting the compliance state set in the attestation. + + :param description: The description for this piece of evidence. + :type description: str + :param source_uri: The URI location of the evidence. + :type source_uri: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'source_uri': {'key': 'sourceUri', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + source_uri: Optional[str] = None, + **kwargs + ): + super(AttestationEvidence, self).__init__(**kwargs) + self.description = description + self.source_uri = source_uri + + +class AttestationListResult(msrest.serialization.Model): + """List of attestations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of attestation definitions. + :vartype value: list[~azure.mgmt.policyinsights.models.Attestation] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Attestation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AttestationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CheckRestrictionsRequest(msrest.serialization.Model): """The check policy restrictions parameters describing the resource that is being evaluated. @@ -55,7 +244,7 @@ class CheckRestrictionsResourceDetails(msrest.serialization.Model): :param resource_content: Required. The resource content. This should include whatever properties are already known and can be a partial set of all resource properties. - :type resource_content: object + :type resource_content: any :param api_version: The api-version of the resource content. :type api_version: str :param scope: The scope where the resource is being created. For example, if the resource is a @@ -76,7 +265,7 @@ class CheckRestrictionsResourceDetails(msrest.serialization.Model): def __init__( self, *, - resource_content: object, + resource_content: Any, api_version: Optional[str] = None, scope: Optional[str] = None, **kwargs @@ -172,7 +361,7 @@ class ComponentEventDetails(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param id: Component Id. :type id: str :param type: Component type. @@ -204,7 +393,7 @@ class ComponentEventDetails(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, id: Optional[str] = None, type: Optional[str] = None, name: Optional[str] = None, @@ -230,7 +419,7 @@ class ComponentStateDetails(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param id: Component Id. :type id: str :param type: Component type. @@ -255,7 +444,7 @@ class ComponentStateDetails(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, id: Optional[str] = None, type: Optional[str] = None, name: Optional[str] = None, @@ -362,6 +551,51 @@ def __init__( self.additional_info = None +class ErrorDefinitionAutoGenerated2(msrest.serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: Internal error details. + :vartype details: list[~azure.mgmt.policyinsights.models.ErrorDefinitionAutoGenerated2] + :ivar additional_info: Additional scenario specific error details. + :vartype additional_info: list[~azure.mgmt.policyinsights.models.TypedErrorInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinitionAutoGenerated2]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[TypedErrorInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDefinitionAutoGenerated2, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(msrest.serialization.Model): """Error response. @@ -404,6 +638,27 @@ def __init__( self.error = error +class ErrorResponseAutoGenerated2(msrest.serialization.Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.policyinsights.models.ErrorDefinitionAutoGenerated2 + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionAutoGenerated2'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDefinitionAutoGenerated2"] = None, + **kwargs + ): + super(ErrorResponseAutoGenerated2, self).__init__(**kwargs) + self.error = error + + class ExpressionEvaluationDetails(msrest.serialization.Model): """Evaluation details of policy language expressions. @@ -418,9 +673,9 @@ class ExpressionEvaluationDetails(msrest.serialization.Model): :param path: Property path if the expression is a field or an alias. :type path: str :param expression_value: Value of the expression. - :type expression_value: object + :type expression_value: any :param target_value: Target value to be compared with the expression value. - :type target_value: object + :type target_value: any :param operator: Operator to compare the expression value and the target value. :type operator: str """ @@ -445,8 +700,8 @@ def __init__( result: Optional[str] = None, expression: Optional[str] = None, path: Optional[str] = None, - expression_value: Optional[object] = None, - target_value: Optional[object] = None, + expression_value: Optional[Any] = None, + target_value: Optional[Any] = None, operator: Optional[str] = None, **kwargs ): @@ -890,7 +1145,7 @@ class PolicyEvent(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_id: OData entity ID; always set to null since policy event records do not have an entity ID. :type odata_id: str @@ -1005,7 +1260,7 @@ class PolicyEvent(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, odata_id: Optional[str] = None, odata_context: Optional[str] = None, timestamp: Optional[datetime.datetime] = None, @@ -1163,7 +1418,7 @@ class PolicyMetadata(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any :ivar description: The description of the policy metadata. :vartype description: str :ivar requirements: The requirements of the policy metadata. @@ -1262,7 +1517,7 @@ class PolicyMetadataSlimProperties(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any """ _validation = { @@ -1312,7 +1567,7 @@ class PolicyMetadataProperties(PolicyMetadataSlimProperties): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any :ivar description: The description of the policy metadata. :vartype description: str :ivar requirements: The requirements of the policy metadata. @@ -1398,7 +1653,7 @@ class PolicyState(msrest.serialization.Model): :param additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, object] + :type additional_properties: dict[str, any] :param odata_id: OData entity ID; always set to null since policy state records do not have an entity ID. :type odata_id: str @@ -1528,7 +1783,7 @@ class PolicyState(msrest.serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, object]] = None, + additional_properties: Optional[Dict[str, Any]] = None, odata_id: Optional[str] = None, odata_context: Optional[str] = None, timestamp: Optional[datetime.datetime] = None, @@ -2119,7 +2374,7 @@ class SlimPolicyMetadata(msrest.serialization.Model): :ivar additional_content_url: Url for getting additional content about the resource metadata. :vartype additional_content_url: str :ivar metadata: Additional metadata. - :vartype metadata: object + :vartype metadata: any """ _validation = { @@ -2291,6 +2546,54 @@ def __init__( self.policy_group_details = policy_group_details +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.policyinsights.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.policyinsights.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class TrackedResourceModificationDetails(msrest.serialization.Model): """The details of the policy triggered deployment that created or modified the tracked resource. @@ -2335,7 +2638,7 @@ class TypedErrorInfo(msrest.serialization.Model): :ivar type: The type of included error details. :vartype type: str :ivar info: The scenario specific error details. - :vartype info: object + :vartype info: any """ _validation = { diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py index e713fd7f9e3c..ada9f0a6b76a 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/models/_policy_insights_client_enums.py @@ -26,13 +26,36 @@ def __getattr__(cls, name): raise AttributeError(name) +class ComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The compliance state that should be set on the resource. + """ + + #: The resource is in compliance with the policy. + COMPLIANT = "Compliant" + #: The resource is not in compliance with the policy. + NON_COMPLIANT = "NonCompliant" + #: The compliance state of the resource is not known. + UNKNOWN = "Unknown" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + class FieldRestrictionResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of restriction that is imposed on the field. """ - REQUIRED = "Required" #: The field and/or values are required by policy. - REMOVED = "Removed" #: The field will be removed by policy. - DENY = "Deny" #: The field and/or values will be denied by policy. + #: The field and/or values are required by policy. + REQUIRED = "Required" + #: The field will be removed by policy. + REMOVED = "Removed" + #: The field and/or values will be denied by policy. + DENY = "Deny" class PolicyStatesResource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): @@ -44,5 +67,8 @@ class ResourceDiscoveryMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) specified. """ - EXISTING_NON_COMPLIANT = "ExistingNonCompliant" #: Remediate resources that are already known to be non-compliant. - RE_EVALUATE_COMPLIANCE = "ReEvaluateCompliance" #: Re-evaluate the compliance state of resources and then remediate the resources found to be non-compliant. + #: Remediate resources that are already known to be non-compliant. + EXISTING_NON_COMPLIANT = "ExistingNonCompliant" + #: Re-evaluate the compliance state of resources and then remediate the resources found to be + #: non-compliant. + RE_EVALUATE_COMPLIANCE = "ReEvaluateCompliance" diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py index 4bbdef723768..91acca23d156 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py @@ -13,6 +13,7 @@ from ._operations import Operations from ._policy_metadata_operations import PolicyMetadataOperations from ._policy_restrictions_operations import PolicyRestrictionsOperations +from ._attestations_operations import AttestationsOperations __all__ = [ 'PolicyTrackedResourcesOperations', @@ -22,4 +23,5 @@ 'Operations', 'PolicyMetadataOperations', 'PolicyRestrictionsOperations', + 'AttestationsOperations', ] diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_attestations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_attestations_operations.py new file mode 100644 index 000000000000..f4644b6556b8 --- /dev/null +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_attestations_operations.py @@ -0,0 +1,1023 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AttestationsOperations(object): + """AttestationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.policyinsights.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_for_subscription( + self, + query_options=None, # type: Optional["_models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AttestationListResult"] + """Gets all attestations for the subscription. + + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + def _create_or_update_at_subscription_initial( + self, + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_subscription_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_subscription_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def begin_create_or_update_at_subscription( + self, + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Attestation"] + """Creates or updates an attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_subscription_initial( + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def get_at_subscription( + self, + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + """Gets an existing attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def delete_at_subscription( + self, + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing attestation at subscription scope. + + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def list_for_resource_group( + self, + resource_group_name, # type: str + query_options=None, # type: Optional["_models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AttestationListResult"] + """Gets all attestations for the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + def _create_or_update_at_resource_group_initial( + self, + resource_group_name, # type: str + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_resource_group_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_resource_group_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def begin_create_or_update_at_resource_group( + self, + resource_group_name, # type: str + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Attestation"] + """Creates or updates an attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_resource_group_initial( + resource_group_name=resource_group_name, + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def get_at_resource_group( + self, + resource_group_name, # type: str + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + """Gets an existing attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def delete_at_resource_group( + self, + resource_group_name, # type: str + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing attestation at resource group scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def list_for_resource( + self, + resource_id, # type: str + query_options=None, # type: Optional["_models.QueryOptions"] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AttestationListResult"] + """Gets all attestations for a resource. + + :param resource_id: Resource ID. + :type resource_id: str + :param query_options: Parameter group. + :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttestationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.AttestationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttestationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _top = None + _filter = None + if query_options is not None: + _top = query_options.top + _filter = query_options.filter + api_version = "2021-01-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if _top is not None: + query_parameters['$top'] = self._serialize.query("top", _top, 'int', minimum=0) + if _filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AttestationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations'} # type: ignore + + def _create_or_update_at_resource_initial( + self, + resource_id, # type: str + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_at_resource_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Attestation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Attestation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_at_resource_initial.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def begin_create_or_update_at_resource( + self, + resource_id, # type: str + attestation_name, # type: str + parameters, # type: "_models.Attestation" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Attestation"] + """Creates or updates an attestation at resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :param parameters: The attestation parameters. + :type parameters: ~azure.mgmt.policyinsights.models.Attestation + :keyword callable cls: A custom type or function that will be passed the direct response + :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 Attestation or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.policyinsights.models.Attestation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_at_resource_initial( + resource_id=resource_id, + attestation_name=attestation_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def get_at_resource( + self, + resource_id, # type: str + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Attestation" + """Gets an existing attestation at resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Attestation, or the result of cls(response) + :rtype: ~azure.mgmt.policyinsights.models.Attestation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Attestation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.get_at_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Attestation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore + + def delete_at_resource( + self, + resource_id, # type: str + attestation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes an existing attestation at individual resource scope. + + :param resource_id: Resource ID. + :type resource_id: str + :param attestation_name: The name of the attestation. + :type attestation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01" + accept = "application/json" + + # Construct URL + url = self.delete_at_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True), + 'attestationName': self._serialize.url("attestation_name", attestation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_at_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}'} # type: ignore diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py index 20eb9c00c20a..1a9cecc21a3c 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_operations.py @@ -81,7 +81,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationsListResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py index f0b43e3d10c5..3a31b9099118 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py @@ -128,9 +128,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -147,7 +156,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -238,9 +247,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -257,7 +275,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -352,9 +370,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -371,7 +398,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -466,9 +493,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -485,7 +521,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -582,9 +618,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -601,7 +646,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -698,9 +743,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -717,7 +771,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -814,9 +868,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -833,7 +896,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -934,9 +997,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -953,7 +1025,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py index 5ce62077e9c8..de341b26ca16 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_metadata_operations.py @@ -89,7 +89,7 @@ def get_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyMetadata', pipeline_response) @@ -162,7 +162,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py index 784ec4685d81..fc1b7cfaf4cf 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_restrictions_operations.py @@ -93,7 +93,7 @@ def check_at_subscription_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) @@ -136,7 +136,7 @@ def check_at_resource_group_scope( url = self.check_at_resource_group_scope.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) @@ -158,7 +158,7 @@ def check_at_resource_group_scope( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponseAutoGenerated, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckRestrictionsResult', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py index e97d5023ade9..31ce121ac6b2 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_states_operations.py @@ -134,9 +134,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -153,7 +162,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -233,7 +242,7 @@ def summarize_for_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -328,9 +337,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -347,7 +365,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -425,7 +443,7 @@ def summarize_for_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -524,9 +542,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -543,7 +570,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -625,7 +652,7 @@ def summarize_for_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -724,9 +751,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -743,7 +779,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -821,7 +857,7 @@ def summarize_for_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -867,7 +903,7 @@ def _trigger_subscription_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -887,8 +923,8 @@ def begin_trigger_subscription_evaluation( :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -971,7 +1007,7 @@ def _trigger_resource_group_evaluation_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -994,8 +1030,8 @@ def begin_trigger_resource_group_evaluation( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -1133,9 +1169,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1152,7 +1197,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1236,7 +1281,7 @@ def summarize_for_policy_set_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1337,9 +1382,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1356,7 +1410,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1440,7 +1494,7 @@ def summarize_for_policy_definition( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1541,9 +1595,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1560,7 +1623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1644,7 +1707,7 @@ def summarize_for_subscription_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) @@ -1749,9 +1812,18 @@ def prepare_request(next_link=None): request = self._client.post(url, query_parameters, header_parameters) else: - url = next_link + url = '{nextLink}' + path_format_arguments = { + 'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if _skip_token is not None: + query_parameters['$skiptoken'] = self._serialize.query("skip_token", _skip_token, 'str') + + request = self._client.post(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -1768,7 +1840,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1856,7 +1928,7 @@ def summarize_for_resource_group_level_policy_assignment( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SummarizeResults', pipeline_response) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py index 041bc997e6e0..d11fa8ce319c 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_tracked_resources_operations.py @@ -122,7 +122,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -205,7 +205,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -292,7 +292,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -378,7 +378,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.QueryFailure, response) + error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py index c0ed1d389296..676ce826e123 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_remediations_operations.py @@ -120,7 +120,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -181,7 +181,7 @@ def cancel_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -267,7 +267,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -336,7 +336,7 @@ def create_or_update_at_management_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -401,7 +401,7 @@ def get_at_management_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -462,7 +462,7 @@ def delete_at_management_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -545,7 +545,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -601,7 +601,7 @@ def cancel_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -682,7 +682,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -746,7 +746,7 @@ def create_or_update_at_subscription( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -806,7 +806,7 @@ def get_at_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -862,7 +862,7 @@ def delete_at_subscription( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -949,7 +949,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1009,7 +1009,7 @@ def cancel_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1094,7 +1094,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1162,7 +1162,7 @@ def create_or_update_at_resource_group( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1226,7 +1226,7 @@ def get_at_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1286,7 +1286,7 @@ def delete_at_resource_group( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -1372,7 +1372,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1431,7 +1431,7 @@ def cancel_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1515,7 +1515,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1582,7 +1582,7 @@ def create_or_update_at_resource( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1645,7 +1645,7 @@ def get_at_resource( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Remediation', pipeline_response) @@ -1704,7 +1704,7 @@ def delete_at_resource( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None diff --git a/sdk/policyinsights/azure-mgmt-policyinsights/setup.py b/sdk/policyinsights/azure-mgmt-policyinsights/setup.py index 24d521916935..ca0495be95c0 100644 --- a/sdk/policyinsights/azure-mgmt-policyinsights/setup.py +++ b/sdk/policyinsights/azure-mgmt-policyinsights/setup.py @@ -78,7 +78,7 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', + 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.2.0,<2.0.0', ], diff --git a/shared_requirements.txt b/shared_requirements.txt index 567336dd2afc..d100dfb35818 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -330,6 +330,7 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-guestconfig msrest>=0.6.21 #override azure-mgmt-recoveryservices msrest>=0.6.21 #override azure-mgmt-avs msrest>=0.6.21 +#override azure-mgmt-policyinsights msrest>=0.6.21 #override azure-mgmt-purview msrest>=0.6.21 #override azure-mgmt-datafactory msrest>=0.6.21 #override azure-mgmt-containerinstance msrest>=0.6.21 From 3fbb0f9e1f86acc4e0a8cb13b790dccf32e3860f Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Tue, 24 Aug 2021 22:26:42 +0800 Subject: [PATCH 07/16] [AutoRelease] t2-datamigration-2021-08-19-04035 (#20349) * CodeGen from PR 15259 in Azure/azure-rest-api-specs Dev datamigration microsoft.data migration 2021 06 30 (#15259) * Created new api version and refactoring changes (such as fixing new build restrictions) * Adding breaking changes * Adding location to the services update example * Adding location for projects update and refactoring the task command * Resolving tasks command ModelValidation test failure * Resolving issue based on zhenglaizhang's recommendation * Adding comma to resolve issue Co-authored-by: Artem Pavlichenko * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: Artem Pavlichenko Co-authored-by: PythonSdkPipelines --- .../azure-mgmt-datamigration/CHANGELOG.md | 22 + .../azure-mgmt-datamigration/MANIFEST.in | 1 + .../azure-mgmt-datamigration/_meta.json | 11 + .../mgmt/datamigration/_configuration.py | 2 +- .../_data_migration_management_client.py | 19 + .../azure/mgmt/datamigration/_metadata.json | 14 +- .../azure/mgmt/datamigration/_version.py | 2 +- .../mgmt/datamigration/aio/_configuration.py | 2 +- .../aio/_data_migration_management_client.py | 18 + .../aio/operations/_files_operations.py | 28 +- .../aio/operations/_operations.py | 4 +- .../aio/operations/_projects_operations.py | 20 +- .../operations/_resource_skus_operations.py | 4 +- .../operations/_service_tasks_operations.py | 24 +- .../aio/operations/_services_operations.py | 78 +- .../aio/operations/_tasks_operations.py | 28 +- .../aio/operations/_usages_operations.py | 4 +- .../mgmt/datamigration/models/__init__.py | 44 + ..._data_migration_management_client_enums.py | 9 + .../mgmt/datamigration/models/_models.py | 1307 +++++++++++++--- .../mgmt/datamigration/models/_models_py3.py | 1338 ++++++++++++++--- .../operations/_files_operations.py | 14 +- .../datamigration/operations/_operations.py | 2 +- .../operations/_projects_operations.py | 10 +- .../operations/_resource_skus_operations.py | 2 +- .../operations/_service_tasks_operations.py | 12 +- .../operations/_services_operations.py | 44 +- .../operations/_tasks_operations.py | 14 +- .../operations/_usages_operations.py | 2 +- 29 files changed, 2473 insertions(+), 606 deletions(-) create mode 100644 sdk/datamigration/azure-mgmt-datamigration/_meta.json diff --git a/sdk/datamigration/azure-mgmt-datamigration/CHANGELOG.md b/sdk/datamigration/azure-mgmt-datamigration/CHANGELOG.md index 9e1f4a6f0afe..7030c0e68d8b 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/CHANGELOG.md +++ b/sdk/datamigration/azure-mgmt-datamigration/CHANGELOG.md @@ -1,5 +1,27 @@ # Release History +## 10.0.0 (2021-08-19) + +**Features** + + - Model ConnectToTargetAzureDbForMySqlTaskInput has a new parameter is_offline_migration + - Model MySqlConnectionInfo has a new parameter encrypt_connection + - Model TrackedResource has a new parameter system_data + - Model Project has a new parameter system_data + - Model ApiError has a new parameter system_data + - Model ProjectFile has a new parameter system_data + - Model DataMigrationService has a new parameter system_data + - Model ConnectToSourceMySqlTaskInput has a new parameter is_offline_migration + - Model ProjectTask has a new parameter system_data + +**Breaking changes** + + - Parameter result_type of model MigrateSchemaSqlServerSqlDbTaskOutputError is now required + - Parameter result_type of model MigrateSchemaSqlServerSqlDbTaskOutput is now required + - Parameter result_type of model MigrateSchemaSqlServerSqlDbTaskOutputMigrationLevel is now required + - Parameter result_type of model MigrateSchemaSqlServerSqlDbTaskOutputDatabaseLevel is now required + - Parameter result_type of model MigrateSchemaSqlTaskOutputError is now required + ## 9.0.0 (2021-04-07) **Features** diff --git a/sdk/datamigration/azure-mgmt-datamigration/MANIFEST.in b/sdk/datamigration/azure-mgmt-datamigration/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/MANIFEST.in +++ b/sdk/datamigration/azure-mgmt-datamigration/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/datamigration/azure-mgmt-datamigration/_meta.json b/sdk/datamigration/azure-mgmt-datamigration/_meta.json new file mode 100644 index 000000000000..a8d432b309aa --- /dev/null +++ b/sdk/datamigration/azure-mgmt-datamigration/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "850425353115aa23d469f12f44847ff9e8326294", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/datamigration/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/datamigration/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_configuration.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_configuration.py index fb14e90d4c10..1cf3678b0b78 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_configuration.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-07-15-preview" + self.api_version = "2021-06-30" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-datamigration/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_data_migration_management_client.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_data_migration_management_client.py index 5a89a72e4d7a..356d1f60be9b 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_data_migration_management_client.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_data_migration_management_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import DataMigrationManagementClientConfiguration from .operations import ResourceSkusOperations @@ -91,6 +92,24 @@ def __init__( self.files = FilesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_metadata.json b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_metadata.json index f1599761d515..fea5b14b43b6 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_metadata.json +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2018-07-15-preview", - "total_api_version_list": ["2018-07-15-preview"], + "chosen_version": "2021-06-30", + "total_api_version_list": ["2021-06-30"], "client": { "name": "DataMigrationManagementClient", "filename": "_data_migration_management_client", @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataMigrationManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataMigrationManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataMigrationManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DataMigrationManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -106,11 +106,5 @@ "usages": "UsagesOperations", "operations": "Operations", "files": "FilesOperations" - }, - "operation_mixins": { - "sync_imports": "None", - "async_imports": "None", - "operations": { - } } } \ No newline at end of file diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_version.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_version.py index b77ac9246082..9f8bb24bdd99 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_version.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0" +VERSION = "10.0.0" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_configuration.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_configuration.py index fd3f194391cc..6a35d74a7602 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_configuration.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_configuration.py @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-07-15-preview" + self.api_version = "2021-06-30" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-datamigration/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_data_migration_management_client.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_data_migration_management_client.py index afddfe9a67e6..672ca04d1562 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_data_migration_management_client.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/_data_migration_management_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -88,6 +89,23 @@ def __init__( self.files = FilesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_files_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_files_operations.py index 456bf8191654..b9ff418d9a5c 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_files_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_files_operations.py @@ -46,7 +46,7 @@ def list( group_name: str, service_name: str, project_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.FileList"]: """Get files in a project. @@ -69,7 +69,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -129,7 +129,7 @@ async def get( service_name: str, project_name: str, file_name: str, - **kwargs + **kwargs: Any ) -> "_models.ProjectFile": """Get file information. @@ -154,7 +154,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -200,7 +200,7 @@ async def create_or_update( project_name: str, file_name: str, parameters: "_models.ProjectFile", - **kwargs + **kwargs: Any ) -> "_models.ProjectFile": """Create a file resource. @@ -226,7 +226,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -280,7 +280,7 @@ async def delete( service_name: str, project_name: str, file_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete file. @@ -304,7 +304,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -347,7 +347,7 @@ async def update( project_name: str, file_name: str, parameters: "_models.ProjectFile", - **kwargs + **kwargs: Any ) -> "_models.ProjectFile": """Update a file. @@ -373,7 +373,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -423,7 +423,7 @@ async def read( service_name: str, project_name: str, file_name: str, - **kwargs + **kwargs: Any ) -> "_models.FileStorageInfo": """Request storage information for downloading the file content. @@ -448,7 +448,7 @@ async def read( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -493,7 +493,7 @@ async def read_write( service_name: str, project_name: str, file_name: str, - **kwargs + **kwargs: Any ) -> "_models.FileStorageInfo": """Request information for reading and writing file content. @@ -517,7 +517,7 @@ async def read_write( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_operations.py index 0c4fccb0365b..084ece29dd8c 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServiceOperationList"]: """Get available resource provider actions (operations). @@ -59,7 +59,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_projects_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_projects_operations.py index e5be74bf73bb..a46f80a04bdb 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_projects_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_projects_operations.py @@ -45,7 +45,7 @@ def list( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ProjectList"]: """Get projects in a service. @@ -66,7 +66,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -125,7 +125,7 @@ async def create_or_update( service_name: str, project_name: str, parameters: "_models.Project", - **kwargs + **kwargs: Any ) -> "_models.Project": """Create or update project. @@ -150,7 +150,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -202,7 +202,7 @@ async def get( group_name: str, service_name: str, project_name: str, - **kwargs + **kwargs: Any ) -> "_models.Project": """Get project information. @@ -225,7 +225,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -269,7 +269,7 @@ async def delete( service_name: str, project_name: str, delete_running_tasks: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> None: """Delete project. @@ -294,7 +294,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -337,7 +337,7 @@ async def update( service_name: str, project_name: str, parameters: "_models.Project", - **kwargs + **kwargs: Any ) -> "_models.Project": """Update project. @@ -362,7 +362,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_resource_skus_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_resource_skus_operations.py index c9d47f16c7c5..a14042c2e597 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_resource_skus_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_resource_skus_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_skus( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ResourceSkusResult"]: """Get supported SKUs. @@ -59,7 +59,7 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_service_tasks_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_service_tasks_operations.py index d90b7f6da567..bfe711b48276 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_service_tasks_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_service_tasks_operations.py @@ -46,7 +46,7 @@ def list( group_name: str, service_name: str, task_type: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TaskList"]: """Get service level tasks for a service. @@ -71,7 +71,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -132,7 +132,7 @@ async def create_or_update( service_name: str, task_name: str, parameters: "_models.ProjectTask", - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Create or update service task. @@ -159,7 +159,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -212,7 +212,7 @@ async def get( service_name: str, task_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Get service task information. @@ -237,7 +237,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -283,7 +283,7 @@ async def delete( service_name: str, task_name: str, delete_running_tasks: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> None: """Delete service task. @@ -308,7 +308,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -351,7 +351,7 @@ async def update( service_name: str, task_name: str, parameters: "_models.ProjectTask", - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Create or update service task. @@ -377,7 +377,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -425,7 +425,7 @@ async def cancel( group_name: str, service_name: str, task_name: str, - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Cancel a service task. @@ -448,7 +448,7 @@ async def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_services_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_services_operations.py index fc2df220921a..04467e7f1a2a 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_services_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_services_operations.py @@ -48,14 +48,14 @@ async def _create_or_update_initial( group_name: str, service_name: str, parameters: "_models.DataMigrationService", - **kwargs + **kwargs: Any ) -> Optional["_models.DataMigrationService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataMigrationService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -107,7 +107,7 @@ async def begin_create_or_update( group_name: str, service_name: str, parameters: "_models.DataMigrationService", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataMigrationService"]: """Create or update DMS Instance. @@ -128,8 +128,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.datamigration.models.DataMigrationService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DataMigrationService or the result of cls(response) @@ -186,7 +186,7 @@ async def get( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataMigrationService": """Get DMS Service Instance. @@ -207,7 +207,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -249,14 +249,14 @@ async def _delete_initial( group_name: str, service_name: str, delete_running_tasks: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -297,7 +297,7 @@ async def begin_delete( group_name: str, service_name: str, delete_running_tasks: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete DMS Service Instance. @@ -312,8 +312,8 @@ async def begin_delete( :type delete_running_tasks: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -368,14 +368,14 @@ async def _update_initial( group_name: str, service_name: str, parameters: "_models.DataMigrationService", - **kwargs + **kwargs: Any ) -> Optional["_models.DataMigrationService"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataMigrationService"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -424,7 +424,7 @@ async def begin_update( group_name: str, service_name: str, parameters: "_models.DataMigrationService", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.DataMigrationService"]: """Create or update DMS Service Instance. @@ -441,8 +441,8 @@ async def begin_update( :type parameters: ~azure.mgmt.datamigration.models.DataMigrationService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either DataMigrationService or the result of cls(response) @@ -499,7 +499,7 @@ async def check_status( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> "_models.DataMigrationServiceStatusResponse": """Check service health status. @@ -521,7 +521,7 @@ async def check_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -562,14 +562,14 @@ async def _start_initial( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -607,7 +607,7 @@ async def begin_start( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Start service. @@ -620,8 +620,8 @@ async def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -674,14 +674,14 @@ async def _stop_initial( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -719,7 +719,7 @@ async def begin_stop( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Stop service. @@ -733,8 +733,8 @@ async def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -787,7 +787,7 @@ def list_skus( self, group_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServiceSkuList"]: """Get compatible SKUs. @@ -808,7 +808,7 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -866,7 +866,7 @@ async def check_children_name_availability( group_name: str, service_name: str, parameters: "_models.NameAvailabilityRequest", - **kwargs + **kwargs: Any ) -> "_models.NameAvailabilityResponse": """Check nested resource name validity and availability. @@ -888,7 +888,7 @@ async def check_children_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -933,7 +933,7 @@ async def check_children_name_availability( def list_by_resource_group( self, group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataMigrationServiceList"]: """Get services in resource group. @@ -952,7 +952,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -1006,7 +1006,7 @@ async def get_next(next_link=None): def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.DataMigrationServiceList"]: """Get services in subscription. @@ -1023,7 +1023,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -1078,7 +1078,7 @@ async def check_name_availability( self, location: str, parameters: "_models.NameAvailabilityRequest", - **kwargs + **kwargs: Any ) -> "_models.NameAvailabilityResponse": """Check name validity and availability. @@ -1098,7 +1098,7 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_tasks_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_tasks_operations.py index 26b7f5335478..df5a2348ffa3 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_tasks_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_tasks_operations.py @@ -47,7 +47,7 @@ def list( service_name: str, project_name: str, task_type: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.TaskList"]: """Get tasks in a service. @@ -73,7 +73,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -136,7 +136,7 @@ async def create_or_update( project_name: str, task_name: str, parameters: "_models.ProjectTask", - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Create or update task. @@ -164,7 +164,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -219,7 +219,7 @@ async def get( project_name: str, task_name: str, expand: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Get task information. @@ -246,7 +246,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -294,7 +294,7 @@ async def delete( project_name: str, task_name: str, delete_running_tasks: Optional[bool] = None, - **kwargs + **kwargs: Any ) -> None: """Delete task. @@ -321,7 +321,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -366,7 +366,7 @@ async def update( project_name: str, task_name: str, parameters: "_models.ProjectTask", - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Create or update task. @@ -394,7 +394,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -444,7 +444,7 @@ async def cancel( service_name: str, project_name: str, task_name: str, - **kwargs + **kwargs: Any ) -> "_models.ProjectTask": """Cancel a task. @@ -469,7 +469,7 @@ async def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -515,7 +515,7 @@ async def command( project_name: str, task_name: str, parameters: "_models.CommandProperties", - **kwargs + **kwargs: Any ) -> "_models.CommandProperties": """Execute a command on a task. @@ -542,7 +542,7 @@ async def command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_usages_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_usages_operations.py index 7e72a4270d1b..53c421bb9941 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_usages_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/aio/operations/_usages_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, location: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.QuotaList"]: """Get resource quotas and usage information. @@ -63,7 +63,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/__init__.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/__init__.py index e5c69ebe4274..c0f8d87c93ca 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/__init__.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/__init__.py @@ -82,6 +82,9 @@ from ._models_py3 import GetTdeCertificatesSqlTaskInput from ._models_py3 import GetTdeCertificatesSqlTaskOutput from ._models_py3 import GetTdeCertificatesSqlTaskProperties + from ._models_py3 import GetUserTablesMySqlTaskInput + from ._models_py3 import GetUserTablesMySqlTaskOutput + from ._models_py3 import GetUserTablesMySqlTaskProperties from ._models_py3 import GetUserTablesOracleTaskInput from ._models_py3 import GetUserTablesOracleTaskOutput from ._models_py3 import GetUserTablesOracleTaskProperties @@ -102,6 +105,14 @@ from ._models_py3 import MigrateMISyncCompleteCommandOutput from ._models_py3 import MigrateMISyncCompleteCommandProperties from ._models_py3 import MigrateMongoDbTaskProperties + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineDatabaseInput + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskInput + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskOutput + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskOutputError + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel + from ._models_py3 import MigrateMySqlAzureDbForMySqlOfflineTaskProperties from ._models_py3 import MigrateMySqlAzureDbForMySqlSyncDatabaseInput from ._models_py3 import MigrateMySqlAzureDbForMySqlSyncTaskInput from ._models_py3 import MigrateMySqlAzureDbForMySqlSyncTaskOutput @@ -152,9 +163,11 @@ from ._models_py3 import MigrateSqlServerSqlDbTaskInput from ._models_py3 import MigrateSqlServerSqlDbTaskOutput from ._models_py3 import MigrateSqlServerSqlDbTaskOutputDatabaseLevel + from ._models_py3 import MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult from ._models_py3 import MigrateSqlServerSqlDbTaskOutputError from ._models_py3 import MigrateSqlServerSqlDbTaskOutputMigrationLevel from ._models_py3 import MigrateSqlServerSqlDbTaskOutputTableLevel + from ._models_py3 import MigrateSqlServerSqlDbTaskOutputValidationResult from ._models_py3 import MigrateSqlServerSqlDbTaskProperties from ._models_py3 import MigrateSqlServerSqlMIDatabaseInput from ._models_py3 import MigrateSqlServerSqlMISyncTaskInput @@ -255,6 +268,7 @@ from ._models_py3 import SsisMigrationInfo from ._models_py3 import StartMigrationScenarioServerRoleResult from ._models_py3 import SyncMigrationDatabaseErrorEvent + from ._models_py3 import SystemData from ._models_py3 import TaskList from ._models_py3 import TrackedResource from ._models_py3 import UploadOCIDriverTaskInput @@ -350,6 +364,9 @@ from ._models import GetTdeCertificatesSqlTaskInput # type: ignore from ._models import GetTdeCertificatesSqlTaskOutput # type: ignore from ._models import GetTdeCertificatesSqlTaskProperties # type: ignore + from ._models import GetUserTablesMySqlTaskInput # type: ignore + from ._models import GetUserTablesMySqlTaskOutput # type: ignore + from ._models import GetUserTablesMySqlTaskProperties # type: ignore from ._models import GetUserTablesOracleTaskInput # type: ignore from ._models import GetUserTablesOracleTaskOutput # type: ignore from ._models import GetUserTablesOracleTaskProperties # type: ignore @@ -370,6 +387,14 @@ from ._models import MigrateMISyncCompleteCommandOutput # type: ignore from ._models import MigrateMISyncCompleteCommandProperties # type: ignore from ._models import MigrateMongoDbTaskProperties # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineDatabaseInput # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskInput # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskOutput # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskOutputError # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel # type: ignore + from ._models import MigrateMySqlAzureDbForMySqlOfflineTaskProperties # type: ignore from ._models import MigrateMySqlAzureDbForMySqlSyncDatabaseInput # type: ignore from ._models import MigrateMySqlAzureDbForMySqlSyncTaskInput # type: ignore from ._models import MigrateMySqlAzureDbForMySqlSyncTaskOutput # type: ignore @@ -420,9 +445,11 @@ from ._models import MigrateSqlServerSqlDbTaskInput # type: ignore from ._models import MigrateSqlServerSqlDbTaskOutput # type: ignore from ._models import MigrateSqlServerSqlDbTaskOutputDatabaseLevel # type: ignore + from ._models import MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult # type: ignore from ._models import MigrateSqlServerSqlDbTaskOutputError # type: ignore from ._models import MigrateSqlServerSqlDbTaskOutputMigrationLevel # type: ignore from ._models import MigrateSqlServerSqlDbTaskOutputTableLevel # type: ignore + from ._models import MigrateSqlServerSqlDbTaskOutputValidationResult # type: ignore from ._models import MigrateSqlServerSqlDbTaskProperties # type: ignore from ._models import MigrateSqlServerSqlMIDatabaseInput # type: ignore from ._models import MigrateSqlServerSqlMISyncTaskInput # type: ignore @@ -523,6 +550,7 @@ from ._models import SsisMigrationInfo # type: ignore from ._models import StartMigrationScenarioServerRoleResult # type: ignore from ._models import SyncMigrationDatabaseErrorEvent # type: ignore + from ._models import SystemData # type: ignore from ._models import TaskList # type: ignore from ._models import TrackedResource # type: ignore from ._models import UploadOCIDriverTaskInput # type: ignore @@ -549,6 +577,7 @@ BackupMode, BackupType, CommandState, + CreatedByType, DataMigrationResultCode, DatabaseCompatLevel, DatabaseFileType, @@ -671,6 +700,9 @@ 'GetTdeCertificatesSqlTaskInput', 'GetTdeCertificatesSqlTaskOutput', 'GetTdeCertificatesSqlTaskProperties', + 'GetUserTablesMySqlTaskInput', + 'GetUserTablesMySqlTaskOutput', + 'GetUserTablesMySqlTaskProperties', 'GetUserTablesOracleTaskInput', 'GetUserTablesOracleTaskOutput', 'GetUserTablesOracleTaskProperties', @@ -691,6 +723,14 @@ 'MigrateMISyncCompleteCommandOutput', 'MigrateMISyncCompleteCommandProperties', 'MigrateMongoDbTaskProperties', + 'MigrateMySqlAzureDbForMySqlOfflineDatabaseInput', + 'MigrateMySqlAzureDbForMySqlOfflineTaskInput', + 'MigrateMySqlAzureDbForMySqlOfflineTaskOutput', + 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel', + 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputError', + 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel', + 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel', + 'MigrateMySqlAzureDbForMySqlOfflineTaskProperties', 'MigrateMySqlAzureDbForMySqlSyncDatabaseInput', 'MigrateMySqlAzureDbForMySqlSyncTaskInput', 'MigrateMySqlAzureDbForMySqlSyncTaskOutput', @@ -741,9 +781,11 @@ 'MigrateSqlServerSqlDbTaskInput', 'MigrateSqlServerSqlDbTaskOutput', 'MigrateSqlServerSqlDbTaskOutputDatabaseLevel', + 'MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult', 'MigrateSqlServerSqlDbTaskOutputError', 'MigrateSqlServerSqlDbTaskOutputMigrationLevel', 'MigrateSqlServerSqlDbTaskOutputTableLevel', + 'MigrateSqlServerSqlDbTaskOutputValidationResult', 'MigrateSqlServerSqlDbTaskProperties', 'MigrateSqlServerSqlMIDatabaseInput', 'MigrateSqlServerSqlMISyncTaskInput', @@ -844,6 +886,7 @@ 'SsisMigrationInfo', 'StartMigrationScenarioServerRoleResult', 'SyncMigrationDatabaseErrorEvent', + 'SystemData', 'TaskList', 'TrackedResource', 'UploadOCIDriverTaskInput', @@ -868,6 +911,7 @@ 'BackupMode', 'BackupType', 'CommandState', + 'CreatedByType', 'DataMigrationResultCode', 'DatabaseCompatLevel', 'DatabaseFileType', diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_data_migration_management_client_enums.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_data_migration_management_client_enums.py index dc68ebf34d36..b3e390d66cab 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_data_migration_management_client_enums.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_data_migration_management_client_enums.py @@ -77,6 +77,15 @@ class CommandState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" FAILED = "Failed" +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + class DatabaseCompatLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """An enumeration of SQL Server database compatibility levels """ diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models.py index 5727adefdf0f..bed787077512 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models.py @@ -13,12 +13,21 @@ class ApiError(msrest.serialization.Model): """Error information. + Variables are only populated by the server, and will be ignored when sending a request. + :param error: Error information in OData format. :type error: ~azure.mgmt.datamigration.models.ODataError + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ + _validation = { + 'system_data': {'readonly': True}, + } + _attribute_map = { 'error': {'key': 'error', 'type': 'ODataError'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -27,6 +36,7 @@ def __init__( ): super(ApiError, self).__init__(**kwargs) self.error = kwargs.get('error', None) + self.system_data = None class AvailableServiceSku(msrest.serialization.Model): @@ -316,7 +326,7 @@ class ProjectTaskProperties(msrest.serialization.Model): """Base class for all types of DMS task properties. If task is not supported by current client, this object is returned. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ConnectToMongoDbTaskProperties, ConnectToSourceMySqlTaskProperties, ConnectToSourceOracleSyncTaskProperties, ConnectToSourcePostgreSqlSyncTaskProperties, ConnectToSourceSqlServerTaskProperties, ConnectToSourceSqlServerSyncTaskProperties, ConnectToTargetAzureDbForMySqlTaskProperties, ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlMITaskProperties, ConnectToTargetSqlMISyncTaskProperties, ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlDbTaskProperties, ConnectToTargetSqlDbSyncTaskProperties, GetTdeCertificatesSqlTaskProperties, GetUserTablesSqlSyncTaskProperties, GetUserTablesSqlTaskProperties, GetUserTablesOracleTaskProperties, GetUserTablesPostgreSqlTaskProperties, MigrateMongoDbTaskProperties, MigrateMySqlAzureDbForMySqlSyncTaskProperties, MigrateOracleAzureDbForPostgreSqlSyncTaskProperties, MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties, MigrateSqlServerSqlDbSyncTaskProperties, MigrateSqlServerSqlMITaskProperties, MigrateSqlServerSqlMISyncTaskProperties, MigrateSqlServerSqlDbTaskProperties, MigrateSsisTaskProperties, MigrateSchemaSqlServerSqlDbTaskProperties, CheckOCIDriverTaskProperties, InstallOCIDriverTaskProperties, UploadOCIDriverTaskProperties, ValidateMongoDbTaskProperties, ValidateOracleAzureDbForPostgreSqlSyncTaskProperties, ValidateMigrationInputSqlServerSqlMITaskProperties, ValidateMigrationInputSqlServerSqlMISyncTaskProperties, ValidateMigrationInputSqlServerSqlDbSyncTaskProperties. + sub-classes are: ConnectToMongoDbTaskProperties, ConnectToSourceMySqlTaskProperties, ConnectToSourceOracleSyncTaskProperties, ConnectToSourcePostgreSqlSyncTaskProperties, ConnectToSourceSqlServerTaskProperties, ConnectToSourceSqlServerSyncTaskProperties, ConnectToTargetAzureDbForMySqlTaskProperties, ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlMITaskProperties, ConnectToTargetSqlMISyncTaskProperties, ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlDbTaskProperties, ConnectToTargetSqlDbSyncTaskProperties, GetTdeCertificatesSqlTaskProperties, GetUserTablesSqlSyncTaskProperties, GetUserTablesSqlTaskProperties, GetUserTablesMySqlTaskProperties, GetUserTablesOracleTaskProperties, GetUserTablesPostgreSqlTaskProperties, MigrateMongoDbTaskProperties, MigrateMySqlAzureDbForMySqlOfflineTaskProperties, MigrateMySqlAzureDbForMySqlSyncTaskProperties, MigrateOracleAzureDbForPostgreSqlSyncTaskProperties, MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties, MigrateSqlServerSqlDbSyncTaskProperties, MigrateSqlServerSqlMITaskProperties, MigrateSqlServerSqlMISyncTaskProperties, MigrateSqlServerSqlDbTaskProperties, MigrateSsisTaskProperties, MigrateSchemaSqlServerSqlDbTaskProperties, CheckOCIDriverTaskProperties, InstallOCIDriverTaskProperties, UploadOCIDriverTaskProperties, ValidateMongoDbTaskProperties, ValidateOracleAzureDbForPostgreSqlSyncTaskProperties, ValidateMigrationInputSqlServerSqlMITaskProperties, ValidateMigrationInputSqlServerSqlMISyncTaskProperties, ValidateMigrationInputSqlServerSqlDbSyncTaskProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -352,7 +362,7 @@ class ProjectTaskProperties(msrest.serialization.Model): } _subtype_map = { - 'task_type': {'Connect.MongoDb': 'ConnectToMongoDbTaskProperties', 'ConnectToSource.MySql': 'ConnectToSourceMySqlTaskProperties', 'ConnectToSource.Oracle.Sync': 'ConnectToSourceOracleSyncTaskProperties', 'ConnectToSource.PostgreSql.Sync': 'ConnectToSourcePostgreSqlSyncTaskProperties', 'ConnectToSource.SqlServer': 'ConnectToSourceSqlServerTaskProperties', 'ConnectToSource.SqlServer.Sync': 'ConnectToSourceSqlServerSyncTaskProperties', 'ConnectToTarget.AzureDbForMySql': 'ConnectToTargetAzureDbForMySqlTaskProperties', 'ConnectToTarget.AzureDbForPostgreSql.Sync': 'ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.AzureSqlDbMI': 'ConnectToTargetSqlMITaskProperties', 'ConnectToTarget.AzureSqlDbMI.Sync.LRS': 'ConnectToTargetSqlMISyncTaskProperties', 'ConnectToTarget.Oracle.AzureDbForPostgreSql.Sync': 'ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.SqlDb': 'ConnectToTargetSqlDbTaskProperties', 'ConnectToTarget.SqlDb.Sync': 'ConnectToTargetSqlDbSyncTaskProperties', 'GetTDECertificates.Sql': 'GetTdeCertificatesSqlTaskProperties', 'GetUserTables.AzureSqlDb.Sync': 'GetUserTablesSqlSyncTaskProperties', 'GetUserTables.Sql': 'GetUserTablesSqlTaskProperties', 'GetUserTablesOracle': 'GetUserTablesOracleTaskProperties', 'GetUserTablesPostgreSql': 'GetUserTablesPostgreSqlTaskProperties', 'Migrate.MongoDb': 'MigrateMongoDbTaskProperties', 'Migrate.MySql.AzureDbForMySql.Sync': 'MigrateMySqlAzureDbForMySqlSyncTaskProperties', 'Migrate.Oracle.AzureDbForPostgreSql.Sync': 'MigrateOracleAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.PostgreSql.AzureDbForPostgreSql.SyncV2': 'MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDb.Sync': 'MigrateSqlServerSqlDbSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDbMI': 'MigrateSqlServerSqlMITaskProperties', 'Migrate.SqlServer.AzureSqlDbMI.Sync.LRS': 'MigrateSqlServerSqlMISyncTaskProperties', 'Migrate.SqlServer.SqlDb': 'MigrateSqlServerSqlDbTaskProperties', 'Migrate.Ssis': 'MigrateSsisTaskProperties', 'MigrateSchemaSqlServerSqlDb': 'MigrateSchemaSqlServerSqlDbTaskProperties', 'Service.Check.OCI': 'CheckOCIDriverTaskProperties', 'Service.Install.OCI': 'InstallOCIDriverTaskProperties', 'Service.Upload.OCI': 'UploadOCIDriverTaskProperties', 'Validate.MongoDb': 'ValidateMongoDbTaskProperties', 'Validate.Oracle.AzureDbPostgreSql.Sync': 'ValidateOracleAzureDbForPostgreSqlSyncTaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI': 'ValidateMigrationInputSqlServerSqlMITaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI.Sync.LRS': 'ValidateMigrationInputSqlServerSqlMISyncTaskProperties', 'ValidateMigrationInput.SqlServer.SqlDb.Sync': 'ValidateMigrationInputSqlServerSqlDbSyncTaskProperties'} + 'task_type': {'Connect.MongoDb': 'ConnectToMongoDbTaskProperties', 'ConnectToSource.MySql': 'ConnectToSourceMySqlTaskProperties', 'ConnectToSource.Oracle.Sync': 'ConnectToSourceOracleSyncTaskProperties', 'ConnectToSource.PostgreSql.Sync': 'ConnectToSourcePostgreSqlSyncTaskProperties', 'ConnectToSource.SqlServer': 'ConnectToSourceSqlServerTaskProperties', 'ConnectToSource.SqlServer.Sync': 'ConnectToSourceSqlServerSyncTaskProperties', 'ConnectToTarget.AzureDbForMySql': 'ConnectToTargetAzureDbForMySqlTaskProperties', 'ConnectToTarget.AzureDbForPostgreSql.Sync': 'ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.AzureSqlDbMI': 'ConnectToTargetSqlMITaskProperties', 'ConnectToTarget.AzureSqlDbMI.Sync.LRS': 'ConnectToTargetSqlMISyncTaskProperties', 'ConnectToTarget.Oracle.AzureDbForPostgreSql.Sync': 'ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.SqlDb': 'ConnectToTargetSqlDbTaskProperties', 'ConnectToTarget.SqlDb.Sync': 'ConnectToTargetSqlDbSyncTaskProperties', 'GetTDECertificates.Sql': 'GetTdeCertificatesSqlTaskProperties', 'GetUserTables.AzureSqlDb.Sync': 'GetUserTablesSqlSyncTaskProperties', 'GetUserTables.Sql': 'GetUserTablesSqlTaskProperties', 'GetUserTablesMySql': 'GetUserTablesMySqlTaskProperties', 'GetUserTablesOracle': 'GetUserTablesOracleTaskProperties', 'GetUserTablesPostgreSql': 'GetUserTablesPostgreSqlTaskProperties', 'Migrate.MongoDb': 'MigrateMongoDbTaskProperties', 'Migrate.MySql.AzureDbForMySql': 'MigrateMySqlAzureDbForMySqlOfflineTaskProperties', 'Migrate.MySql.AzureDbForMySql.Sync': 'MigrateMySqlAzureDbForMySqlSyncTaskProperties', 'Migrate.Oracle.AzureDbForPostgreSql.Sync': 'MigrateOracleAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.PostgreSql.AzureDbForPostgreSql.SyncV2': 'MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDb.Sync': 'MigrateSqlServerSqlDbSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDbMI': 'MigrateSqlServerSqlMITaskProperties', 'Migrate.SqlServer.AzureSqlDbMI.Sync.LRS': 'MigrateSqlServerSqlMISyncTaskProperties', 'Migrate.SqlServer.SqlDb': 'MigrateSqlServerSqlDbTaskProperties', 'Migrate.Ssis': 'MigrateSsisTaskProperties', 'MigrateSchemaSqlServerSqlDb': 'MigrateSchemaSqlServerSqlDbTaskProperties', 'Service.Check.OCI': 'CheckOCIDriverTaskProperties', 'Service.Install.OCI': 'InstallOCIDriverTaskProperties', 'Service.Upload.OCI': 'UploadOCIDriverTaskProperties', 'Validate.MongoDb': 'ValidateMongoDbTaskProperties', 'Validate.Oracle.AzureDbPostgreSql.Sync': 'ValidateOracleAzureDbForPostgreSqlSyncTaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI': 'ValidateMigrationInputSqlServerSqlMITaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI.Sync.LRS': 'ValidateMigrationInputSqlServerSqlMISyncTaskProperties', 'ValidateMigrationInput.SqlServer.SqlDb.Sync': 'ValidateMigrationInputSqlServerSqlDbSyncTaskProperties'} } def __init__( @@ -573,6 +583,8 @@ class ConnectToSourceMySqlTaskInput(msrest.serialization.Model): "MigrationFromMySQLToAzureDBForMySQL". :type check_permissions_group: str or ~azure.mgmt.datamigration.models.ServerLevelPermissionsGroup + :param is_offline_migration: Flag for whether or not the migration is offline. + :type is_offline_migration: bool """ _validation = { @@ -583,6 +595,7 @@ class ConnectToSourceMySqlTaskInput(msrest.serialization.Model): 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_platform': {'key': 'targetPlatform', 'type': 'str'}, 'check_permissions_group': {'key': 'checkPermissionsGroup', 'type': 'str'}, + 'is_offline_migration': {'key': 'isOfflineMigration', 'type': 'bool'}, } def __init__( @@ -593,6 +606,7 @@ def __init__( self.source_connection_info = kwargs['source_connection_info'] self.target_platform = kwargs.get('target_platform', None) self.check_permissions_group = kwargs.get('check_permissions_group', None) + self.is_offline_migration = kwargs.get('is_offline_migration', False) class ConnectToSourceMySqlTaskProperties(ProjectTaskProperties): @@ -1398,6 +1412,8 @@ class ConnectToTargetAzureDbForMySqlTaskInput(msrest.serialization.Model): :param target_connection_info: Required. Connection information for target Azure Database for MySQL server. :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param is_offline_migration: Flag for whether or not the migration is offline. + :type is_offline_migration: bool """ _validation = { @@ -1408,6 +1424,7 @@ class ConnectToTargetAzureDbForMySqlTaskInput(msrest.serialization.Model): _attribute_map = { 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'is_offline_migration': {'key': 'isOfflineMigration', 'type': 'bool'}, } def __init__( @@ -1417,6 +1434,7 @@ def __init__( super(ConnectToTargetAzureDbForMySqlTaskInput, self).__init__(**kwargs) self.source_connection_info = kwargs['source_connection_info'] self.target_connection_info = kwargs['target_connection_info'] + self.is_offline_migration = kwargs.get('is_offline_migration', False) class ConnectToTargetAzureDbForMySqlTaskOutput(msrest.serialization.Model): @@ -2881,6 +2899,8 @@ class TrackedResource(Resource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { @@ -2888,6 +2908,7 @@ class TrackedResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -2896,6 +2917,7 @@ class TrackedResource(Resource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -2905,6 +2927,7 @@ def __init__( super(TrackedResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.location = kwargs['location'] + self.system_data = None class DataMigrationService(TrackedResource): @@ -2924,6 +2947,8 @@ class DataMigrationService(TrackedResource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData :param etag: HTTP strong entity tag value. Ignored if submitted. :type etag: str :param kind: The resource kind. Only 'vm' (the default) is supported. @@ -2949,6 +2974,7 @@ class DataMigrationService(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -2958,6 +2984,7 @@ class DataMigrationService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'etag': {'key': 'etag', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'ServiceSku'}, @@ -3306,6 +3333,124 @@ def __init__( self.output = None +class GetUserTablesMySqlTaskInput(msrest.serialization.Model): + """Input for the task that collects user tables for the given list of databases. + + All required parameters must be populated in order to send to Azure. + + :param connection_info: Required. Connection information for SQL Server. + :type connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param selected_databases: Required. List of database names to collect tables for. + :type selected_databases: list[str] + """ + + _validation = { + 'connection_info': {'required': True}, + 'selected_databases': {'required': True}, + } + + _attribute_map = { + 'connection_info': {'key': 'connectionInfo', 'type': 'MySqlConnectionInfo'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GetUserTablesMySqlTaskInput, self).__init__(**kwargs) + self.connection_info = kwargs['connection_info'] + self.selected_databases = kwargs['selected_databases'] + + +class GetUserTablesMySqlTaskOutput(msrest.serialization.Model): + """Output of the task that collects user tables for the given list of databases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Result identifier. + :vartype id: str + :ivar databases_to_tables: Mapping from database name to list of tables. + :vartype databases_to_tables: str + :ivar validation_errors: Validation errors. + :vartype validation_errors: list[~azure.mgmt.datamigration.models.ReportableException] + """ + + _validation = { + 'id': {'readonly': True}, + 'databases_to_tables': {'readonly': True}, + 'validation_errors': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'databases_to_tables': {'key': 'databasesToTables', 'type': 'str'}, + 'validation_errors': {'key': 'validationErrors', 'type': '[ReportableException]'}, + } + + def __init__( + self, + **kwargs + ): + super(GetUserTablesMySqlTaskOutput, self).__init__(**kwargs) + self.id = None + self.databases_to_tables = None + self.validation_errors = None + + +class GetUserTablesMySqlTaskProperties(ProjectTaskProperties): + """Properties for the task that collects user tables for the given list of databases. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param task_type: Required. Task type.Constant filled by server. + :type task_type: str + :ivar errors: Array of errors. This is ignored if submitted. + :vartype errors: list[~azure.mgmt.datamigration.models.ODataError] + :ivar state: The state of the task. This is ignored if submitted. Possible values include: + "Unknown", "Queued", "Running", "Canceled", "Succeeded", "Failed", "FailedInputValidation", + "Faulted". + :vartype state: str or ~azure.mgmt.datamigration.models.TaskState + :ivar commands: Array of command properties. + :vartype commands: list[~azure.mgmt.datamigration.models.CommandProperties] + :param client_data: Key value pairs of client data to attach meta data information to task. + :type client_data: dict[str, str] + :param input: Task input. + :type input: ~azure.mgmt.datamigration.models.GetUserTablesMySqlTaskInput + :ivar output: Task output. This is ignored if submitted. + :vartype output: list[~azure.mgmt.datamigration.models.GetUserTablesMySqlTaskOutput] + """ + + _validation = { + 'task_type': {'required': True}, + 'errors': {'readonly': True}, + 'state': {'readonly': True}, + 'commands': {'readonly': True}, + 'output': {'readonly': True}, + } + + _attribute_map = { + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ODataError]'}, + 'state': {'key': 'state', 'type': 'str'}, + 'commands': {'key': 'commands', 'type': '[CommandProperties]'}, + 'client_data': {'key': 'clientData', 'type': '{str}'}, + 'input': {'key': 'input', 'type': 'GetUserTablesMySqlTaskInput'}, + 'output': {'key': 'output', 'type': '[GetUserTablesMySqlTaskOutput]'}, + } + + def __init__( + self, + **kwargs + ): + super(GetUserTablesMySqlTaskProperties, self).__init__(**kwargs) + self.task_type = 'GetUserTablesMySql' # type: str + self.input = kwargs.get('input', None) + self.output = None + + class GetUserTablesOracleTaskInput(msrest.serialization.Model): """Input for the task that gets the list of tables contained within a provided list of Oracle schemas. @@ -4034,20 +4179,14 @@ def __init__( self.output = None -class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): - """Database specific information for MySQL to Azure Database for MySQL migration task inputs. +class MigrateMySqlAzureDbForMySqlOfflineDatabaseInput(msrest.serialization.Model): + """Database specific information for offline MySQL to Azure Database for MySQL migration task inputs. :param name: Name of the database. :type name: str :param target_database_name: Name of target database. Note: Target database will be truncated before starting migration. :type target_database_name: str - :param migration_setting: Migration settings which tune the migration behavior. - :type migration_setting: dict[str, str] - :param source_setting: Source settings to tune source endpoint migration behavior. - :type source_setting: dict[str, str] - :param target_setting: Target settings to tune target endpoint migration behavior. - :type target_setting: dict[str, str] :param table_map: Mapping of source to target tables. :type table_map: dict[str, str] """ @@ -4055,9 +4194,6 @@ class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, - 'migration_setting': {'key': 'migrationSetting', 'type': '{str}'}, - 'source_setting': {'key': 'sourceSetting', 'type': '{str}'}, - 'target_setting': {'key': 'targetSetting', 'type': '{str}'}, 'table_map': {'key': 'tableMap', 'type': '{str}'}, } @@ -4065,17 +4201,14 @@ def __init__( self, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncDatabaseInput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineDatabaseInput, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.target_database_name = kwargs.get('target_database_name', None) - self.migration_setting = kwargs.get('migration_setting', None) - self.source_setting = kwargs.get('source_setting', None) - self.target_setting = kwargs.get('target_setting', None) self.table_map = kwargs.get('table_map', None) -class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): - """Input for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. +class MigrateMySqlAzureDbForMySqlOfflineTaskInput(msrest.serialization.Model): + """Input for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. All required parameters must be populated in order to send to Azure. @@ -4086,7 +4219,14 @@ class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo :param selected_databases: Required. Databases to migrate. :type selected_databases: - list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlSyncDatabaseInput] + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineDatabaseInput] + :param make_source_server_read_only: Setting to set the source server read only. + :type make_source_server_read_only: bool + :param started_on: Parameter to specify when the migration started. + :type started_on: ~datetime.datetime + :param optional_agent_settings: Optional parameters for fine tuning the data transfer rate + during migration. + :type optional_agent_settings: dict[str, str] """ _validation = { @@ -4098,24 +4238,30 @@ class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): _attribute_map = { 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, - 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlSyncDatabaseInput]'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlOfflineDatabaseInput]'}, + 'make_source_server_read_only': {'key': 'makeSourceServerReadOnly', 'type': 'bool'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'optional_agent_settings': {'key': 'optionalAgentSettings', 'type': '{str}'}, } def __init__( self, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskInput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineTaskInput, self).__init__(**kwargs) self.source_connection_info = kwargs['source_connection_info'] self.target_connection_info = kwargs['target_connection_info'] self.selected_databases = kwargs['selected_databases'] + self.make_source_server_read_only = kwargs.get('make_source_server_read_only', False) + self.started_on = kwargs.get('started_on', None) + self.optional_agent_settings = kwargs.get('optional_agent_settings', None) -class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): - """Output for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutput(msrest.serialization.Model): + """Output for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputError, MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel. + sub-classes are: MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlOfflineTaskOutputError, MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -4138,20 +4284,20 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): } _subtype_map = { - 'result_type': {'DatabaseLevelErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError', 'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel'} + 'result_type': {'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel'} } def __init__( self, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskOutput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutput, self).__init__(**kwargs) self.id = None self.result_type = None # type: Optional[str] -class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDbForMySqlSyncTaskOutput): - """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -4161,36 +4307,106 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDb :vartype id: str :param result_type: Required. Result type.Constant filled by server. :type result_type: str - :param error_message: Error message. - :type error_message: str - :param events: List of error events. - :type events: list[~azure.mgmt.datamigration.models.SyncMigrationDatabaseErrorEvent] + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar state: Current state of migration. Possible values include: "None", "InProgress", + "Failed", "Warning", "Completed", "Skipped", "Stopped". + :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState + :ivar stage: Migration stage that this database is in. Possible values include: "None", + "Initialize", "Backup", "FileCopy", "Restore", "Completed". + :vartype stage: str or ~azure.mgmt.datamigration.models.DatabaseMigrationStage + :ivar status_message: Status message. + :vartype status_message: str + :ivar message: Migration progress message. + :vartype message: str + :ivar number_of_objects: Number of objects. + :vartype number_of_objects: long + :ivar number_of_objects_completed: Number of successfully completed objects. + :vartype number_of_objects_completed: long + :ivar error_count: Number of database/object errors. + :vartype error_count: long + :ivar error_prefix: Wildcard string prefix to use for querying all errors of the item. + :vartype error_prefix: str + :ivar result_prefix: Wildcard string prefix to use for querying all sub-tem results of the + item. + :vartype result_prefix: str + :ivar exceptions_and_warnings: Migration exceptions and warnings. + :vartype exceptions_and_warnings: list[~azure.mgmt.datamigration.models.ReportableException] + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + :ivar object_summary: Summary of object results in the migration. + :vartype object_summary: str """ _validation = { 'id': {'readonly': True}, 'result_type': {'required': True}, + 'database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'state': {'readonly': True}, + 'stage': {'readonly': True}, + 'status_message': {'readonly': True}, + 'message': {'readonly': True}, + 'number_of_objects': {'readonly': True}, + 'number_of_objects_completed': {'readonly': True}, + 'error_count': {'readonly': True}, + 'error_prefix': {'readonly': True}, + 'result_prefix': {'readonly': True}, + 'exceptions_and_warnings': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + 'object_summary': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'result_type': {'key': 'resultType', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'events': {'key': 'events', 'type': '[SyncMigrationDatabaseErrorEvent]'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'state': {'key': 'state', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'number_of_objects': {'key': 'numberOfObjects', 'type': 'long'}, + 'number_of_objects_completed': {'key': 'numberOfObjectsCompleted', 'type': 'long'}, + 'error_count': {'key': 'errorCount', 'type': 'long'}, + 'error_prefix': {'key': 'errorPrefix', 'type': 'str'}, + 'result_prefix': {'key': 'resultPrefix', 'type': 'str'}, + 'exceptions_and_warnings': {'key': 'exceptionsAndWarnings', 'type': '[ReportableException]'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + 'object_summary': {'key': 'objectSummary', 'type': 'str'}, } def __init__( self, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, self).__init__(**kwargs) - self.result_type = 'DatabaseLevelErrorOutput' # type: str - self.error_message = kwargs.get('error_message', None) - self.events = kwargs.get('events', None) + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelOutput' # type: str + self.database_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.stage = None + self.status_message = None + self.message = None + self.number_of_objects = None + self.number_of_objects_completed = None + self.error_count = None + self.error_prefix = None + self.result_prefix = None + self.exceptions_and_warnings = None + self.last_storage_update = None + self.object_summary = None -class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlSyncTaskOutput): - """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputError(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputError. Variables are only populated by the server, and will be ignored when sending a request. @@ -4200,38 +4416,473 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDb :vartype id: str :param result_type: Required. Result type.Constant filled by server. :type result_type: str - :ivar database_name: Name of the database. - :vartype database_name: str - :ivar started_on: Migration start time. - :vartype started_on: ~datetime.datetime - :ivar ended_on: Migration end time. - :vartype ended_on: ~datetime.datetime - :ivar migration_state: Migration state that this database is in. Possible values include: - "UNDEFINED", "CONFIGURING", "INITIALIAZING", "STARTING", "RUNNING", "READY_TO_COMPLETE", - "COMPLETING", "COMPLETE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATING", - "VALIDATION_COMPLETE", "VALIDATION_FAILED", "RESTORE_IN_PROGRESS", "RESTORE_COMPLETED", - "BACKUP_IN_PROGRESS", "BACKUP_COMPLETED". - :vartype migration_state: str or - ~azure.mgmt.datamigration.models.SyncDatabaseMigrationReportingState - :ivar incoming_changes: Number of incoming changes. - :vartype incoming_changes: long - :ivar applied_changes: Number of applied changes. - :vartype applied_changes: long - :ivar cdc_insert_counter: Number of cdc inserts. - :vartype cdc_insert_counter: long - :ivar cdc_delete_counter: Number of cdc deletes. - :vartype cdc_delete_counter: long - :ivar cdc_update_counter: Number of cdc updates. - :vartype cdc_update_counter: long - :ivar full_load_completed_tables: Number of tables completed in full load. - :vartype full_load_completed_tables: long - :ivar full_load_loading_tables: Number of tables loading in full load. - :vartype full_load_loading_tables: long - :ivar full_load_queued_tables: Number of tables queued in full load. - :vartype full_load_queued_tables: long - :ivar full_load_errored_tables: Number of tables errored in full load. - :vartype full_load_errored_tables: long - :ivar initialization_completed: Indicates if initial load (full load) has been completed. + :ivar error: Migration error. + :vartype error: ~azure.mgmt.datamigration.models.ReportableException + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ReportableException'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputError, self).__init__(**kwargs) + self.result_type = 'ErrorOutput' # type: str + self.error = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar duration_in_seconds: Duration of task execution in seconds. + :vartype duration_in_seconds: long + :ivar status: Current status of migration. Possible values include: "Default", "Connecting", + "SourceAndTargetSelected", "SelectLogins", "Configured", "Running", "Error", "Stopped", + "Completed", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.datamigration.models.MigrationStatus + :ivar status_message: Migration status message. + :vartype status_message: str + :ivar message: Migration progress message. + :vartype message: str + :param databases: Selected databases as a map from database name to database id. + :type databases: str + :ivar database_summary: Summary of database results in the migration. + :vartype database_summary: str + :param migration_report_result: Migration Report Result, provides unique url for downloading + your migration report. + :type migration_report_result: ~azure.mgmt.datamigration.models.MigrationReportResult + :ivar source_server_version: Source server version. + :vartype source_server_version: str + :ivar source_server_brand_version: Source server brand version. + :vartype source_server_brand_version: str + :ivar target_server_version: Target server version. + :vartype target_server_version: str + :ivar target_server_brand_version: Target server brand version. + :vartype target_server_brand_version: str + :ivar exceptions_and_warnings: Migration exceptions and warnings. + :vartype exceptions_and_warnings: list[~azure.mgmt.datamigration.models.ReportableException] + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'duration_in_seconds': {'readonly': True}, + 'status': {'readonly': True}, + 'status_message': {'readonly': True}, + 'message': {'readonly': True}, + 'database_summary': {'readonly': True}, + 'source_server_version': {'readonly': True}, + 'source_server_brand_version': {'readonly': True}, + 'target_server_version': {'readonly': True}, + 'target_server_brand_version': {'readonly': True}, + 'exceptions_and_warnings': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'long'}, + 'status': {'key': 'status', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'databases': {'key': 'databases', 'type': 'str'}, + 'database_summary': {'key': 'databaseSummary', 'type': 'str'}, + 'migration_report_result': {'key': 'migrationReportResult', 'type': 'MigrationReportResult'}, + 'source_server_version': {'key': 'sourceServerVersion', 'type': 'str'}, + 'source_server_brand_version': {'key': 'sourceServerBrandVersion', 'type': 'str'}, + 'target_server_version': {'key': 'targetServerVersion', 'type': 'str'}, + 'target_server_brand_version': {'key': 'targetServerBrandVersion', 'type': 'str'}, + 'exceptions_and_warnings': {'key': 'exceptionsAndWarnings', 'type': '[ReportableException]'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel, self).__init__(**kwargs) + self.result_type = 'MigrationLevelOutput' # type: str + self.started_on = None + self.ended_on = None + self.duration_in_seconds = None + self.status = None + self.status_message = None + self.message = None + self.databases = kwargs.get('databases', None) + self.database_summary = None + self.migration_report_result = kwargs.get('migration_report_result', None) + self.source_server_version = None + self.source_server_brand_version = None + self.target_server_version = None + self.target_server_brand_version = None + self.exceptions_and_warnings = None + self.last_storage_update = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar object_name: Name of the item. + :vartype object_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar state: Current state of migration. Possible values include: "None", "InProgress", + "Failed", "Warning", "Completed", "Skipped", "Stopped". + :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState + :ivar status_message: Status message. + :vartype status_message: str + :ivar items_count: Number of items. + :vartype items_count: long + :ivar items_completed_count: Number of successfully completed items. + :vartype items_completed_count: long + :ivar error_prefix: Wildcard string prefix to use for querying all errors of the item. + :vartype error_prefix: str + :ivar result_prefix: Wildcard string prefix to use for querying all sub-tem results of the + item. + :vartype result_prefix: str + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'object_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'state': {'readonly': True}, + 'status_message': {'readonly': True}, + 'items_count': {'readonly': True}, + 'items_completed_count': {'readonly': True}, + 'error_prefix': {'readonly': True}, + 'result_prefix': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'object_name': {'key': 'objectName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'state': {'key': 'state', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'items_count': {'key': 'itemsCount', 'type': 'long'}, + 'items_completed_count': {'key': 'itemsCompletedCount', 'type': 'long'}, + 'error_prefix': {'key': 'errorPrefix', 'type': 'str'}, + 'result_prefix': {'key': 'resultPrefix', 'type': 'str'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel, self).__init__(**kwargs) + self.result_type = 'TableLevelOutput' # type: str + self.object_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.status_message = None + self.items_count = None + self.items_completed_count = None + self.error_prefix = None + self.result_prefix = None + self.last_storage_update = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskProperties(ProjectTaskProperties): + """Properties for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param task_type: Required. Task type.Constant filled by server. + :type task_type: str + :ivar errors: Array of errors. This is ignored if submitted. + :vartype errors: list[~azure.mgmt.datamigration.models.ODataError] + :ivar state: The state of the task. This is ignored if submitted. Possible values include: + "Unknown", "Queued", "Running", "Canceled", "Succeeded", "Failed", "FailedInputValidation", + "Faulted". + :vartype state: str or ~azure.mgmt.datamigration.models.TaskState + :ivar commands: Array of command properties. + :vartype commands: list[~azure.mgmt.datamigration.models.CommandProperties] + :param client_data: Key value pairs of client data to attach meta data information to task. + :type client_data: dict[str, str] + :param input: Task input. + :type input: ~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineTaskInput + :ivar output: Task output. This is ignored if submitted. + :vartype output: + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineTaskOutput] + """ + + _validation = { + 'task_type': {'required': True}, + 'errors': {'readonly': True}, + 'state': {'readonly': True}, + 'commands': {'readonly': True}, + 'output': {'readonly': True}, + } + + _attribute_map = { + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ODataError]'}, + 'state': {'key': 'state', 'type': 'str'}, + 'commands': {'key': 'commands', 'type': '[CommandProperties]'}, + 'client_data': {'key': 'clientData', 'type': '{str}'}, + 'input': {'key': 'input', 'type': 'MigrateMySqlAzureDbForMySqlOfflineTaskInput'}, + 'output': {'key': 'output', 'type': '[MigrateMySqlAzureDbForMySqlOfflineTaskOutput]'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskProperties, self).__init__(**kwargs) + self.task_type = 'Migrate.MySql.AzureDbForMySql' # type: str + self.input = kwargs.get('input', None) + self.output = None + + +class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): + """Database specific information for MySQL to Azure Database for MySQL migration task inputs. + + :param name: Name of the database. + :type name: str + :param target_database_name: Name of target database. Note: Target database will be truncated + before starting migration. + :type target_database_name: str + :param migration_setting: Migration settings which tune the migration behavior. + :type migration_setting: dict[str, str] + :param source_setting: Source settings to tune source endpoint migration behavior. + :type source_setting: dict[str, str] + :param target_setting: Target settings to tune target endpoint migration behavior. + :type target_setting: dict[str, str] + :param table_map: Mapping of source to target tables. + :type table_map: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'migration_setting': {'key': 'migrationSetting', 'type': '{str}'}, + 'source_setting': {'key': 'sourceSetting', 'type': '{str}'}, + 'target_setting': {'key': 'targetSetting', 'type': '{str}'}, + 'table_map': {'key': 'tableMap', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncDatabaseInput, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.target_database_name = kwargs.get('target_database_name', None) + self.migration_setting = kwargs.get('migration_setting', None) + self.source_setting = kwargs.get('source_setting', None) + self.target_setting = kwargs.get('target_setting', None) + self.table_map = kwargs.get('table_map', None) + + +class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): + """Input for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. + + All required parameters must be populated in order to send to Azure. + + :param source_connection_info: Required. Connection information for source MySQL. + :type source_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param target_connection_info: Required. Connection information for target Azure Database for + MySQL. + :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param selected_databases: Required. Databases to migrate. + :type selected_databases: + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlSyncDatabaseInput] + """ + + _validation = { + 'source_connection_info': {'required': True}, + 'target_connection_info': {'required': True}, + 'selected_databases': {'required': True}, + } + + _attribute_map = { + 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlSyncDatabaseInput]'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskInput, self).__init__(**kwargs) + self.source_connection_info = kwargs['source_connection_info'] + self.target_connection_info = kwargs['target_connection_info'] + self.selected_databases = kwargs['selected_databases'] + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): + """Output for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputError, MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + _subtype_map = { + 'result_type': {'DatabaseLevelErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError', 'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel'} + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskOutput, self).__init__(**kwargs) + self.id = None + self.result_type = None # type: Optional[str] + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDbForMySqlSyncTaskOutput): + """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :param error_message: Error message. + :type error_message: str + :param events: List of error events. + :type events: list[~azure.mgmt.datamigration.models.SyncMigrationDatabaseErrorEvent] + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'events': {'key': 'events', 'type': '[SyncMigrationDatabaseErrorEvent]'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelErrorOutput' # type: str + self.error_message = kwargs.get('error_message', None) + self.events = kwargs.get('events', None) + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlSyncTaskOutput): + """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar migration_state: Migration state that this database is in. Possible values include: + "UNDEFINED", "CONFIGURING", "INITIALIAZING", "STARTING", "RUNNING", "READY_TO_COMPLETE", + "COMPLETING", "COMPLETE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATING", + "VALIDATION_COMPLETE", "VALIDATION_FAILED", "RESTORE_IN_PROGRESS", "RESTORE_COMPLETED", + "BACKUP_IN_PROGRESS", "BACKUP_COMPLETED". + :vartype migration_state: str or + ~azure.mgmt.datamigration.models.SyncDatabaseMigrationReportingState + :ivar incoming_changes: Number of incoming changes. + :vartype incoming_changes: long + :ivar applied_changes: Number of applied changes. + :vartype applied_changes: long + :ivar cdc_insert_counter: Number of cdc inserts. + :vartype cdc_insert_counter: long + :ivar cdc_delete_counter: Number of cdc deletes. + :vartype cdc_delete_counter: long + :ivar cdc_update_counter: Number of cdc updates. + :vartype cdc_update_counter: long + :ivar full_load_completed_tables: Number of tables completed in full load. + :vartype full_load_completed_tables: long + :ivar full_load_loading_tables: Number of tables loading in full load. + :vartype full_load_loading_tables: long + :ivar full_load_queued_tables: Number of tables queued in full load. + :vartype full_load_queued_tables: long + :ivar full_load_errored_tables: Number of tables errored in full load. + :vartype full_load_errored_tables: long + :ivar initialization_completed: Indicates if initial load (full load) has been completed. :vartype initialization_completed: bool :ivar latency: CDC apply latency. :vartype latency: long @@ -5723,15 +6374,17 @@ class MigrateSchemaSqlServerSqlDbTaskOutput(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str """ _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, } _attribute_map = { @@ -5757,10 +6410,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputDatabaseLevel(MigrateSchemaSqlServerS Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar database_name: The name of the database. :vartype database_name: str :ivar state: State of the schema migration for this database. Possible values include: "None", @@ -5789,7 +6444,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputDatabaseLevel(MigrateSchemaSqlServerS _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'database_name': {'readonly': True}, 'state': {'readonly': True}, 'stage': {'readonly': True}, @@ -5840,10 +6495,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputError(MigrateSchemaSqlServerSqlDbTask Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar command_text: Schema command which failed. :vartype command_text: str :ivar error_text: Reason of failure. @@ -5852,7 +6509,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputError(MigrateSchemaSqlServerSqlDbTask _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'command_text': {'readonly': True}, 'error_text': {'readonly': True}, } @@ -5879,10 +6536,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputMigrationLevel(MigrateSchemaSqlServer Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar state: Overall state of the schema migration. Possible values include: "None", "InProgress", "Failed", "Warning", "Completed", "Skipped", "Stopped". :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState @@ -5902,7 +6561,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputMigrationLevel(MigrateSchemaSqlServer _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'state': {'readonly': True}, 'started_on': {'readonly': True}, 'ended_on': {'readonly': True}, @@ -5997,17 +6656,19 @@ class MigrateSchemaSqlTaskOutputError(MigrateSchemaSqlServerSqlDbTaskOutput): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar error: Migration error. :vartype error: ~azure.mgmt.datamigration.models.ReportableException """ _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'error': {'readonly': True}, } @@ -6665,7 +7326,7 @@ class MigrateSqlServerSqlDbTaskOutput(msrest.serialization.Model): """Output for the task that migrates on-prem SQL Server databases to Azure SQL Database. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MigrateSqlServerSqlDbTaskOutputDatabaseLevel, MigrateSqlServerSqlDbTaskOutputError, MigrateSqlServerSqlDbTaskOutputMigrationLevel, MigrateSqlServerSqlDbTaskOutputTableLevel. + sub-classes are: MigrateSqlServerSqlDbTaskOutputDatabaseLevel, MigrateSqlServerSqlDbTaskOutputError, MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult, MigrateSqlServerSqlDbTaskOutputMigrationLevel, MigrateSqlServerSqlDbTaskOutputValidationResult, MigrateSqlServerSqlDbTaskOutputTableLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -6688,7 +7349,7 @@ class MigrateSqlServerSqlDbTaskOutput(msrest.serialization.Model): } _subtype_map = { - 'result_type': {'DatabaseLevelOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateSqlServerSqlDbTaskOutputError', 'MigrationLevelOutput': 'MigrateSqlServerSqlDbTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateSqlServerSqlDbTaskOutputTableLevel'} + 'result_type': {'DatabaseLevelOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateSqlServerSqlDbTaskOutputError', 'MigrationDatabaseLevelValidationOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult', 'MigrationLevelOutput': 'MigrateSqlServerSqlDbTaskOutputMigrationLevel', 'MigrationValidationOutput': 'MigrateSqlServerSqlDbTaskOutputValidationResult', 'TableLevelOutput': 'MigrateSqlServerSqlDbTaskOutputTableLevel'} } def __init__( @@ -6786,22 +7447,186 @@ def __init__( self, **kwargs ): - super(MigrateSqlServerSqlDbTaskOutputDatabaseLevel, self).__init__(**kwargs) - self.result_type = 'DatabaseLevelOutput' # type: str - self.database_name = None + super(MigrateSqlServerSqlDbTaskOutputDatabaseLevel, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelOutput' # type: str + self.database_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.stage = None + self.status_message = None + self.message = None + self.number_of_objects = None + self.number_of_objects_completed = None + self.error_count = None + self.error_prefix = None + self.result_prefix = None + self.exceptions_and_warnings = None + self.object_summary = None + + +class MigrationValidationDatabaseLevelResult(msrest.serialization.Model): + """Database level validation results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Result identifier. + :vartype id: str + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :ivar source_database_name: Name of the source database. + :vartype source_database_name: str + :ivar target_database_name: Name of the target database. + :vartype target_database_name: str + :ivar started_on: Validation start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Validation end time. + :vartype ended_on: ~datetime.datetime + :ivar data_integrity_validation_result: Provides data integrity validation result between the + source and target tables that are migrated. + :vartype data_integrity_validation_result: + ~azure.mgmt.datamigration.models.DataIntegrityValidationResult + :ivar schema_validation_result: Provides schema comparison result between source and target + database. + :vartype schema_validation_result: + ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult + :ivar query_analysis_validation_result: Results of some of the query execution result between + source and target database. + :vartype query_analysis_validation_result: + ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult + :ivar status: Current status of validation at the database level. Possible values include: + "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", + "Stopped", "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'migration_id': {'readonly': True}, + 'source_database_name': {'readonly': True}, + 'target_database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'data_integrity_validation_result': {'readonly': True}, + 'schema_validation_result': {'readonly': True}, + 'query_analysis_validation_result': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, + 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, + 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationValidationDatabaseLevelResult, self).__init__(**kwargs) + self.id = None + self.migration_id = None + self.source_database_name = None + self.target_database_name = None + self.started_on = None + self.ended_on = None + self.data_integrity_validation_result = None + self.schema_validation_result = None + self.query_analysis_validation_result = None + self.status = None + + +class MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult(MigrateSqlServerSqlDbTaskOutput, MigrationValidationDatabaseLevelResult): + """MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :ivar source_database_name: Name of the source database. + :vartype source_database_name: str + :ivar target_database_name: Name of the target database. + :vartype target_database_name: str + :ivar started_on: Validation start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Validation end time. + :vartype ended_on: ~datetime.datetime + :ivar data_integrity_validation_result: Provides data integrity validation result between the + source and target tables that are migrated. + :vartype data_integrity_validation_result: + ~azure.mgmt.datamigration.models.DataIntegrityValidationResult + :ivar schema_validation_result: Provides schema comparison result between source and target + database. + :vartype schema_validation_result: + ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult + :ivar query_analysis_validation_result: Results of some of the query execution result between + source and target database. + :vartype query_analysis_validation_result: + ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult + :ivar status: Current status of validation at the database level. Possible values include: + "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", + "Stopped", "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'migration_id': {'readonly': True}, + 'source_database_name': {'readonly': True}, + 'target_database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'data_integrity_validation_result': {'readonly': True}, + 'schema_validation_result': {'readonly': True}, + 'query_analysis_validation_result': {'readonly': True}, + 'status': {'readonly': True}, + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, + 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, + 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, + 'status': {'key': 'status', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult, self).__init__(**kwargs) + self.migration_id = None + self.source_database_name = None + self.target_database_name = None self.started_on = None self.ended_on = None - self.state = None - self.stage = None - self.status_message = None - self.message = None - self.number_of_objects = None - self.number_of_objects_completed = None - self.error_count = None - self.error_prefix = None - self.result_prefix = None - self.exceptions_and_warnings = None - self.object_summary = None + self.data_integrity_validation_result = None + self.schema_validation_result = None + self.query_analysis_validation_result = None + self.status = None + self.result_type = 'MigrationDatabaseLevelValidationOutput' # type: str + self.id = None + self.result_type = 'MigrationDatabaseLevelValidationOutput' # type: str class MigrateSqlServerSqlDbTaskOutputError(MigrateSqlServerSqlDbTaskOutput): @@ -7025,6 +7850,100 @@ def __init__( self.result_prefix = None +class MigrationValidationResult(msrest.serialization.Model): + """Migration Validation Result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Migration validation result identifier. + :vartype id: str + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :param summary_results: Validation summary results for each database. + :type summary_results: dict[str, + ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] + :ivar status: Current status of validation at the migration level. Status from the database + validation result status will be aggregated here. Possible values include: "Default", + "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", + "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'migration_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationValidationResult, self).__init__(**kwargs) + self.id = None + self.migration_id = None + self.summary_results = kwargs.get('summary_results', None) + self.status = None + + +class MigrateSqlServerSqlDbTaskOutputValidationResult(MigrateSqlServerSqlDbTaskOutput, MigrationValidationResult): + """MigrateSqlServerSqlDbTaskOutputValidationResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :param summary_results: Validation summary results for each database. + :type summary_results: dict[str, + ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] + :ivar status: Current status of validation at the migration level. Status from the database + validation result status will be aggregated here. Possible values include: "Default", + "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", + "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'migration_id': {'readonly': True}, + 'status': {'readonly': True}, + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateSqlServerSqlDbTaskOutputValidationResult, self).__init__(**kwargs) + self.migration_id = None + self.summary_results = kwargs.get('summary_results', None) + self.status = None + self.result_type = 'MigrationValidationOutput' # type: str + self.id = None + self.result_type = 'MigrationValidationOutput' # type: str + + class MigrateSqlServerSqlDbTaskProperties(ProjectTaskProperties): """Properties for the task that migrates on-prem SQL Server databases to Azure SQL Database. @@ -8501,84 +9420,6 @@ def __init__( self.target_table_name = None -class MigrationValidationDatabaseLevelResult(msrest.serialization.Model): - """Database level validation results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Result identifier. - :vartype id: str - :ivar migration_id: Migration Identifier. - :vartype migration_id: str - :ivar source_database_name: Name of the source database. - :vartype source_database_name: str - :ivar target_database_name: Name of the target database. - :vartype target_database_name: str - :ivar started_on: Validation start time. - :vartype started_on: ~datetime.datetime - :ivar ended_on: Validation end time. - :vartype ended_on: ~datetime.datetime - :ivar data_integrity_validation_result: Provides data integrity validation result between the - source and target tables that are migrated. - :vartype data_integrity_validation_result: - ~azure.mgmt.datamigration.models.DataIntegrityValidationResult - :ivar schema_validation_result: Provides schema comparison result between source and target - database. - :vartype schema_validation_result: - ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult - :ivar query_analysis_validation_result: Results of some of the query execution result between - source and target database. - :vartype query_analysis_validation_result: - ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult - :ivar status: Current status of validation at the database level. Possible values include: - "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", - "Stopped", "Failed". - :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'migration_id': {'readonly': True}, - 'source_database_name': {'readonly': True}, - 'target_database_name': {'readonly': True}, - 'started_on': {'readonly': True}, - 'ended_on': {'readonly': True}, - 'data_integrity_validation_result': {'readonly': True}, - 'schema_validation_result': {'readonly': True}, - 'query_analysis_validation_result': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'migration_id': {'key': 'migrationId', 'type': 'str'}, - 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, - 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, - 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, - 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, - 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, - 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, - 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationValidationDatabaseLevelResult, self).__init__(**kwargs) - self.id = None - self.migration_id = None - self.source_database_name = None - self.target_database_name = None - self.started_on = None - self.ended_on = None - self.data_integrity_validation_result = None - self.schema_validation_result = None - self.query_analysis_validation_result = None - self.status = None - - class MigrationValidationDatabaseSummaryResult(msrest.serialization.Model): """Migration Validation Database level summary result. @@ -8668,49 +9509,6 @@ def __init__( self.enable_query_analysis_validation = kwargs.get('enable_query_analysis_validation', None) -class MigrationValidationResult(msrest.serialization.Model): - """Migration Validation Result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Migration validation result identifier. - :vartype id: str - :ivar migration_id: Migration Identifier. - :vartype migration_id: str - :param summary_results: Validation summary results for each database. - :type summary_results: dict[str, - ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] - :ivar status: Current status of validation at the migration level. Status from the database - validation result status will be aggregated here. Possible values include: "Default", - "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", - "Failed". - :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'migration_id': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'migration_id': {'key': 'migrationId', 'type': 'str'}, - 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationValidationResult, self).__init__(**kwargs) - self.id = None - self.migration_id = None - self.summary_results = kwargs.get('summary_results', None) - self.status = None - - class MiSqlConnectionInfo(ConnectionInfo): """Properties required to create a connection to Azure SQL database Managed instance. @@ -9836,6 +10634,8 @@ class MySqlConnectionInfo(ConnectionInfo): :type server_name: str :param port: Required. Port for Server. :type port: int + :param encrypt_connection: Whether to encrypt the connection. + :type encrypt_connection: bool """ _validation = { @@ -9850,6 +10650,7 @@ class MySqlConnectionInfo(ConnectionInfo): 'password': {'key': 'password', 'type': 'str'}, 'server_name': {'key': 'serverName', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, + 'encrypt_connection': {'key': 'encryptConnection', 'type': 'bool'}, } def __init__( @@ -9860,6 +10661,7 @@ def __init__( self.type = 'MySqlConnectionInfo' # type: str self.server_name = kwargs['server_name'] self.port = kwargs['port'] + self.encrypt_connection = kwargs.get('encrypt_connection', True) class NameAvailabilityRequest(msrest.serialization.Model): @@ -10307,6 +11109,8 @@ class Project(TrackedResource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData :param source_platform: Source platform for the project. Possible values include: "SQL", "MySQL", "PostgreSql", "MongoDb", "Unknown". :type source_platform: str or ~azure.mgmt.datamigration.models.ProjectSourcePlatform @@ -10331,6 +11135,7 @@ class Project(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, 'creation_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -10341,6 +11146,7 @@ class Project(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'source_platform': {'key': 'properties.sourcePlatform', 'type': 'str'}, 'target_platform': {'key': 'properties.targetPlatform', 'type': 'str'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, @@ -10379,12 +11185,15 @@ class ProjectFile(Resource): :type etag: str :param properties: Custom file properties. :type properties: ~azure.mgmt.datamigration.models.ProjectFileProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -10393,6 +11202,7 @@ class ProjectFile(Resource): 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'ProjectFileProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -10402,6 +11212,7 @@ def __init__( super(ProjectFile, self).__init__(**kwargs) self.etag = kwargs.get('etag', None) self.properties = kwargs.get('properties', None) + self.system_data = None class ProjectFileProperties(msrest.serialization.Model): @@ -10487,12 +11298,15 @@ class ProjectTask(Resource): :type etag: str :param properties: Custom task properties. :type properties: ~azure.mgmt.datamigration.models.ProjectTaskProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -10501,6 +11315,7 @@ class ProjectTask(Resource): 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'ProjectTaskProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -10510,6 +11325,7 @@ def __init__( super(ProjectTask, self).__init__(**kwargs) self.etag = kwargs.get('etag', None) self.properties = kwargs.get('properties', None) + self.system_data = None class QueryAnalysisValidationResult(msrest.serialization.Model): @@ -11408,6 +12224,47 @@ def __init__( self.event_text = None +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.datamigration.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.datamigration.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + class TaskList(msrest.serialization.Model): """OData page of tasks. diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models_py3.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models_py3.py index 224285a03b12..2b210bbce4ea 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models_py3.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/models/_models_py3.py @@ -18,12 +18,21 @@ class ApiError(msrest.serialization.Model): """Error information. + Variables are only populated by the server, and will be ignored when sending a request. + :param error: Error information in OData format. :type error: ~azure.mgmt.datamigration.models.ODataError + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ + _validation = { + 'system_data': {'readonly': True}, + } + _attribute_map = { 'error': {'key': 'error', 'type': 'ODataError'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -34,6 +43,7 @@ def __init__( ): super(ApiError, self).__init__(**kwargs) self.error = error + self.system_data = None class AvailableServiceSku(msrest.serialization.Model): @@ -362,7 +372,7 @@ class ProjectTaskProperties(msrest.serialization.Model): """Base class for all types of DMS task properties. If task is not supported by current client, this object is returned. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ConnectToMongoDbTaskProperties, ConnectToSourceMySqlTaskProperties, ConnectToSourceOracleSyncTaskProperties, ConnectToSourcePostgreSqlSyncTaskProperties, ConnectToSourceSqlServerTaskProperties, ConnectToSourceSqlServerSyncTaskProperties, ConnectToTargetAzureDbForMySqlTaskProperties, ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlMITaskProperties, ConnectToTargetSqlMISyncTaskProperties, ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlDbTaskProperties, ConnectToTargetSqlDbSyncTaskProperties, GetTdeCertificatesSqlTaskProperties, GetUserTablesSqlSyncTaskProperties, GetUserTablesSqlTaskProperties, GetUserTablesOracleTaskProperties, GetUserTablesPostgreSqlTaskProperties, MigrateMongoDbTaskProperties, MigrateMySqlAzureDbForMySqlSyncTaskProperties, MigrateOracleAzureDbForPostgreSqlSyncTaskProperties, MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties, MigrateSqlServerSqlDbSyncTaskProperties, MigrateSqlServerSqlMITaskProperties, MigrateSqlServerSqlMISyncTaskProperties, MigrateSqlServerSqlDbTaskProperties, MigrateSsisTaskProperties, MigrateSchemaSqlServerSqlDbTaskProperties, CheckOCIDriverTaskProperties, InstallOCIDriverTaskProperties, UploadOCIDriverTaskProperties, ValidateMongoDbTaskProperties, ValidateOracleAzureDbForPostgreSqlSyncTaskProperties, ValidateMigrationInputSqlServerSqlMITaskProperties, ValidateMigrationInputSqlServerSqlMISyncTaskProperties, ValidateMigrationInputSqlServerSqlDbSyncTaskProperties. + sub-classes are: ConnectToMongoDbTaskProperties, ConnectToSourceMySqlTaskProperties, ConnectToSourceOracleSyncTaskProperties, ConnectToSourcePostgreSqlSyncTaskProperties, ConnectToSourceSqlServerTaskProperties, ConnectToSourceSqlServerSyncTaskProperties, ConnectToTargetAzureDbForMySqlTaskProperties, ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlMITaskProperties, ConnectToTargetSqlMISyncTaskProperties, ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties, ConnectToTargetSqlDbTaskProperties, ConnectToTargetSqlDbSyncTaskProperties, GetTdeCertificatesSqlTaskProperties, GetUserTablesSqlSyncTaskProperties, GetUserTablesSqlTaskProperties, GetUserTablesMySqlTaskProperties, GetUserTablesOracleTaskProperties, GetUserTablesPostgreSqlTaskProperties, MigrateMongoDbTaskProperties, MigrateMySqlAzureDbForMySqlOfflineTaskProperties, MigrateMySqlAzureDbForMySqlSyncTaskProperties, MigrateOracleAzureDbForPostgreSqlSyncTaskProperties, MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties, MigrateSqlServerSqlDbSyncTaskProperties, MigrateSqlServerSqlMITaskProperties, MigrateSqlServerSqlMISyncTaskProperties, MigrateSqlServerSqlDbTaskProperties, MigrateSsisTaskProperties, MigrateSchemaSqlServerSqlDbTaskProperties, CheckOCIDriverTaskProperties, InstallOCIDriverTaskProperties, UploadOCIDriverTaskProperties, ValidateMongoDbTaskProperties, ValidateOracleAzureDbForPostgreSqlSyncTaskProperties, ValidateMigrationInputSqlServerSqlMITaskProperties, ValidateMigrationInputSqlServerSqlMISyncTaskProperties, ValidateMigrationInputSqlServerSqlDbSyncTaskProperties. Variables are only populated by the server, and will be ignored when sending a request. @@ -398,7 +408,7 @@ class ProjectTaskProperties(msrest.serialization.Model): } _subtype_map = { - 'task_type': {'Connect.MongoDb': 'ConnectToMongoDbTaskProperties', 'ConnectToSource.MySql': 'ConnectToSourceMySqlTaskProperties', 'ConnectToSource.Oracle.Sync': 'ConnectToSourceOracleSyncTaskProperties', 'ConnectToSource.PostgreSql.Sync': 'ConnectToSourcePostgreSqlSyncTaskProperties', 'ConnectToSource.SqlServer': 'ConnectToSourceSqlServerTaskProperties', 'ConnectToSource.SqlServer.Sync': 'ConnectToSourceSqlServerSyncTaskProperties', 'ConnectToTarget.AzureDbForMySql': 'ConnectToTargetAzureDbForMySqlTaskProperties', 'ConnectToTarget.AzureDbForPostgreSql.Sync': 'ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.AzureSqlDbMI': 'ConnectToTargetSqlMITaskProperties', 'ConnectToTarget.AzureSqlDbMI.Sync.LRS': 'ConnectToTargetSqlMISyncTaskProperties', 'ConnectToTarget.Oracle.AzureDbForPostgreSql.Sync': 'ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.SqlDb': 'ConnectToTargetSqlDbTaskProperties', 'ConnectToTarget.SqlDb.Sync': 'ConnectToTargetSqlDbSyncTaskProperties', 'GetTDECertificates.Sql': 'GetTdeCertificatesSqlTaskProperties', 'GetUserTables.AzureSqlDb.Sync': 'GetUserTablesSqlSyncTaskProperties', 'GetUserTables.Sql': 'GetUserTablesSqlTaskProperties', 'GetUserTablesOracle': 'GetUserTablesOracleTaskProperties', 'GetUserTablesPostgreSql': 'GetUserTablesPostgreSqlTaskProperties', 'Migrate.MongoDb': 'MigrateMongoDbTaskProperties', 'Migrate.MySql.AzureDbForMySql.Sync': 'MigrateMySqlAzureDbForMySqlSyncTaskProperties', 'Migrate.Oracle.AzureDbForPostgreSql.Sync': 'MigrateOracleAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.PostgreSql.AzureDbForPostgreSql.SyncV2': 'MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDb.Sync': 'MigrateSqlServerSqlDbSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDbMI': 'MigrateSqlServerSqlMITaskProperties', 'Migrate.SqlServer.AzureSqlDbMI.Sync.LRS': 'MigrateSqlServerSqlMISyncTaskProperties', 'Migrate.SqlServer.SqlDb': 'MigrateSqlServerSqlDbTaskProperties', 'Migrate.Ssis': 'MigrateSsisTaskProperties', 'MigrateSchemaSqlServerSqlDb': 'MigrateSchemaSqlServerSqlDbTaskProperties', 'Service.Check.OCI': 'CheckOCIDriverTaskProperties', 'Service.Install.OCI': 'InstallOCIDriverTaskProperties', 'Service.Upload.OCI': 'UploadOCIDriverTaskProperties', 'Validate.MongoDb': 'ValidateMongoDbTaskProperties', 'Validate.Oracle.AzureDbPostgreSql.Sync': 'ValidateOracleAzureDbForPostgreSqlSyncTaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI': 'ValidateMigrationInputSqlServerSqlMITaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI.Sync.LRS': 'ValidateMigrationInputSqlServerSqlMISyncTaskProperties', 'ValidateMigrationInput.SqlServer.SqlDb.Sync': 'ValidateMigrationInputSqlServerSqlDbSyncTaskProperties'} + 'task_type': {'Connect.MongoDb': 'ConnectToMongoDbTaskProperties', 'ConnectToSource.MySql': 'ConnectToSourceMySqlTaskProperties', 'ConnectToSource.Oracle.Sync': 'ConnectToSourceOracleSyncTaskProperties', 'ConnectToSource.PostgreSql.Sync': 'ConnectToSourcePostgreSqlSyncTaskProperties', 'ConnectToSource.SqlServer': 'ConnectToSourceSqlServerTaskProperties', 'ConnectToSource.SqlServer.Sync': 'ConnectToSourceSqlServerSyncTaskProperties', 'ConnectToTarget.AzureDbForMySql': 'ConnectToTargetAzureDbForMySqlTaskProperties', 'ConnectToTarget.AzureDbForPostgreSql.Sync': 'ConnectToTargetAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.AzureSqlDbMI': 'ConnectToTargetSqlMITaskProperties', 'ConnectToTarget.AzureSqlDbMI.Sync.LRS': 'ConnectToTargetSqlMISyncTaskProperties', 'ConnectToTarget.Oracle.AzureDbForPostgreSql.Sync': 'ConnectToTargetOracleAzureDbForPostgreSqlSyncTaskProperties', 'ConnectToTarget.SqlDb': 'ConnectToTargetSqlDbTaskProperties', 'ConnectToTarget.SqlDb.Sync': 'ConnectToTargetSqlDbSyncTaskProperties', 'GetTDECertificates.Sql': 'GetTdeCertificatesSqlTaskProperties', 'GetUserTables.AzureSqlDb.Sync': 'GetUserTablesSqlSyncTaskProperties', 'GetUserTables.Sql': 'GetUserTablesSqlTaskProperties', 'GetUserTablesMySql': 'GetUserTablesMySqlTaskProperties', 'GetUserTablesOracle': 'GetUserTablesOracleTaskProperties', 'GetUserTablesPostgreSql': 'GetUserTablesPostgreSqlTaskProperties', 'Migrate.MongoDb': 'MigrateMongoDbTaskProperties', 'Migrate.MySql.AzureDbForMySql': 'MigrateMySqlAzureDbForMySqlOfflineTaskProperties', 'Migrate.MySql.AzureDbForMySql.Sync': 'MigrateMySqlAzureDbForMySqlSyncTaskProperties', 'Migrate.Oracle.AzureDbForPostgreSql.Sync': 'MigrateOracleAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.PostgreSql.AzureDbForPostgreSql.SyncV2': 'MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDb.Sync': 'MigrateSqlServerSqlDbSyncTaskProperties', 'Migrate.SqlServer.AzureSqlDbMI': 'MigrateSqlServerSqlMITaskProperties', 'Migrate.SqlServer.AzureSqlDbMI.Sync.LRS': 'MigrateSqlServerSqlMISyncTaskProperties', 'Migrate.SqlServer.SqlDb': 'MigrateSqlServerSqlDbTaskProperties', 'Migrate.Ssis': 'MigrateSsisTaskProperties', 'MigrateSchemaSqlServerSqlDb': 'MigrateSchemaSqlServerSqlDbTaskProperties', 'Service.Check.OCI': 'CheckOCIDriverTaskProperties', 'Service.Install.OCI': 'InstallOCIDriverTaskProperties', 'Service.Upload.OCI': 'UploadOCIDriverTaskProperties', 'Validate.MongoDb': 'ValidateMongoDbTaskProperties', 'Validate.Oracle.AzureDbPostgreSql.Sync': 'ValidateOracleAzureDbForPostgreSqlSyncTaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI': 'ValidateMigrationInputSqlServerSqlMITaskProperties', 'ValidateMigrationInput.SqlServer.AzureSqlDbMI.Sync.LRS': 'ValidateMigrationInputSqlServerSqlMISyncTaskProperties', 'ValidateMigrationInput.SqlServer.SqlDb.Sync': 'ValidateMigrationInputSqlServerSqlDbSyncTaskProperties'} } def __init__( @@ -630,6 +640,8 @@ class ConnectToSourceMySqlTaskInput(msrest.serialization.Model): "MigrationFromMySQLToAzureDBForMySQL". :type check_permissions_group: str or ~azure.mgmt.datamigration.models.ServerLevelPermissionsGroup + :param is_offline_migration: Flag for whether or not the migration is offline. + :type is_offline_migration: bool """ _validation = { @@ -640,6 +652,7 @@ class ConnectToSourceMySqlTaskInput(msrest.serialization.Model): 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_platform': {'key': 'targetPlatform', 'type': 'str'}, 'check_permissions_group': {'key': 'checkPermissionsGroup', 'type': 'str'}, + 'is_offline_migration': {'key': 'isOfflineMigration', 'type': 'bool'}, } def __init__( @@ -648,12 +661,14 @@ def __init__( source_connection_info: "MySqlConnectionInfo", target_platform: Optional[Union[str, "MySqlTargetPlatformType"]] = None, check_permissions_group: Optional[Union[str, "ServerLevelPermissionsGroup"]] = None, + is_offline_migration: Optional[bool] = False, **kwargs ): super(ConnectToSourceMySqlTaskInput, self).__init__(**kwargs) self.source_connection_info = source_connection_info self.target_platform = target_platform self.check_permissions_group = check_permissions_group + self.is_offline_migration = is_offline_migration class ConnectToSourceMySqlTaskProperties(ProjectTaskProperties): @@ -1486,6 +1501,8 @@ class ConnectToTargetAzureDbForMySqlTaskInput(msrest.serialization.Model): :param target_connection_info: Required. Connection information for target Azure Database for MySQL server. :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param is_offline_migration: Flag for whether or not the migration is offline. + :type is_offline_migration: bool """ _validation = { @@ -1496,6 +1513,7 @@ class ConnectToTargetAzureDbForMySqlTaskInput(msrest.serialization.Model): _attribute_map = { 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'is_offline_migration': {'key': 'isOfflineMigration', 'type': 'bool'}, } def __init__( @@ -1503,11 +1521,13 @@ def __init__( *, source_connection_info: "MySqlConnectionInfo", target_connection_info: "MySqlConnectionInfo", + is_offline_migration: Optional[bool] = False, **kwargs ): super(ConnectToTargetAzureDbForMySqlTaskInput, self).__init__(**kwargs) self.source_connection_info = source_connection_info self.target_connection_info = target_connection_info + self.is_offline_migration = is_offline_migration class ConnectToTargetAzureDbForMySqlTaskOutput(msrest.serialization.Model): @@ -3057,6 +3077,8 @@ class TrackedResource(Resource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { @@ -3064,6 +3086,7 @@ class TrackedResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -3072,6 +3095,7 @@ class TrackedResource(Resource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -3084,6 +3108,7 @@ def __init__( super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location + self.system_data = None class DataMigrationService(TrackedResource): @@ -3103,6 +3128,8 @@ class DataMigrationService(TrackedResource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData :param etag: HTTP strong entity tag value. Ignored if submitted. :type etag: str :param kind: The resource kind. Only 'vm' (the default) is supported. @@ -3128,6 +3155,7 @@ class DataMigrationService(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -3137,6 +3165,7 @@ class DataMigrationService(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'etag': {'key': 'etag', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'ServiceSku'}, @@ -3529,6 +3558,130 @@ def __init__( self.output = None +class GetUserTablesMySqlTaskInput(msrest.serialization.Model): + """Input for the task that collects user tables for the given list of databases. + + All required parameters must be populated in order to send to Azure. + + :param connection_info: Required. Connection information for SQL Server. + :type connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param selected_databases: Required. List of database names to collect tables for. + :type selected_databases: list[str] + """ + + _validation = { + 'connection_info': {'required': True}, + 'selected_databases': {'required': True}, + } + + _attribute_map = { + 'connection_info': {'key': 'connectionInfo', 'type': 'MySqlConnectionInfo'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[str]'}, + } + + def __init__( + self, + *, + connection_info: "MySqlConnectionInfo", + selected_databases: List[str], + **kwargs + ): + super(GetUserTablesMySqlTaskInput, self).__init__(**kwargs) + self.connection_info = connection_info + self.selected_databases = selected_databases + + +class GetUserTablesMySqlTaskOutput(msrest.serialization.Model): + """Output of the task that collects user tables for the given list of databases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Result identifier. + :vartype id: str + :ivar databases_to_tables: Mapping from database name to list of tables. + :vartype databases_to_tables: str + :ivar validation_errors: Validation errors. + :vartype validation_errors: list[~azure.mgmt.datamigration.models.ReportableException] + """ + + _validation = { + 'id': {'readonly': True}, + 'databases_to_tables': {'readonly': True}, + 'validation_errors': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'databases_to_tables': {'key': 'databasesToTables', 'type': 'str'}, + 'validation_errors': {'key': 'validationErrors', 'type': '[ReportableException]'}, + } + + def __init__( + self, + **kwargs + ): + super(GetUserTablesMySqlTaskOutput, self).__init__(**kwargs) + self.id = None + self.databases_to_tables = None + self.validation_errors = None + + +class GetUserTablesMySqlTaskProperties(ProjectTaskProperties): + """Properties for the task that collects user tables for the given list of databases. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param task_type: Required. Task type.Constant filled by server. + :type task_type: str + :ivar errors: Array of errors. This is ignored if submitted. + :vartype errors: list[~azure.mgmt.datamigration.models.ODataError] + :ivar state: The state of the task. This is ignored if submitted. Possible values include: + "Unknown", "Queued", "Running", "Canceled", "Succeeded", "Failed", "FailedInputValidation", + "Faulted". + :vartype state: str or ~azure.mgmt.datamigration.models.TaskState + :ivar commands: Array of command properties. + :vartype commands: list[~azure.mgmt.datamigration.models.CommandProperties] + :param client_data: Key value pairs of client data to attach meta data information to task. + :type client_data: dict[str, str] + :param input: Task input. + :type input: ~azure.mgmt.datamigration.models.GetUserTablesMySqlTaskInput + :ivar output: Task output. This is ignored if submitted. + :vartype output: list[~azure.mgmt.datamigration.models.GetUserTablesMySqlTaskOutput] + """ + + _validation = { + 'task_type': {'required': True}, + 'errors': {'readonly': True}, + 'state': {'readonly': True}, + 'commands': {'readonly': True}, + 'output': {'readonly': True}, + } + + _attribute_map = { + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ODataError]'}, + 'state': {'key': 'state', 'type': 'str'}, + 'commands': {'key': 'commands', 'type': '[CommandProperties]'}, + 'client_data': {'key': 'clientData', 'type': '{str}'}, + 'input': {'key': 'input', 'type': 'GetUserTablesMySqlTaskInput'}, + 'output': {'key': 'output', 'type': '[GetUserTablesMySqlTaskOutput]'}, + } + + def __init__( + self, + *, + client_data: Optional[Dict[str, str]] = None, + input: Optional["GetUserTablesMySqlTaskInput"] = None, + **kwargs + ): + super(GetUserTablesMySqlTaskProperties, self).__init__(client_data=client_data, **kwargs) + self.task_type = 'GetUserTablesMySql' # type: str + self.input = input + self.output = None + + class GetUserTablesOracleTaskInput(msrest.serialization.Model): """Input for the task that gets the list of tables contained within a provided list of Oracle schemas. @@ -4297,20 +4450,14 @@ def __init__( self.output = None -class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): - """Database specific information for MySQL to Azure Database for MySQL migration task inputs. +class MigrateMySqlAzureDbForMySqlOfflineDatabaseInput(msrest.serialization.Model): + """Database specific information for offline MySQL to Azure Database for MySQL migration task inputs. :param name: Name of the database. :type name: str :param target_database_name: Name of target database. Note: Target database will be truncated before starting migration. :type target_database_name: str - :param migration_setting: Migration settings which tune the migration behavior. - :type migration_setting: dict[str, str] - :param source_setting: Source settings to tune source endpoint migration behavior. - :type source_setting: dict[str, str] - :param target_setting: Target settings to tune target endpoint migration behavior. - :type target_setting: dict[str, str] :param table_map: Mapping of source to target tables. :type table_map: dict[str, str] """ @@ -4318,9 +4465,6 @@ class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, - 'migration_setting': {'key': 'migrationSetting', 'type': '{str}'}, - 'source_setting': {'key': 'sourceSetting', 'type': '{str}'}, - 'target_setting': {'key': 'targetSetting', 'type': '{str}'}, 'table_map': {'key': 'tableMap', 'type': '{str}'}, } @@ -4329,23 +4473,17 @@ def __init__( *, name: Optional[str] = None, target_database_name: Optional[str] = None, - migration_setting: Optional[Dict[str, str]] = None, - source_setting: Optional[Dict[str, str]] = None, - target_setting: Optional[Dict[str, str]] = None, table_map: Optional[Dict[str, str]] = None, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncDatabaseInput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineDatabaseInput, self).__init__(**kwargs) self.name = name self.target_database_name = target_database_name - self.migration_setting = migration_setting - self.source_setting = source_setting - self.target_setting = target_setting self.table_map = table_map -class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): - """Input for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. +class MigrateMySqlAzureDbForMySqlOfflineTaskInput(msrest.serialization.Model): + """Input for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. All required parameters must be populated in order to send to Azure. @@ -4356,7 +4494,14 @@ class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo :param selected_databases: Required. Databases to migrate. :type selected_databases: - list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlSyncDatabaseInput] + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineDatabaseInput] + :param make_source_server_read_only: Setting to set the source server read only. + :type make_source_server_read_only: bool + :param started_on: Parameter to specify when the migration started. + :type started_on: ~datetime.datetime + :param optional_agent_settings: Optional parameters for fine tuning the data transfer rate + during migration. + :type optional_agent_settings: dict[str, str] """ _validation = { @@ -4368,7 +4513,10 @@ class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): _attribute_map = { 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, - 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlSyncDatabaseInput]'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlOfflineDatabaseInput]'}, + 'make_source_server_read_only': {'key': 'makeSourceServerReadOnly', 'type': 'bool'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'optional_agent_settings': {'key': 'optionalAgentSettings', 'type': '{str}'}, } def __init__( @@ -4376,20 +4524,26 @@ def __init__( *, source_connection_info: "MySqlConnectionInfo", target_connection_info: "MySqlConnectionInfo", - selected_databases: List["MigrateMySqlAzureDbForMySqlSyncDatabaseInput"], + selected_databases: List["MigrateMySqlAzureDbForMySqlOfflineDatabaseInput"], + make_source_server_read_only: Optional[bool] = False, + started_on: Optional[datetime.datetime] = None, + optional_agent_settings: Optional[Dict[str, str]] = None, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskInput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineTaskInput, self).__init__(**kwargs) self.source_connection_info = source_connection_info self.target_connection_info = target_connection_info self.selected_databases = selected_databases + self.make_source_server_read_only = make_source_server_read_only + self.started_on = started_on + self.optional_agent_settings = optional_agent_settings -class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): - """Output for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutput(msrest.serialization.Model): + """Output for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputError, MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel. + sub-classes are: MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlOfflineTaskOutputError, MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -4412,20 +4566,20 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): } _subtype_map = { - 'result_type': {'DatabaseLevelErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError', 'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel'} + 'result_type': {'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel'} } def __init__( self, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskOutput, self).__init__(**kwargs) + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutput, self).__init__(**kwargs) self.id = None self.result_type = None # type: Optional[str] -class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDbForMySqlSyncTaskOutput): - """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -4435,39 +4589,106 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDb :vartype id: str :param result_type: Required. Result type.Constant filled by server. :type result_type: str - :param error_message: Error message. - :type error_message: str - :param events: List of error events. - :type events: list[~azure.mgmt.datamigration.models.SyncMigrationDatabaseErrorEvent] + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar state: Current state of migration. Possible values include: "None", "InProgress", + "Failed", "Warning", "Completed", "Skipped", "Stopped". + :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState + :ivar stage: Migration stage that this database is in. Possible values include: "None", + "Initialize", "Backup", "FileCopy", "Restore", "Completed". + :vartype stage: str or ~azure.mgmt.datamigration.models.DatabaseMigrationStage + :ivar status_message: Status message. + :vartype status_message: str + :ivar message: Migration progress message. + :vartype message: str + :ivar number_of_objects: Number of objects. + :vartype number_of_objects: long + :ivar number_of_objects_completed: Number of successfully completed objects. + :vartype number_of_objects_completed: long + :ivar error_count: Number of database/object errors. + :vartype error_count: long + :ivar error_prefix: Wildcard string prefix to use for querying all errors of the item. + :vartype error_prefix: str + :ivar result_prefix: Wildcard string prefix to use for querying all sub-tem results of the + item. + :vartype result_prefix: str + :ivar exceptions_and_warnings: Migration exceptions and warnings. + :vartype exceptions_and_warnings: list[~azure.mgmt.datamigration.models.ReportableException] + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + :ivar object_summary: Summary of object results in the migration. + :vartype object_summary: str """ _validation = { 'id': {'readonly': True}, 'result_type': {'required': True}, + 'database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'state': {'readonly': True}, + 'stage': {'readonly': True}, + 'status_message': {'readonly': True}, + 'message': {'readonly': True}, + 'number_of_objects': {'readonly': True}, + 'number_of_objects_completed': {'readonly': True}, + 'error_count': {'readonly': True}, + 'error_prefix': {'readonly': True}, + 'result_prefix': {'readonly': True}, + 'exceptions_and_warnings': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + 'object_summary': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'result_type': {'key': 'resultType', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'events': {'key': 'events', 'type': '[SyncMigrationDatabaseErrorEvent]'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'state': {'key': 'state', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'number_of_objects': {'key': 'numberOfObjects', 'type': 'long'}, + 'number_of_objects_completed': {'key': 'numberOfObjectsCompleted', 'type': 'long'}, + 'error_count': {'key': 'errorCount', 'type': 'long'}, + 'error_prefix': {'key': 'errorPrefix', 'type': 'str'}, + 'result_prefix': {'key': 'resultPrefix', 'type': 'str'}, + 'exceptions_and_warnings': {'key': 'exceptionsAndWarnings', 'type': '[ReportableException]'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + 'object_summary': {'key': 'objectSummary', 'type': 'str'}, } def __init__( self, - *, - error_message: Optional[str] = None, - events: Optional[List["SyncMigrationDatabaseErrorEvent"]] = None, **kwargs ): - super(MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, self).__init__(**kwargs) - self.result_type = 'DatabaseLevelErrorOutput' # type: str - self.error_message = error_message - self.events = events + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputDatabaseLevel, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelOutput' # type: str + self.database_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.stage = None + self.status_message = None + self.message = None + self.number_of_objects = None + self.number_of_objects_completed = None + self.error_count = None + self.error_prefix = None + self.result_prefix = None + self.exceptions_and_warnings = None + self.last_storage_update = None + self.object_summary = None -class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlSyncTaskOutput): - """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel. +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputError(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputError. Variables are only populated by the server, and will be ignored when sending a request. @@ -4477,27 +4698,482 @@ class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDb :vartype id: str :param result_type: Required. Result type.Constant filled by server. :type result_type: str - :ivar database_name: Name of the database. - :vartype database_name: str - :ivar started_on: Migration start time. - :vartype started_on: ~datetime.datetime - :ivar ended_on: Migration end time. - :vartype ended_on: ~datetime.datetime - :ivar migration_state: Migration state that this database is in. Possible values include: - "UNDEFINED", "CONFIGURING", "INITIALIAZING", "STARTING", "RUNNING", "READY_TO_COMPLETE", - "COMPLETING", "COMPLETE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATING", - "VALIDATION_COMPLETE", "VALIDATION_FAILED", "RESTORE_IN_PROGRESS", "RESTORE_COMPLETED", - "BACKUP_IN_PROGRESS", "BACKUP_COMPLETED". - :vartype migration_state: str or - ~azure.mgmt.datamigration.models.SyncDatabaseMigrationReportingState - :ivar incoming_changes: Number of incoming changes. - :vartype incoming_changes: long - :ivar applied_changes: Number of applied changes. - :vartype applied_changes: long - :ivar cdc_insert_counter: Number of cdc inserts. - :vartype cdc_insert_counter: long - :ivar cdc_delete_counter: Number of cdc deletes. - :vartype cdc_delete_counter: long + :ivar error: Migration error. + :vartype error: ~azure.mgmt.datamigration.models.ReportableException + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ReportableException'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputError, self).__init__(**kwargs) + self.result_type = 'ErrorOutput' # type: str + self.error = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar duration_in_seconds: Duration of task execution in seconds. + :vartype duration_in_seconds: long + :ivar status: Current status of migration. Possible values include: "Default", "Connecting", + "SourceAndTargetSelected", "SelectLogins", "Configured", "Running", "Error", "Stopped", + "Completed", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.datamigration.models.MigrationStatus + :ivar status_message: Migration status message. + :vartype status_message: str + :ivar message: Migration progress message. + :vartype message: str + :param databases: Selected databases as a map from database name to database id. + :type databases: str + :ivar database_summary: Summary of database results in the migration. + :vartype database_summary: str + :param migration_report_result: Migration Report Result, provides unique url for downloading + your migration report. + :type migration_report_result: ~azure.mgmt.datamigration.models.MigrationReportResult + :ivar source_server_version: Source server version. + :vartype source_server_version: str + :ivar source_server_brand_version: Source server brand version. + :vartype source_server_brand_version: str + :ivar target_server_version: Target server version. + :vartype target_server_version: str + :ivar target_server_brand_version: Target server brand version. + :vartype target_server_brand_version: str + :ivar exceptions_and_warnings: Migration exceptions and warnings. + :vartype exceptions_and_warnings: list[~azure.mgmt.datamigration.models.ReportableException] + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'duration_in_seconds': {'readonly': True}, + 'status': {'readonly': True}, + 'status_message': {'readonly': True}, + 'message': {'readonly': True}, + 'database_summary': {'readonly': True}, + 'source_server_version': {'readonly': True}, + 'source_server_brand_version': {'readonly': True}, + 'target_server_version': {'readonly': True}, + 'target_server_brand_version': {'readonly': True}, + 'exceptions_and_warnings': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'long'}, + 'status': {'key': 'status', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'databases': {'key': 'databases', 'type': 'str'}, + 'database_summary': {'key': 'databaseSummary', 'type': 'str'}, + 'migration_report_result': {'key': 'migrationReportResult', 'type': 'MigrationReportResult'}, + 'source_server_version': {'key': 'sourceServerVersion', 'type': 'str'}, + 'source_server_brand_version': {'key': 'sourceServerBrandVersion', 'type': 'str'}, + 'target_server_version': {'key': 'targetServerVersion', 'type': 'str'}, + 'target_server_brand_version': {'key': 'targetServerBrandVersion', 'type': 'str'}, + 'exceptions_and_warnings': {'key': 'exceptionsAndWarnings', 'type': '[ReportableException]'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + databases: Optional[str] = None, + migration_report_result: Optional["MigrationReportResult"] = None, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputMigrationLevel, self).__init__(**kwargs) + self.result_type = 'MigrationLevelOutput' # type: str + self.started_on = None + self.ended_on = None + self.duration_in_seconds = None + self.status = None + self.status_message = None + self.message = None + self.databases = databases + self.database_summary = None + self.migration_report_result = migration_report_result + self.source_server_version = None + self.source_server_brand_version = None + self.target_server_version = None + self.target_server_brand_version = None + self.exceptions_and_warnings = None + self.last_storage_update = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel(MigrateMySqlAzureDbForMySqlOfflineTaskOutput): + """MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar object_name: Name of the item. + :vartype object_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar state: Current state of migration. Possible values include: "None", "InProgress", + "Failed", "Warning", "Completed", "Skipped", "Stopped". + :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState + :ivar status_message: Status message. + :vartype status_message: str + :ivar items_count: Number of items. + :vartype items_count: long + :ivar items_completed_count: Number of successfully completed items. + :vartype items_completed_count: long + :ivar error_prefix: Wildcard string prefix to use for querying all errors of the item. + :vartype error_prefix: str + :ivar result_prefix: Wildcard string prefix to use for querying all sub-tem results of the + item. + :vartype result_prefix: str + :ivar last_storage_update: Last time the storage was updated. + :vartype last_storage_update: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + 'object_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'state': {'readonly': True}, + 'status_message': {'readonly': True}, + 'items_count': {'readonly': True}, + 'items_completed_count': {'readonly': True}, + 'error_prefix': {'readonly': True}, + 'result_prefix': {'readonly': True}, + 'last_storage_update': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'object_name': {'key': 'objectName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'state': {'key': 'state', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'items_count': {'key': 'itemsCount', 'type': 'long'}, + 'items_completed_count': {'key': 'itemsCompletedCount', 'type': 'long'}, + 'error_prefix': {'key': 'errorPrefix', 'type': 'str'}, + 'result_prefix': {'key': 'resultPrefix', 'type': 'str'}, + 'last_storage_update': {'key': 'lastStorageUpdate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskOutputTableLevel, self).__init__(**kwargs) + self.result_type = 'TableLevelOutput' # type: str + self.object_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.status_message = None + self.items_count = None + self.items_completed_count = None + self.error_prefix = None + self.result_prefix = None + self.last_storage_update = None + + +class MigrateMySqlAzureDbForMySqlOfflineTaskProperties(ProjectTaskProperties): + """Properties for the task that migrates MySQL databases to Azure Database for MySQL for offline migrations. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param task_type: Required. Task type.Constant filled by server. + :type task_type: str + :ivar errors: Array of errors. This is ignored if submitted. + :vartype errors: list[~azure.mgmt.datamigration.models.ODataError] + :ivar state: The state of the task. This is ignored if submitted. Possible values include: + "Unknown", "Queued", "Running", "Canceled", "Succeeded", "Failed", "FailedInputValidation", + "Faulted". + :vartype state: str or ~azure.mgmt.datamigration.models.TaskState + :ivar commands: Array of command properties. + :vartype commands: list[~azure.mgmt.datamigration.models.CommandProperties] + :param client_data: Key value pairs of client data to attach meta data information to task. + :type client_data: dict[str, str] + :param input: Task input. + :type input: ~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineTaskInput + :ivar output: Task output. This is ignored if submitted. + :vartype output: + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlOfflineTaskOutput] + """ + + _validation = { + 'task_type': {'required': True}, + 'errors': {'readonly': True}, + 'state': {'readonly': True}, + 'commands': {'readonly': True}, + 'output': {'readonly': True}, + } + + _attribute_map = { + 'task_type': {'key': 'taskType', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ODataError]'}, + 'state': {'key': 'state', 'type': 'str'}, + 'commands': {'key': 'commands', 'type': '[CommandProperties]'}, + 'client_data': {'key': 'clientData', 'type': '{str}'}, + 'input': {'key': 'input', 'type': 'MigrateMySqlAzureDbForMySqlOfflineTaskInput'}, + 'output': {'key': 'output', 'type': '[MigrateMySqlAzureDbForMySqlOfflineTaskOutput]'}, + } + + def __init__( + self, + *, + client_data: Optional[Dict[str, str]] = None, + input: Optional["MigrateMySqlAzureDbForMySqlOfflineTaskInput"] = None, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlOfflineTaskProperties, self).__init__(client_data=client_data, **kwargs) + self.task_type = 'Migrate.MySql.AzureDbForMySql' # type: str + self.input = input + self.output = None + + +class MigrateMySqlAzureDbForMySqlSyncDatabaseInput(msrest.serialization.Model): + """Database specific information for MySQL to Azure Database for MySQL migration task inputs. + + :param name: Name of the database. + :type name: str + :param target_database_name: Name of target database. Note: Target database will be truncated + before starting migration. + :type target_database_name: str + :param migration_setting: Migration settings which tune the migration behavior. + :type migration_setting: dict[str, str] + :param source_setting: Source settings to tune source endpoint migration behavior. + :type source_setting: dict[str, str] + :param target_setting: Target settings to tune target endpoint migration behavior. + :type target_setting: dict[str, str] + :param table_map: Mapping of source to target tables. + :type table_map: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'migration_setting': {'key': 'migrationSetting', 'type': '{str}'}, + 'source_setting': {'key': 'sourceSetting', 'type': '{str}'}, + 'target_setting': {'key': 'targetSetting', 'type': '{str}'}, + 'table_map': {'key': 'tableMap', 'type': '{str}'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + target_database_name: Optional[str] = None, + migration_setting: Optional[Dict[str, str]] = None, + source_setting: Optional[Dict[str, str]] = None, + target_setting: Optional[Dict[str, str]] = None, + table_map: Optional[Dict[str, str]] = None, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncDatabaseInput, self).__init__(**kwargs) + self.name = name + self.target_database_name = target_database_name + self.migration_setting = migration_setting + self.source_setting = source_setting + self.target_setting = target_setting + self.table_map = table_map + + +class MigrateMySqlAzureDbForMySqlSyncTaskInput(msrest.serialization.Model): + """Input for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. + + All required parameters must be populated in order to send to Azure. + + :param source_connection_info: Required. Connection information for source MySQL. + :type source_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param target_connection_info: Required. Connection information for target Azure Database for + MySQL. + :type target_connection_info: ~azure.mgmt.datamigration.models.MySqlConnectionInfo + :param selected_databases: Required. Databases to migrate. + :type selected_databases: + list[~azure.mgmt.datamigration.models.MigrateMySqlAzureDbForMySqlSyncDatabaseInput] + """ + + _validation = { + 'source_connection_info': {'required': True}, + 'target_connection_info': {'required': True}, + 'selected_databases': {'required': True}, + } + + _attribute_map = { + 'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'target_connection_info': {'key': 'targetConnectionInfo', 'type': 'MySqlConnectionInfo'}, + 'selected_databases': {'key': 'selectedDatabases', 'type': '[MigrateMySqlAzureDbForMySqlSyncDatabaseInput]'}, + } + + def __init__( + self, + *, + source_connection_info: "MySqlConnectionInfo", + target_connection_info: "MySqlConnectionInfo", + selected_databases: List["MigrateMySqlAzureDbForMySqlSyncDatabaseInput"], + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskInput, self).__init__(**kwargs) + self.source_connection_info = source_connection_info + self.target_connection_info = target_connection_info + self.selected_databases = selected_databases + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutput(msrest.serialization.Model): + """Output for the task that migrates MySQL databases to Azure Database for MySQL for online migrations. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputError, MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel, MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + _subtype_map = { + 'result_type': {'DatabaseLevelErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError', 'DatabaseLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputError', 'MigrationLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateMySqlAzureDbForMySqlSyncTaskOutputTableLevel'} + } + + def __init__( + self, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskOutput, self).__init__(**kwargs) + self.id = None + self.result_type = None # type: Optional[str] + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError(MigrateMySqlAzureDbForMySqlSyncTaskOutput): + """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :param error_message: Error message. + :type error_message: str + :param events: List of error events. + :type events: list[~azure.mgmt.datamigration.models.SyncMigrationDatabaseErrorEvent] + """ + + _validation = { + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'events': {'key': 'events', 'type': '[SyncMigrationDatabaseErrorEvent]'}, + } + + def __init__( + self, + *, + error_message: Optional[str] = None, + events: Optional[List["SyncMigrationDatabaseErrorEvent"]] = None, + **kwargs + ): + super(MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseError, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelErrorOutput' # type: str + self.error_message = error_message + self.events = events + + +class MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel(MigrateMySqlAzureDbForMySqlSyncTaskOutput): + """MigrateMySqlAzureDbForMySqlSyncTaskOutputDatabaseLevel. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + :ivar database_name: Name of the database. + :vartype database_name: str + :ivar started_on: Migration start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Migration end time. + :vartype ended_on: ~datetime.datetime + :ivar migration_state: Migration state that this database is in. Possible values include: + "UNDEFINED", "CONFIGURING", "INITIALIAZING", "STARTING", "RUNNING", "READY_TO_COMPLETE", + "COMPLETING", "COMPLETE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATING", + "VALIDATION_COMPLETE", "VALIDATION_FAILED", "RESTORE_IN_PROGRESS", "RESTORE_COMPLETED", + "BACKUP_IN_PROGRESS", "BACKUP_COMPLETED". + :vartype migration_state: str or + ~azure.mgmt.datamigration.models.SyncDatabaseMigrationReportingState + :ivar incoming_changes: Number of incoming changes. + :vartype incoming_changes: long + :ivar applied_changes: Number of applied changes. + :vartype applied_changes: long + :ivar cdc_insert_counter: Number of cdc inserts. + :vartype cdc_insert_counter: long + :ivar cdc_delete_counter: Number of cdc deletes. + :vartype cdc_delete_counter: long :ivar cdc_update_counter: Number of cdc updates. :vartype cdc_update_counter: long :ivar full_load_completed_tables: Number of tables completed in full load. @@ -6052,15 +6728,17 @@ class MigrateSchemaSqlServerSqlDbTaskOutput(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str """ _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, } _attribute_map = { @@ -6086,10 +6764,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputDatabaseLevel(MigrateSchemaSqlServerS Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar database_name: The name of the database. :vartype database_name: str :ivar state: State of the schema migration for this database. Possible values include: "None", @@ -6118,7 +6798,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputDatabaseLevel(MigrateSchemaSqlServerS _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'database_name': {'readonly': True}, 'state': {'readonly': True}, 'stage': {'readonly': True}, @@ -6169,10 +6849,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputError(MigrateSchemaSqlServerSqlDbTask Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar command_text: Schema command which failed. :vartype command_text: str :ivar error_text: Reason of failure. @@ -6181,7 +6863,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputError(MigrateSchemaSqlServerSqlDbTask _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'command_text': {'readonly': True}, 'error_text': {'readonly': True}, } @@ -6208,10 +6890,12 @@ class MigrateSchemaSqlServerSqlDbTaskOutputMigrationLevel(MigrateSchemaSqlServer Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar state: Overall state of the schema migration. Possible values include: "None", "InProgress", "Failed", "Warning", "Completed", "Skipped", "Stopped". :vartype state: str or ~azure.mgmt.datamigration.models.MigrationState @@ -6231,7 +6915,7 @@ class MigrateSchemaSqlServerSqlDbTaskOutputMigrationLevel(MigrateSchemaSqlServer _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'state': {'readonly': True}, 'started_on': {'readonly': True}, 'ended_on': {'readonly': True}, @@ -6329,17 +7013,19 @@ class MigrateSchemaSqlTaskOutputError(MigrateSchemaSqlServerSqlDbTaskOutput): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Result identifier. :vartype id: str - :ivar result_type: Result type.Constant filled by server. - :vartype result_type: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str :ivar error: Migration error. :vartype error: ~azure.mgmt.datamigration.models.ReportableException """ _validation = { 'id': {'readonly': True}, - 'result_type': {'readonly': True}, + 'result_type': {'required': True}, 'error': {'readonly': True}, } @@ -7032,7 +7718,7 @@ class MigrateSqlServerSqlDbTaskOutput(msrest.serialization.Model): """Output for the task that migrates on-prem SQL Server databases to Azure SQL Database. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: MigrateSqlServerSqlDbTaskOutputDatabaseLevel, MigrateSqlServerSqlDbTaskOutputError, MigrateSqlServerSqlDbTaskOutputMigrationLevel, MigrateSqlServerSqlDbTaskOutputTableLevel. + sub-classes are: MigrateSqlServerSqlDbTaskOutputDatabaseLevel, MigrateSqlServerSqlDbTaskOutputError, MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult, MigrateSqlServerSqlDbTaskOutputMigrationLevel, MigrateSqlServerSqlDbTaskOutputValidationResult, MigrateSqlServerSqlDbTaskOutputTableLevel. Variables are only populated by the server, and will be ignored when sending a request. @@ -7055,7 +7741,7 @@ class MigrateSqlServerSqlDbTaskOutput(msrest.serialization.Model): } _subtype_map = { - 'result_type': {'DatabaseLevelOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateSqlServerSqlDbTaskOutputError', 'MigrationLevelOutput': 'MigrateSqlServerSqlDbTaskOutputMigrationLevel', 'TableLevelOutput': 'MigrateSqlServerSqlDbTaskOutputTableLevel'} + 'result_type': {'DatabaseLevelOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevel', 'ErrorOutput': 'MigrateSqlServerSqlDbTaskOutputError', 'MigrationDatabaseLevelValidationOutput': 'MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult', 'MigrationLevelOutput': 'MigrateSqlServerSqlDbTaskOutputMigrationLevel', 'MigrationValidationOutput': 'MigrateSqlServerSqlDbTaskOutputValidationResult', 'TableLevelOutput': 'MigrateSqlServerSqlDbTaskOutputTableLevel'} } def __init__( @@ -7153,22 +7839,186 @@ def __init__( self, **kwargs ): - super(MigrateSqlServerSqlDbTaskOutputDatabaseLevel, self).__init__(**kwargs) - self.result_type = 'DatabaseLevelOutput' # type: str - self.database_name = None + super(MigrateSqlServerSqlDbTaskOutputDatabaseLevel, self).__init__(**kwargs) + self.result_type = 'DatabaseLevelOutput' # type: str + self.database_name = None + self.started_on = None + self.ended_on = None + self.state = None + self.stage = None + self.status_message = None + self.message = None + self.number_of_objects = None + self.number_of_objects_completed = None + self.error_count = None + self.error_prefix = None + self.result_prefix = None + self.exceptions_and_warnings = None + self.object_summary = None + + +class MigrationValidationDatabaseLevelResult(msrest.serialization.Model): + """Database level validation results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Result identifier. + :vartype id: str + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :ivar source_database_name: Name of the source database. + :vartype source_database_name: str + :ivar target_database_name: Name of the target database. + :vartype target_database_name: str + :ivar started_on: Validation start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Validation end time. + :vartype ended_on: ~datetime.datetime + :ivar data_integrity_validation_result: Provides data integrity validation result between the + source and target tables that are migrated. + :vartype data_integrity_validation_result: + ~azure.mgmt.datamigration.models.DataIntegrityValidationResult + :ivar schema_validation_result: Provides schema comparison result between source and target + database. + :vartype schema_validation_result: + ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult + :ivar query_analysis_validation_result: Results of some of the query execution result between + source and target database. + :vartype query_analysis_validation_result: + ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult + :ivar status: Current status of validation at the database level. Possible values include: + "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", + "Stopped", "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'migration_id': {'readonly': True}, + 'source_database_name': {'readonly': True}, + 'target_database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'data_integrity_validation_result': {'readonly': True}, + 'schema_validation_result': {'readonly': True}, + 'query_analysis_validation_result': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, + 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, + 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationValidationDatabaseLevelResult, self).__init__(**kwargs) + self.id = None + self.migration_id = None + self.source_database_name = None + self.target_database_name = None + self.started_on = None + self.ended_on = None + self.data_integrity_validation_result = None + self.schema_validation_result = None + self.query_analysis_validation_result = None + self.status = None + + +class MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult(MigrateSqlServerSqlDbTaskOutput, MigrationValidationDatabaseLevelResult): + """MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :ivar source_database_name: Name of the source database. + :vartype source_database_name: str + :ivar target_database_name: Name of the target database. + :vartype target_database_name: str + :ivar started_on: Validation start time. + :vartype started_on: ~datetime.datetime + :ivar ended_on: Validation end time. + :vartype ended_on: ~datetime.datetime + :ivar data_integrity_validation_result: Provides data integrity validation result between the + source and target tables that are migrated. + :vartype data_integrity_validation_result: + ~azure.mgmt.datamigration.models.DataIntegrityValidationResult + :ivar schema_validation_result: Provides schema comparison result between source and target + database. + :vartype schema_validation_result: + ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult + :ivar query_analysis_validation_result: Results of some of the query execution result between + source and target database. + :vartype query_analysis_validation_result: + ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult + :ivar status: Current status of validation at the database level. Possible values include: + "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", + "Stopped", "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'migration_id': {'readonly': True}, + 'source_database_name': {'readonly': True}, + 'target_database_name': {'readonly': True}, + 'started_on': {'readonly': True}, + 'ended_on': {'readonly': True}, + 'data_integrity_validation_result': {'readonly': True}, + 'schema_validation_result': {'readonly': True}, + 'query_analysis_validation_result': {'readonly': True}, + 'status': {'readonly': True}, + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, + 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, + 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, + 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, + 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, + 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, + 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, + 'status': {'key': 'status', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrateSqlServerSqlDbTaskOutputDatabaseLevelValidationResult, self).__init__(**kwargs) + self.migration_id = None + self.source_database_name = None + self.target_database_name = None self.started_on = None self.ended_on = None - self.state = None - self.stage = None - self.status_message = None - self.message = None - self.number_of_objects = None - self.number_of_objects_completed = None - self.error_count = None - self.error_prefix = None - self.result_prefix = None - self.exceptions_and_warnings = None - self.object_summary = None + self.data_integrity_validation_result = None + self.schema_validation_result = None + self.query_analysis_validation_result = None + self.status = None + self.result_type = 'MigrationDatabaseLevelValidationOutput' # type: str + self.id = None + self.result_type = 'MigrationDatabaseLevelValidationOutput' # type: str class MigrateSqlServerSqlDbTaskOutputError(MigrateSqlServerSqlDbTaskOutput): @@ -7395,6 +8245,104 @@ def __init__( self.result_prefix = None +class MigrationValidationResult(msrest.serialization.Model): + """Migration Validation Result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Migration validation result identifier. + :vartype id: str + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :param summary_results: Validation summary results for each database. + :type summary_results: dict[str, + ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] + :ivar status: Current status of validation at the migration level. Status from the database + validation result status will be aggregated here. Possible values include: "Default", + "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", + "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'migration_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + summary_results: Optional[Dict[str, "MigrationValidationDatabaseSummaryResult"]] = None, + **kwargs + ): + super(MigrationValidationResult, self).__init__(**kwargs) + self.id = None + self.migration_id = None + self.summary_results = summary_results + self.status = None + + +class MigrateSqlServerSqlDbTaskOutputValidationResult(MigrateSqlServerSqlDbTaskOutput, MigrationValidationResult): + """MigrateSqlServerSqlDbTaskOutputValidationResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar migration_id: Migration Identifier. + :vartype migration_id: str + :param summary_results: Validation summary results for each database. + :type summary_results: dict[str, + ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] + :ivar status: Current status of validation at the migration level. Status from the database + validation result status will be aggregated here. Possible values include: "Default", + "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", + "Failed". + :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus + :ivar id: Result identifier. + :vartype id: str + :param result_type: Required. Result type.Constant filled by server. + :type result_type: str + """ + + _validation = { + 'migration_id': {'readonly': True}, + 'status': {'readonly': True}, + 'id': {'readonly': True}, + 'result_type': {'required': True}, + } + + _attribute_map = { + 'migration_id': {'key': 'migrationId', 'type': 'str'}, + 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, + 'status': {'key': 'status', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'result_type': {'key': 'resultType', 'type': 'str'}, + } + + def __init__( + self, + *, + summary_results: Optional[Dict[str, "MigrationValidationDatabaseSummaryResult"]] = None, + **kwargs + ): + super(MigrateSqlServerSqlDbTaskOutputValidationResult, self).__init__(summary_results=summary_results, **kwargs) + self.migration_id = None + self.summary_results = summary_results + self.status = None + self.result_type = 'MigrationValidationOutput' # type: str + self.id = None + self.result_type = 'MigrationValidationOutput' # type: str + + class MigrateSqlServerSqlDbTaskProperties(ProjectTaskProperties): """Properties for the task that migrates on-prem SQL Server databases to Azure SQL Database. @@ -8924,84 +9872,6 @@ def __init__( self.target_table_name = None -class MigrationValidationDatabaseLevelResult(msrest.serialization.Model): - """Database level validation results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Result identifier. - :vartype id: str - :ivar migration_id: Migration Identifier. - :vartype migration_id: str - :ivar source_database_name: Name of the source database. - :vartype source_database_name: str - :ivar target_database_name: Name of the target database. - :vartype target_database_name: str - :ivar started_on: Validation start time. - :vartype started_on: ~datetime.datetime - :ivar ended_on: Validation end time. - :vartype ended_on: ~datetime.datetime - :ivar data_integrity_validation_result: Provides data integrity validation result between the - source and target tables that are migrated. - :vartype data_integrity_validation_result: - ~azure.mgmt.datamigration.models.DataIntegrityValidationResult - :ivar schema_validation_result: Provides schema comparison result between source and target - database. - :vartype schema_validation_result: - ~azure.mgmt.datamigration.models.SchemaComparisonValidationResult - :ivar query_analysis_validation_result: Results of some of the query execution result between - source and target database. - :vartype query_analysis_validation_result: - ~azure.mgmt.datamigration.models.QueryAnalysisValidationResult - :ivar status: Current status of validation at the database level. Possible values include: - "Default", "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", - "Stopped", "Failed". - :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'migration_id': {'readonly': True}, - 'source_database_name': {'readonly': True}, - 'target_database_name': {'readonly': True}, - 'started_on': {'readonly': True}, - 'ended_on': {'readonly': True}, - 'data_integrity_validation_result': {'readonly': True}, - 'schema_validation_result': {'readonly': True}, - 'query_analysis_validation_result': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'migration_id': {'key': 'migrationId', 'type': 'str'}, - 'source_database_name': {'key': 'sourceDatabaseName', 'type': 'str'}, - 'target_database_name': {'key': 'targetDatabaseName', 'type': 'str'}, - 'started_on': {'key': 'startedOn', 'type': 'iso-8601'}, - 'ended_on': {'key': 'endedOn', 'type': 'iso-8601'}, - 'data_integrity_validation_result': {'key': 'dataIntegrityValidationResult', 'type': 'DataIntegrityValidationResult'}, - 'schema_validation_result': {'key': 'schemaValidationResult', 'type': 'SchemaComparisonValidationResult'}, - 'query_analysis_validation_result': {'key': 'queryAnalysisValidationResult', 'type': 'QueryAnalysisValidationResult'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationValidationDatabaseLevelResult, self).__init__(**kwargs) - self.id = None - self.migration_id = None - self.source_database_name = None - self.target_database_name = None - self.started_on = None - self.ended_on = None - self.data_integrity_validation_result = None - self.schema_validation_result = None - self.query_analysis_validation_result = None - self.status = None - - class MigrationValidationDatabaseSummaryResult(msrest.serialization.Model): """Migration Validation Database level summary result. @@ -9095,51 +9965,6 @@ def __init__( self.enable_query_analysis_validation = enable_query_analysis_validation -class MigrationValidationResult(msrest.serialization.Model): - """Migration Validation Result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Migration validation result identifier. - :vartype id: str - :ivar migration_id: Migration Identifier. - :vartype migration_id: str - :param summary_results: Validation summary results for each database. - :type summary_results: dict[str, - ~azure.mgmt.datamigration.models.MigrationValidationDatabaseSummaryResult] - :ivar status: Current status of validation at the migration level. Status from the database - validation result status will be aggregated here. Possible values include: "Default", - "NotStarted", "Initialized", "InProgress", "Completed", "CompletedWithIssues", "Stopped", - "Failed". - :vartype status: str or ~azure.mgmt.datamigration.models.ValidationStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'migration_id': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'migration_id': {'key': 'migrationId', 'type': 'str'}, - 'summary_results': {'key': 'summaryResults', 'type': '{MigrationValidationDatabaseSummaryResult}'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - *, - summary_results: Optional[Dict[str, "MigrationValidationDatabaseSummaryResult"]] = None, - **kwargs - ): - super(MigrationValidationResult, self).__init__(**kwargs) - self.id = None - self.migration_id = None - self.summary_results = summary_results - self.status = None - - class MiSqlConnectionInfo(ConnectionInfo): """Properties required to create a connection to Azure SQL database Managed instance. @@ -10406,6 +11231,8 @@ class MySqlConnectionInfo(ConnectionInfo): :type server_name: str :param port: Required. Port for Server. :type port: int + :param encrypt_connection: Whether to encrypt the connection. + :type encrypt_connection: bool """ _validation = { @@ -10420,6 +11247,7 @@ class MySqlConnectionInfo(ConnectionInfo): 'password': {'key': 'password', 'type': 'str'}, 'server_name': {'key': 'serverName', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, + 'encrypt_connection': {'key': 'encryptConnection', 'type': 'bool'}, } def __init__( @@ -10429,12 +11257,14 @@ def __init__( port: int, user_name: Optional[str] = None, password: Optional[str] = None, + encrypt_connection: Optional[bool] = True, **kwargs ): super(MySqlConnectionInfo, self).__init__(user_name=user_name, password=password, **kwargs) self.type = 'MySqlConnectionInfo' # type: str self.server_name = server_name self.port = port + self.encrypt_connection = encrypt_connection class NameAvailabilityRequest(msrest.serialization.Model): @@ -10916,6 +11746,8 @@ class Project(TrackedResource): :type tags: dict[str, str] :param location: Required. Resource location. :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData :param source_platform: Source platform for the project. Possible values include: "SQL", "MySQL", "PostgreSql", "MongoDb", "Unknown". :type source_platform: str or ~azure.mgmt.datamigration.models.ProjectSourcePlatform @@ -10940,6 +11772,7 @@ class Project(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, 'creation_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -10950,6 +11783,7 @@ class Project(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'source_platform': {'key': 'properties.sourcePlatform', 'type': 'str'}, 'target_platform': {'key': 'properties.targetPlatform', 'type': 'str'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, @@ -10996,12 +11830,15 @@ class ProjectFile(Resource): :type etag: str :param properties: Custom file properties. :type properties: ~azure.mgmt.datamigration.models.ProjectFileProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -11010,6 +11847,7 @@ class ProjectFile(Resource): 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'ProjectFileProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -11022,6 +11860,7 @@ def __init__( super(ProjectFile, self).__init__(**kwargs) self.etag = etag self.properties = properties + self.system_data = None class ProjectFileProperties(msrest.serialization.Model): @@ -11114,12 +11953,15 @@ class ProjectTask(Resource): :type etag: str :param properties: Custom task properties. :type properties: ~azure.mgmt.datamigration.models.ProjectTaskProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.datamigration.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -11128,6 +11970,7 @@ class ProjectTask(Resource): 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'ProjectTaskProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -11140,6 +11983,7 @@ def __init__( super(ProjectTask, self).__init__(**kwargs) self.etag = etag self.properties = properties + self.system_data = None class QueryAnalysisValidationResult(msrest.serialization.Model): @@ -12116,6 +12960,54 @@ def __init__( self.event_text = None +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.datamigration.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.datamigration.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class TaskList(msrest.serialization.Model): """OData page of tasks. diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_files_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_files_operations.py index 9d7a7913701f..86365f8bc6c9 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_files_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_files_operations.py @@ -74,7 +74,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -160,7 +160,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -233,7 +233,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -312,7 +312,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -382,7 +382,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -458,7 +458,7 @@ def read( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -528,7 +528,7 @@ def read_write( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_operations.py index 43150ee4ea92..a12bcbf22bb9 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_operations.py @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_projects_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_projects_operations.py index 93839c1aea30..465021b30d63 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_projects_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_projects_operations.py @@ -71,7 +71,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -156,7 +156,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -232,7 +232,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -302,7 +302,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -371,7 +371,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_resource_skus_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_resource_skus_operations.py index e1ec7e1e5b8d..96d5b8c7af29 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_resource_skus_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_resource_skus_operations.py @@ -64,7 +64,7 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_service_tasks_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_service_tasks_operations.py index 1c6dd9958d86..7ae439bb88d2 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_service_tasks_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_service_tasks_operations.py @@ -76,7 +76,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -165,7 +165,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -244,7 +244,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -316,7 +316,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -386,7 +386,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -458,7 +458,7 @@ def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_services_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_services_operations.py index 7924909938b1..d443ec5072f3 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_services_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_services_operations.py @@ -60,7 +60,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -134,8 +134,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.datamigration.models.DataMigrationService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either DataMigrationService or the result of cls(response) @@ -214,7 +214,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -264,7 +264,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -321,8 +321,8 @@ def begin_delete( :type delete_running_tasks: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -385,7 +385,7 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -452,8 +452,8 @@ def begin_update( :type parameters: ~azure.mgmt.datamigration.models.DataMigrationService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either DataMigrationService or the result of cls(response) @@ -533,7 +533,7 @@ def check_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -582,7 +582,7 @@ def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -634,8 +634,8 @@ def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -696,7 +696,7 @@ def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -749,8 +749,8 @@ def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -825,7 +825,7 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -906,7 +906,7 @@ def check_children_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -971,7 +971,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -1043,7 +1043,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -1119,7 +1119,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_tasks_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_tasks_operations.py index ea9a4476a344..87e484181c4f 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_tasks_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_tasks_operations.py @@ -78,7 +78,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): @@ -170,7 +170,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -253,7 +253,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -329,7 +329,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -403,7 +403,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -479,7 +479,7 @@ def cancel( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" # Construct URL @@ -553,7 +553,7 @@ def command( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_usages_operations.py b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_usages_operations.py index d7b73afe05b0..9139c217c67c 100644 --- a/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_usages_operations.py +++ b/sdk/datamigration/azure-mgmt-datamigration/azure/mgmt/datamigration/operations/_usages_operations.py @@ -68,7 +68,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-07-15-preview" + api_version = "2021-06-30" accept = "application/json" def prepare_request(next_link=None): From 47108e9251cd706f48bea359a388b6c8fd161faf Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Tue, 24 Aug 2021 10:24:29 -0700 Subject: [PATCH 08/16] Chain exceptions from LibsecretPersistence (#20380) --- .../azure/identity/_persistent_cache.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sdk/identity/azure-identity/azure/identity/_persistent_cache.py b/sdk/identity/azure-identity/azure/identity/_persistent_cache.py index 0630de2d9f62..6c6765c5ad95 100644 --- a/sdk/identity/azure-identity/azure/identity/_persistent_cache.py +++ b/sdk/identity/azure-identity/azure/identity/_persistent_cache.py @@ -2,14 +2,19 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ +import logging import os import sys from typing import TYPE_CHECKING +import six + if TYPE_CHECKING: from typing import Any import msal_extensions +_LOGGER = logging.getLogger(__name__) + class TokenCachePersistenceOptions(object): """Options for persistent token caching. @@ -86,12 +91,16 @@ def _get_persistence(allow_unencrypted, account_name, cache_name): return msal_extensions.LibsecretPersistence( file_path, cache_name, {"MsalClientID": "Microsoft.Developer.IdentityService"}, label=account_name ) - except ImportError: + except Exception as ex: # pylint:disable=broad-except + _LOGGER.debug('msal-extensions is unable to encrypt a persistent cache: "%s"', ex, exc_info=True) if not allow_unencrypted: - raise ValueError( - "PyGObject is required to encrypt the persistent cache. Please install that library or " - + 'specify "allow_unencrypted_storage=True" to store the cache without encryption.' + error = ValueError( + "Cache encryption is impossible because libsecret dependencies are not installed or are unusable," + + " for example because no display is available (as in an SSH session). The chained exception has" + + ' more information. Specify "allow_unencrypted_storage=True" to store the cache unencrypted' + + " instead of raising this exception." ) - return msal_extensions.FilePersistence(file_path) + six.raise_from(error, ex) + return msal_extensions.FilePersistence(file_path) raise NotImplementedError("A persistent cache is not available in this environment.") From 82e2b54985876db1538180f634bf438071bc795b Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 24 Aug 2021 10:39:20 -0700 Subject: [PATCH 09/16] [translation] fix poller.details (#20392) * fixing docstring types for async client * populate poller.details.id immediately * pylint * add bug fix to changelog --- .../azure-ai-translation-document/CHANGELOG.md | 1 + .../azure/ai/translation/document/_polling.py | 8 +++++--- .../azure/ai/translation/document/aio/_async_polling.py | 8 +++++--- .../azure/ai/translation/document/aio/_client_async.py | 4 ++-- .../azure-ai-translation-document/tests/asynctestcase.py | 1 + .../azure-ai-translation-document/tests/testcase.py | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/CHANGELOG.md b/sdk/translation/azure-ai-translation-document/CHANGELOG.md index cd7f3e49341c..8f9a925025e8 100644 --- a/sdk/translation/azure-ai-translation-document/CHANGELOG.md +++ b/sdk/translation/azure-ai-translation-document/CHANGELOG.md @@ -7,6 +7,7 @@ ### Breaking Changes ### Bugs Fixed +- The operation `id` under `details` of the poller object now populates correctly. ### Other Changes diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py index e614d09e7c3b..ad194c453228 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py @@ -63,9 +63,11 @@ def details(self): :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access - ) + if self._polling_method._current_body: # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access + self._polling_method._current_body # pylint: disable=protected-access + ) + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access @classmethod def from_continuation_token(cls, polling_method, continuation_token, **kwargs): diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py index 379751ec66bc..79efe2f85c82 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py @@ -43,9 +43,11 @@ def details(self) -> TranslationStatus: :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access - ) + if self._polling_method._current_body: # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access + self._polling_method._current_body # pylint: disable=protected-access + ) + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access @classmethod def from_continuation_token( diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index 591f0885e076..c8463bda0272 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -271,7 +271,7 @@ def list_all_translation_statuses(self, **kwargs): format: ["param1 asc/desc", "param2 asc/desc", ...] (ex: 'created_on asc', 'created_on desc'). :return: A pageable of TranslationStatus. - :rtype: ~azure.core.paging.ItemPaged[TranslationStatus] + :rtype: ~azure.core.async_paging.AsyncItemPaged[TranslationStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -336,7 +336,7 @@ def list_all_document_statuses(self, translation_id, **kwargs): format: ["param1 asc/desc", "param2 asc/desc", ...] (ex: 'created_on asc', 'created_on desc'). :return: A pageable of DocumentStatus. - :rtype: ~azure.core.paging.ItemPaged[DocumentStatus] + :rtype: ~azure.core.async_paging.AsyncItemPaged[DocumentStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: diff --git a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py index b1c7a3b9c681..a7fe4612cac8 100644 --- a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py @@ -26,6 +26,7 @@ async def _begin_and_validate_translation_async(self, async_client, translation_ # submit operation poller = await async_client.begin_translation(translation_inputs) self.assertIsNotNone(poller.id) + self.assertIsNotNone(poller.details.id) # wait for result doc_statuses = await poller.result() # validate diff --git a/sdk/translation/azure-ai-translation-document/tests/testcase.py b/sdk/translation/azure-ai-translation-document/tests/testcase.py index 733618adbe57..1c16c23a2db2 100644 --- a/sdk/translation/azure-ai-translation-document/tests/testcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/testcase.py @@ -236,6 +236,7 @@ def _begin_and_validate_translation(self, client, translation_inputs, total_docs # submit job poller = client.begin_translation(translation_inputs) self.assertIsNotNone(poller.id) + self.assertIsNotNone(poller.details.id) # wait for result result = poller.result() # validate From 5d6babb059be9c1c781ce6e11c657e9eb74bd994 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 24 Aug 2021 11:46:41 -0700 Subject: [PATCH 10/16] improve begin_translation docstring (#20401) --- .../azure/ai/translation/document/_client.py | 11 +++++++---- .../ai/translation/document/aio/_client_async.py | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py index cb706b0373cd..39dfbdbcce64 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py @@ -113,10 +113,13 @@ def begin_translation( self, *args, **kwargs ): # pylint: disable=client-method-missing-type-annotations """Begin translating the document(s) in your source container to your target container - in the given language. To perform a single translation from source to target, pass the `source_url`, - `target_url`, and `target_language_code` parameters including any optional keyword arguments. - To pass multiple inputs for translation, pass the `inputs` parameter as a list of - :class:`~azure.ai.translation.document.DocumentTranslationInput`. + in the given language. There are two ways to call this method: + + 1) To perform translation on documents from a single source container to a single target container, pass the + `source_url`, `target_url`, and `target_language_code` parameters including any optional keyword arguments. + + 2) To pass multiple inputs for translation (multiple sources or targets), pass the `inputs` parameter + as a list of :class:`~azure.ai.translation.document.DocumentTranslationInput`. For supported languages and document formats, see the service documentation: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index c8463bda0272..1ae6622521ac 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -122,10 +122,13 @@ async def begin_translation( self, *args, **kwargs ): # pylint: disable=client-method-missing-type-annotations """Begin translating the document(s) in your source container to your target container - in the given language. To perform a single translation from source to target, pass the `source_url`, - `target_url`, and `target_language_code` parameters including any optional keyword arguments. - To pass multiple inputs for translation, pass the `inputs` parameter as a list of - :class:`~azure.ai.translation.document.DocumentTranslationInput`. + in the given language. There are two ways to call this method: + + 1) To perform translation on documents from a single source container to a single target container, pass the + `source_url`, `target_url`, and `target_language_code` parameters including any optional keyword arguments. + + 2) To pass multiple inputs for translation (multiple sources or targets), pass the `inputs` parameter + as a list of :class:`~azure.ai.translation.document.DocumentTranslationInput`. For supported languages and document formats, see the service documentation: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview From 1fcc65f56deeb0f5c2d64c9454cfe2550dd3cb7d Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 24 Aug 2021 13:15:27 -0700 Subject: [PATCH 11/16] Update .docsettings.yml (#20402) --- eng/.docsettings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 2e5778981834..0b43cf516b57 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -10,6 +10,7 @@ omitted_paths: - sdk/identity/azure-identity/tests/* - sdk/**/tests/perfstress_tests/* - sdk/nspkg/* + - sdk/**/swagger/* language: python root_check_enabled: True From 7fbd9c2201661cb8c5facd06afb9621bca8c2767 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 24 Aug 2021 14:17:16 -0700 Subject: [PATCH 12/16] Sync eng/common directory with azure-sdk-tools for PR 1918 (#20342) * Stress test deployment script resiliency fixes * Use PSModule-Helpers to install powershell-yaml Co-authored-by: Ben Broderick Phillips --- .../stress-testing/deploy-stress-tests.ps1 | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 b/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 index 25af8c9edd72..a95ce62ff02b 100644 --- a/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 +++ b/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 @@ -20,9 +20,8 @@ $ErrorActionPreference = 'Stop' . $PSScriptRoot/find-all-stress-packages.ps1 $FailedCommands = New-Object Collections.Generic.List[hashtable] -if (!(Get-Module powershell-yaml)) { - Install-Module -Name powershell-yaml -RequiredVersion 0.4.1 -Force -Scope CurrentUser -} +. (Join-Path $PSScriptRoot "../Helpers" PSModule-Helpers.ps1) +Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module # Powershell does not (at time of writing) treat exit codes from external binaries # as cause for stopping execution, so do this via a wrapper function. @@ -51,7 +50,10 @@ function Login([string]$subscription, [string]$clusterGroup, [boolean]$pushImage RunOrExitOnFailure az login --allow-no-subscriptions } - $clusterName = (az aks list -g $clusterGroup -o json| ConvertFrom-Json).name + # Discover cluster name, only one cluster per group is expected + Write-Host "Listing AKS cluster in $subscription/$clusterGroup" + $cluster = RunOrExitOnFailure az aks list -g $clusterGroup --subscription $subscription -o json + $clusterName = ($cluster | ConvertFrom-Json).name RunOrExitOnFailure az aks get-credentials ` -n "$clusterName" ` @@ -60,8 +62,9 @@ function Login([string]$subscription, [string]$clusterGroup, [boolean]$pushImage --overwrite-existing if ($pushImages) { - $registry = (az acr list -g $clusterGroup -o json | ConvertFrom-Json).name - RunOrExitOnFailure az acr login -n $registry + $registry = RunOrExitOnFailure az acr list -g $clusterGroup --subscription $subscription -o json + $registryName = ($registry | ConvertFrom-Json).name + RunOrExitOnFailure az acr login -n $registryName } } @@ -110,11 +113,8 @@ function DeployStressPackage( [string]$repository, [boolean]$pushImages ) { - $registry = (az acr list -g $clusterGroup -o json | ConvertFrom-Json).name - if (!$registry) { - Write-Host "Could not find container registry in resource group $clusterGroup" - exit 1 - } + $registry = RunOrExitOnFailure az acr list -g $clusterGroup --subscription $subscription -o json + $registryName = ($registry | ConvertFrom-Json).name Run helm dependency update $pkg.Directory if ($LASTEXITCODE) { return } @@ -133,7 +133,7 @@ function DeployStressPackage( if (!$imageName) { $imageName = $dockerFile.Directory.Name } - $imageTag = "${registry}.azurecr.io/$($repository.ToLower())/$($imageName):$deployId" + $imageTag = "${registryName}.azurecr.io/$($repository.ToLower())/$($imageName):$deployId" Write-Host "Building and pushing stress test docker image '$imageTag'" Run docker build -t $imageTag -f $dockerFile.FullName $dockerFile.DirectoryName if ($LASTEXITCODE) { return } @@ -154,7 +154,7 @@ function DeployStressPackage( Run helm upgrade $pkg.ReleaseName $pkg.Directory ` -n $pkg.Namespace ` --install ` - --set repository=$registry.azurecr.io/$repository ` + --set repository=$registryName.azurecr.io/$repository ` --set tag=$deployId ` --set stress-test-addons.env=$environment if ($LASTEXITCODE) { @@ -176,4 +176,7 @@ function DeployStressPackage( Run kubectl label secret -n $pkg.Namespace --overwrite $helmReleaseConfig deployId=$deployId } -DeployStressTests @PSBoundParameters +# Don't call functions when the script is being dot sourced +if ($MyInvocation.InvocationName -ne ".") { + DeployStressTests @PSBoundParameters +} From 986302feb918d8184e7769b9af4bb425b6e878e2 Mon Sep 17 00:00:00 2001 From: Mohamed Shaban Date: Tue, 24 Aug 2021 23:47:58 +0200 Subject: [PATCH 13/16] improve docs and samples for glossaries and custom models (#18587) * update the readme * update readme file * added custom translation samples * fix 'no-locale' thing in links * update glossary docs * update glossaries * link to sample glossaries instead of writing code in readme * update custom model sample linking * remove relative linking in readme * make subheadings in bold text to be more readable * conform with 'Document Translation' naming * disambiguate container sas url * capitaliz Azure name * remove misplaced period * update samples -> custom model * update async sample -> custom model * remove localization from url * update readme with new file types for glossaries * adding sample glossaries -> xlf * white space * use simplified single input method * update 'job' terminology * update azure-core naming * update glossary blob file reference name * link to supported glossaries table * remove locale from url --- .../azure-ai-translation-document/README.md | 45 ++++++++++ .../samples/assets/glossary_sample.csv | 4 + .../samples/assets/glossary_sample.tsv | 4 + .../samples/assets/glossary_sample.xlf | 23 ++++++ ...ple_translation_with_custom_model_async.py | 82 +++++++++++++++++++ .../sample_translation_with_custom_model.py | 75 +++++++++++++++++ 6 files changed, 233 insertions(+) create mode 100644 sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv create mode 100644 sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv create mode 100644 sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf create mode 100644 sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py create mode 100644 sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py diff --git a/sdk/translation/azure-ai-translation-document/README.md b/sdk/translation/azure-ai-translation-document/README.md index 80dcc5ebec30..d533f60e5585 100644 --- a/sdk/translation/azure-ai-translation-document/README.md +++ b/sdk/translation/azure-ai-translation-document/README.md @@ -323,6 +323,40 @@ To see how to use the Document Translation client library with Azure Storage Blo for your containers, and download the finished translated documents, see this [sample][sample_translation_with_azure_blob]. Note that you will need to install the [azure-storage-blob][azure_storage_blob] library to run this sample. +## Advanced Topics + +The following section provides some insights for some of the advanced translation features such as glossaries and custom translation models. + +### **Glossaries** +Glossaries are domain-specific dictionaries. For example, if you want to translate some medical-related documents, you may need support for the many words, terminology, and idioms in the medical field which you can't find in the standard translation dictionary or you simply need specific translation. This is why Document Translation provides support for glossaries. + +#### **How To Create Glossary File** + +Document Translation supports glossaries in the following formats: + +|**File Type**|**Extension**|**Description**|**Samples**| +|---------------|---------------|---------------|---------------| +|Tab-Separated Values/TAB|.tsv, .tab|Read more on [wikipedia][tsv_files_wikipedia]|[glossary_sample.tsv][sample_tsv_file]| +|Comma-Seperated Values|.csv|Read more on [wikipedia][csv_files_wikipedia]|[glossary_sample.csv][sample_csv_file]| +|Localization Interchange File Format|.xlf, .xliff|Read more on [wikipedia][xlf_files_wikipedia]|[glossary_sample.xlf][sample_xlf_file]| + +View all supported formats [here][supported_glossary_formats]. + +#### **How Use Glossaries in Document Translation** +In order to use glossaries with Document Translation, you first need to upload your glossaries file to some blob container, and then provide the SaS url to of this glossary file to Document Translation as in the code samples [sample_translation_with_glossaries.py][sample_translation_with_glossaries]. + + +### **Custom Translation Models** +Instead of using Document Translation's engine for translation, you can use your own custom Azure machine/deep learning model. + +#### **How To Create a Custom Translation Model** +For more info on how to create, provision, and deploy your own custom Azure translation model, please follow the instructions here: [Build, deploy, and use a custom model for translation][custom_translation_article] + +#### **How To Use a Custom Translation Model With Document Translation** +In order to use a custom translation model with Document Translation, you first +need to create and deploy your model, then follow the code sample [sample_translation_with_custom_model.py][sample_translation_with_custom_model] to use with Document Translation. + + ## Troubleshooting ### General @@ -436,6 +470,17 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [sample_translation_with_glossaries_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_glossaries_async.py [sample_translation_with_azure_blob]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_azure_blob.py [sample_translation_with_azure_blob_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_azure_blob_async.py +[sample_translation_with_custom_model]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py +[sample_translation_with_custom_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py + +[supported_glossary_formats]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview#supported-glossary-formats +[custom_translation_article]: https://docs.microsoft.com/azure/cognitive-services/translator/custom-translator/quickstart-build-deploy-custom-model +[tsv_files_wikipedia]: https://wikipedia.org/wiki/Tab-separated_values +[xlf_files_wikipedia]: https://wikipedia.org/wiki/XLIFF +[csv_files_wikipedia]: https://wikipedia.org/wiki/Comma-separated_values +[sample_tsv_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv +[sample_csv_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv +[sample_xlf_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf [cla]: https://cla.microsoft.com [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ diff --git a/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv new file mode 100644 index 000000000000..6883ab5d2d6d --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv @@ -0,0 +1,4 @@ +skull,le crâne +body,corps +heart,cœur +lungs,poumons diff --git a/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv new file mode 100644 index 000000000000..91ba49dd2374 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv @@ -0,0 +1,4 @@ +skull le crâne +body corps +heart cœur +lungs poumons diff --git a/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf new file mode 100644 index 000000000000..ef8fa9f37bdc --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf @@ -0,0 +1,23 @@ + + + + + + skull + le crâne + + + body + corps + + + heart + cœur + + + lungs + poumons + + + + \ No newline at end of file diff --git a/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py new file mode 100644 index 000000000000..7456aaff0e72 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +""" +FILE: sample_translation_with_custom_model_async.py + +DESCRIPTION: + This sample demonstrates how to create a translation operation and apply custom azure translation model when doing the translation. + + To set up your containers for translation and generate SAS tokens to your containers (or files) + with the appropriate permissions, see the README. + +USAGE: + python sample_translation_with_custom_model_async.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_DOCUMENT_TRANSLATION_ENDPOINT - the endpoint to your Document Translation resource. + 2) AZURE_DOCUMENT_TRANSLATION_KEY - your Document Translation API key. + 3) AZURE_SOURCE_CONTAINER_URL - the container SAS URL to your source container which has the documents + to be translated. + 4) AZURE_TARGET_CONTAINER_URL - the container SAS URL to your target container where the translated documents + will be written. + 5) AZURE_CUSTOM_MODEL_ID - the URL to your Azure custom translation model. +""" + +import asyncio + + +async def sample_translation_with_custom_model_async(): + import os + from azure.core.credentials import AzureKeyCredential + from azure.ai.translation.document.aio import DocumentTranslationClient + + endpoint = os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"] + key = os.environ["AZURE_DOCUMENT_TRANSLATION_KEY"] + source_container_url = os.environ["AZURE_SOURCE_CONTAINER_URL"] + target_container_url = os.environ["AZURE_TARGET_CONTAINER_URL"] + custom_model_id = os.environ["AZURE_CUSTOM_MODEL_ID"] + + client = DocumentTranslationClient(endpoint, AzureKeyCredential(key)) + + + + async with client: + poller = await client.begin_translation( + source_container_url, + target_container_url, + "es", + category_id=custom_model_id + ) + result = await poller.result() + + print("Operation status: {}".format(result.status)) + print("Operation created on: {}".format(result.created_on)) + print("Operation last updated on: {}".format(result.last_updated_on)) + print("Total number of translations on documents: {}".format(result.documents_total_count)) + + print("\nOf total documents...") + print("{} failed".format(result.documents_failed_count)) + print("{} succeeded".format(result.documents_succeeded_count)) + + doc_results = client.list_all_document_statuses(result.id) + async for document in doc_results: + print("Document ID: {}".format(document.id)) + print("Document status: {}".format(document.status)) + if document.status == "Succeeded": + print("Source document location: {}".format(document.source_document_url)) + print("Translated document location: {}".format(document.translated_document_url)) + print("Translated to language: {}\n".format(document.translate_to)) + else: + print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message)) + + +async def main(): + await sample_translation_with_custom_model_async() + +if __name__ == '__main__': + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) diff --git a/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py b/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py new file mode 100644 index 000000000000..cf73444961b2 --- /dev/null +++ b/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +""" +FILE: sample_translation_with_custom_model.py + +DESCRIPTION: + This sample demonstrates how to create a translation operation and apply custom azure translation model when doing the translation. + + To set up your containers for translation and generate SAS tokens to your containers (or files) + with the appropriate permissions, see the README. + +USAGE: + python sample_translation_with_custom_model.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_DOCUMENT_TRANSLATION_ENDPOINT - the endpoint to your Document Translation resource. + 2) AZURE_DOCUMENT_TRANSLATION_KEY - your Document Translation API key. + 3) AZURE_SOURCE_CONTAINER_URL - the container SAS URL to your source container which has the documents + to be translated. + 4) AZURE_TARGET_CONTAINER_URL - the container SAS URL to your target container where the translated documents + will be written. + 5) AZURE_CUSTOM_MODEL_ID - the URL to your Azure custom translation model. +""" + + +def sample_translation_with_custom_model(): + import os + from azure.core.credentials import AzureKeyCredential + from azure.ai.translation.document import ( + DocumentTranslationClient + ) + + endpoint = os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"] + key = os.environ["AZURE_DOCUMENT_TRANSLATION_KEY"] + source_container_url = os.environ["AZURE_SOURCE_CONTAINER_URL"] + target_container_url = os.environ["AZURE_TARGET_CONTAINER_URL"] + custom_model_id = os.environ["AZURE_CUSTOM_MODEL_ID"] + + client = DocumentTranslationClient(endpoint, AzureKeyCredential(key)) + + poller = client.begin_translation( + source_container_url, + target_container_url, + "es", + category_id=custom_model_id + ) + result = poller.result() + + print("Operation status: {}".format(result.status)) + print("Operation created on: {}".format(result.created_on)) + print("Operation last updated on: {}".format(result.last_updated_on)) + print("Total number of translations on documents: {}".format(result.documents_total_count)) + + print("\nOf total documents...") + print("{} failed".format(result.documents_failed_count)) + print("{} succeeded".format(result.documents_succeeded_count)) + + doc_results = client.list_all_document_statuses(result.id) + for document in doc_results: + print("Document ID: {}".format(document.id)) + print("Document status: {}".format(document.status)) + if document.status == "Succeeded": + print("Source document location: {}".format(document.source_document_url)) + print("Translated document location: {}".format(document.translated_document_url)) + print("Translated to language: {}\n".format(document.translate_to)) + else: + print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message)) + + +if __name__ == '__main__': + sample_translation_with_custom_model() From cfbc9396e572a044d6e761d4909cfb9ee2cd917d Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Wed, 25 Aug 2021 08:08:28 +0800 Subject: [PATCH 14/16] [purview account] first release for azure-purview-account (#20335) * purview account * CI * verion-tolerant * endpoint order * add test for collections * Update CHANGELOG.md * review * update reamdme --- eng/.docsettings.yml | 1 + eng/tox/allowed_pylint_failures.py | 1 + .../azure-purview-account/CHANGELOG.md | 5 + sdk/purview/azure-purview-account/MANIFEST.in | 5 + sdk/purview/azure-purview-account/README.md | 151 +++ .../azure-purview-account/azure/__init__.py | 1 + .../azure/purview/__init__.py | 1 + .../azure/purview/account/__init__.py | 19 + .../azure/purview/account/_configuration.py | 70 ++ .../account/_purview_account_client.py | 103 ++ .../azure/purview/account/_version.py | 9 + .../azure/purview/account/aio/__init__.py | 10 + .../purview/account/aio/_configuration.py | 66 ++ .../account/aio/_purview_account_client.py | 98 ++ .../account/aio/operations/__init__.py | 17 + .../aio/operations/_accounts_operations.py | 409 ++++++++ .../aio/operations/_collections_operations.py | 519 ++++++++++ .../_resource_set_rules_operations.py | 786 +++++++++++++++ .../purview/account/operations/__init__.py | 17 + .../operations/_accounts_operations.py | 531 ++++++++++ .../operations/_collections_operations.py | 729 ++++++++++++++ .../_resource_set_rules_operations.py | 907 ++++++++++++++++++ .../azure/purview/account/py.typed | 1 + .../dev_requirements.txt | 6 + .../azure-purview-account/sdk_packaging.toml | 9 + sdk/purview/azure-purview-account/setup.cfg | 2 + sdk/purview/azure-purview-account/setup.py | 89 ++ .../azure-purview-account/swagger/README.md | 36 + .../azure-purview-account/tests/_util.py | 25 + .../azure-purview-account/tests/conftest.py | 15 + .../test_smoke.test_basic_smoke_test.yaml | 34 + .../test_smoke.test_collections_list.yaml | 34 + ...est_smoke_async.test_basic_smoke_test.yaml | 24 + ...est_smoke_async.test_collections_list.yaml | 26 + .../azure-purview-account/tests/test_smoke.py | 27 + .../tests/test_smoke_async.py | 28 + .../azure-purview-account/tests/testcase.py | 29 + .../tests/testcase_async.py | 21 + sdk/purview/ci.yml | 2 + shared_requirements.txt | 2 + 40 files changed, 4865 insertions(+) create mode 100644 sdk/purview/azure-purview-account/CHANGELOG.md create mode 100644 sdk/purview/azure-purview-account/MANIFEST.in create mode 100644 sdk/purview/azure-purview-account/README.md create mode 100644 sdk/purview/azure-purview-account/azure/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_configuration.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/_version.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py create mode 100644 sdk/purview/azure-purview-account/azure/purview/account/py.typed create mode 100644 sdk/purview/azure-purview-account/dev_requirements.txt create mode 100644 sdk/purview/azure-purview-account/sdk_packaging.toml create mode 100644 sdk/purview/azure-purview-account/setup.cfg create mode 100644 sdk/purview/azure-purview-account/setup.py create mode 100644 sdk/purview/azure-purview-account/swagger/README.md create mode 100644 sdk/purview/azure-purview-account/tests/_util.py create mode 100644 sdk/purview/azure-purview-account/tests/conftest.py create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml create mode 100644 sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml create mode 100644 sdk/purview/azure-purview-account/tests/test_smoke.py create mode 100644 sdk/purview/azure-purview-account/tests/test_smoke_async.py create mode 100644 sdk/purview/azure-purview-account/tests/testcase.py create mode 100644 sdk/purview/azure-purview-account/tests/testcase_async.py diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 0b43cf516b57..88bc934a04cc 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -92,6 +92,7 @@ known_content_issues: - ['sdk/purview/azure-purview-catalog/swagger/README.md',  '#4554'] - ['sdk/purview/azure-purview-scanning/swagger/README.md',  '#4554'] - ['sdk/agrifood/azure-agrifood-farming/swagger/README.md',  '#4554'] + - ['sdk/purview/azure-purview-account/swagger/README.md', '#4554'] - ['sdk/containerregistry/azure-containerregistry/swagger/README.md', '#4554'] - ['sdk/appconfiguration/azure-appconfiguration/swagger/README.md', '#4554'] - ['sdk/attestation/azure-security-attestation/swagger/README.md', '#4554'] diff --git a/eng/tox/allowed_pylint_failures.py b/eng/tox/allowed_pylint_failures.py index b7a9fe1a1762..c929b50632ab 100644 --- a/eng/tox/allowed_pylint_failures.py +++ b/eng/tox/allowed_pylint_failures.py @@ -54,6 +54,7 @@ "azure-purview-nspkg", "azure-purview-scanning", "azure-purview-catalog", + "azure-purview-account", "azure-messaging-nspkg", "azure-agrifood-farming", "azure-eventhub", diff --git a/sdk/purview/azure-purview-account/CHANGELOG.md b/sdk/purview/azure-purview-account/CHANGELOG.md new file mode 100644 index 000000000000..4e25394e1429 --- /dev/null +++ b/sdk/purview/azure-purview-account/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-08-23) + +- This is the initial release of the Azure Purview Account library. diff --git a/sdk/purview/azure-purview-account/MANIFEST.in b/sdk/purview/azure-purview-account/MANIFEST.in new file mode 100644 index 000000000000..f15ff0ee5293 --- /dev/null +++ b/sdk/purview/azure-purview-account/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py +recursive-include samples *.py *.md +include *.md +include azure/__init__.py +include azure/purview/__init__.py \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/README.md b/sdk/purview/azure-purview-account/README.md new file mode 100644 index 000000000000..9e768852a853 --- /dev/null +++ b/sdk/purview/azure-purview-account/README.md @@ -0,0 +1,151 @@ +# Azure Purview Account client library for Python + +Azure Purview Account is a fully managed cloud service. + +**Please rely heavily on the [service's documentation][account_product_documentation] and our [client docs][request_builders_and_client] to use this library** + +[Source code][source_code] | [Package (PyPI)][account_pypi] | [API reference documentation][account_ref_docs]| [Product documentation][account_product_documentation] + +## Getting started + +### Prerequisites + +- Python 2.7, or 3.6 or later is required to use this package. +- You must have an [Azure subscription][azure_subscription] and a [Purview][purview_resource] to use this package. + +#### Create a Purview Resource + +Follow [these][purview_resource] instructions to create your Purview resource + +### Install the package + +Install the Azure Purview Account client library for Python with [pip][pip]: + +```bash +pip install azure-purview-account +``` + +### Authenticate the client + +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], +provide an instance of the desired credential type obtained from the +[azure-identity][azure_identity_credentials] library. + +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] and +[enable AAD authentication on your Purview resource][enable_aad] + +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. +As an example, [DefaultAzureCredential][default_azure_credential] +can be used to authenticate the client: + +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: +AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET + +Use the returned token credential to authenticate the client: + +```python +from azure.purview.account import PurviewAccountClient +from azure.identity import DefaultAzureCredential + +credential = DefaultAzureCredential() +client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) +``` + +## Key concepts + +### Client + +## Examples + +The following section shows you how to initialize and authenticate your client, then list all of your keys. + +- [Get Keys](#get-keys "Get All Keys") + +### Get Keys + +```python +from azure.purview.account import PurviewAccountClient +from azure.identity import DefaultAzureCredential + +credential = DefaultAzureCredential() +client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) +response = client.accounts.get_access_keys() +print(response) +``` + +## Troubleshooting + +### General + +The Purview Account client will raise exceptions if status code of your responses is not defined. + +### Logging + +This library uses the standard +[logging][python_logging] library for logging. +Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO +level. + +Detailed DEBUG level logging, including request/response bodies and unredacted +headers, can be enabled on a client with the `logging_enable` keyword argument: + +```python +import sys +import logging +from azure.identity import DefaultAzureCredential +from azure.purview.account import PurviewAccountClient + +# Create a logger for the 'azure' SDK +logger = logging.getLogger('azure') +logger.setLevel(logging.DEBUG) + +# Configure a console output +handler = logging.StreamHandler(stream=sys.stdout) +logger.addHandler(handler) + +endpoint = "https://.purview.azure.com" +credential = DefaultAzureCredential() + +# This client will log detailed information about its HTTP sessions, at DEBUG level +client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True) +``` + +Similarly, `logging_enable` can enable detailed logging for a single call, +even when it isn't enabled for the client: + +```python +result = client.accounts.get_access_keys(logging_enable=True) +``` + +## Next steps + +For more generic samples, see our [client docs][request_builders_and_client]. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla]. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. + + + +[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/purview/ +[account_pypi]: https://pypi.org/project/azure-purview-catalog/#history +[account_ref_docs]: https://azure.github.io/azure-sdk-for-python/ +[account_product_documentation]: https://azure.microsoft.com/services/purview/ +[azure_subscription]: https://azure.microsoft.com/free/ +[purview_resource]: https://docs.microsoft.com/azure/purview/create-catalog-portal +[pip]: https://pypi.org/project/pip/ +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[azure_identity_pip]: https://pypi.org/project/azure-identity/ +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential +[request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart +[enable_aad]: https://docs.microsoft.com/azure/purview/create-catalog-portal#add-a-security-principal-to-a-data-plane-role +[python_logging]: https://docs.python.org/3.5/library/logging.html +[cla]: https://cla.microsoft.com +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com diff --git a/sdk/purview/azure-purview-account/azure/__init__.py b/sdk/purview/azure-purview-account/azure/__init__.py new file mode 100644 index 000000000000..5960c353a898 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/__init__.py b/sdk/purview/azure-purview-account/azure/purview/__init__.py new file mode 100644 index 000000000000..5960c353a898 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/azure/purview/account/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/__init__.py new file mode 100644 index 000000000000..d5c53ba7d43e --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._purview_account_client import PurviewAccountClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['PurviewAccountClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py new file mode 100644 index 000000000000..74582061d3e2 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_configuration.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class PurviewAccountClientConfiguration(Configuration): + """Configuration for PurviewAccountClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + """ + + def __init__( + self, + endpoint, # type: str + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(PurviewAccountClientConfiguration, self).__init__(**kwargs) + + self.endpoint = endpoint + self.credential = credential + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) + kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py new file mode 100644 index 000000000000..62c1ff6f00c0 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_purview_account_client.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +from ._configuration import PurviewAccountClientConfiguration +from .operations import AccountsOperations, CollectionsOperations, ResourceSetRulesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Dict, Optional + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class PurviewAccountClient(object): + """Creates a Microsoft.Purview data plane account client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.purview.account.operations.AccountsOperations + :ivar collections: CollectionsOperations operations + :vartype collections: azure.purview.account.operations.CollectionsOperations + :ivar resource_set_rules: ResourceSetRulesOperations operations + :vartype resource_set_rules: azure.purview.account.operations.ResourceSetRulesOperations + :param endpoint: The account endpoint of your Purview account. Example: + https://{accountName}.purview.azure.com/account/. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + """ + + def __init__( + self, + endpoint, # type: str + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + _endpoint = '{endpoint}' + self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.collections = CollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_set_rules = ResourceSetRulesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `azure.purview.account.rest`. + Use these helper methods to create the request you pass to this method. + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest` + and pass it in. + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> PurviewAccountClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/_version.py b/sdk/purview/azure-purview-account/azure/purview/account/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py new file mode 100644 index 000000000000..1e668f62d8c2 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._purview_account_client import PurviewAccountClient +__all__ = ['PurviewAccountClient'] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py new file mode 100644 index 000000000000..655f01975acb --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_configuration.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class PurviewAccountClientConfiguration(Configuration): + """Configuration for PurviewAccountClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + endpoint: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(PurviewAccountClientConfiguration, self).__init__(**kwargs) + + self.endpoint = endpoint + self.credential = credential + self.api_version = "2019-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://purview.azure.net/.default']) + kwargs.setdefault('sdk_moniker', 'purview-account/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py new file mode 100644 index 000000000000..80968f3291bd --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/_purview_account_client.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +from ._configuration import PurviewAccountClientConfiguration +from .operations import AccountsOperations, CollectionsOperations, ResourceSetRulesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Dict + + from azure.core.credentials_async import AsyncTokenCredential + +class PurviewAccountClient: + """Creates a Microsoft.Purview data plane account client. + + :ivar accounts: AccountsOperations operations + :vartype accounts: azure.purview.account.aio.operations.AccountsOperations + :ivar collections: CollectionsOperations operations + :vartype collections: azure.purview.account.aio.operations.CollectionsOperations + :ivar resource_set_rules: ResourceSetRulesOperations operations + :vartype resource_set_rules: azure.purview.account.aio.operations.ResourceSetRulesOperations + :param endpoint: The account endpoint of your Purview account. Example: + https://{accountName}.purview.azure.com/account/. + :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + endpoint: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + _endpoint = '{endpoint}' + self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.collections = CollectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.resource_set_rules = ResourceSetRulesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + We have helper methods to create requests specific to this service in `azure.purview.account.rest`. + Use these helper methods to create the request you pass to this method. + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest` + and pass it in. + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "PurviewAccountClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py new file mode 100644 index 000000000000..9b3934fb09cb --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._collections_operations import CollectionsOperations +from ._resource_set_rules_operations import ResourceSetRulesOperations + +__all__ = [ + 'AccountsOperations', + 'CollectionsOperations', + 'ResourceSetRulesOperations', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py new file mode 100644 index 000000000000..259b91c66b10 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_accounts_operations.py @@ -0,0 +1,409 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._accounts_operations import build_get_access_keys_request, build_get_account_properties_request, build_regenerate_access_key_request, build_update_account_properties_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AccountsOperations: + """AccountsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_account_properties( + self, + **kwargs: Any + ) -> Any: + """Get an account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_account_properties_request( + template_url=self.get_account_properties.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace_async + async def update_account_properties( + self, + account_update_parameters: Any, + **kwargs: Any + ) -> Any: + """Updates an account. + + :param account_update_parameters: + :type account_update_parameters: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + account_update_parameters = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = account_update_parameters + + request = build_update_account_properties_request( + content_type=content_type, + json=json, + template_url=self.update_account_properties.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace_async + async def get_access_keys( + self, + **kwargs: Any + ) -> Any: + """List the authorization keys associated with this account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_access_keys_request( + template_url=self.get_access_keys.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_keys.metadata = {'url': '/listkeys'} # type: ignore + + + @distributed_trace_async + async def regenerate_access_key( + self, + key_options: Any, + **kwargs: Any + ) -> Any: + """Regenerate the authorization keys associated with this data catalog. + + :param key_options: + :type key_options: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + key_options = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = key_options + + request = build_regenerate_access_key_request( + content_type=content_type, + json=json, + template_url=self.regenerate_access_key.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_access_key.metadata = {'url': '/regeneratekeys'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py new file mode 100644 index 000000000000..d2bd035f7fe4 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_collections_operations.py @@ -0,0 +1,519 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._collections_operations import build_create_or_update_collection_request, build_delete_collection_request, build_get_collection_path_request, build_get_collection_request, build_list_child_collection_names_request, build_list_collections_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CollectionsOperations: + """CollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_collection( + self, + collection_name: str, + **kwargs: Any + ) -> Any: + """Get a collection. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_request( + collection_name=collection_name, + template_url=self.get_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update_collection( + self, + collection_name: str, + collection: Any, + **kwargs: Any + ) -> Any: + """Creates or updates a collection entity. + + :param collection_name: + :type collection_name: str + :param collection: + :type collection: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + collection = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = collection + + request = build_create_or_update_collection_request( + collection_name=collection_name, + content_type=content_type, + json=json, + template_url=self.create_or_update_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace_async + async def delete_collection( + self, + collection_name: str, + **kwargs: Any + ) -> None: + """Deletes a Collection entity. + + :param collection_name: + :type collection_name: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_collection_request( + collection_name=collection_name, + template_url=self.delete_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def list_collections( + self, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """List the collections in the account. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=self.list_collections.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_collections.metadata = {'url': '/collections'} # type: ignore + + @distributed_trace + def list_child_collection_names( + self, + collection_name: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """Lists the child collections names in the collection. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=self.list_child_collection_names.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_child_collection_names.metadata = {'url': '/collections/{collectionName}/getChildCollectionNames'} # type: ignore + + @distributed_trace_async + async def get_collection_path( + self, + collection_name: str, + **kwargs: Any + ) -> Any: + """Gets the parent name and parent friendly name chains that represent the collection path. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_path_request( + collection_name=collection_name, + template_url=self.get_collection_path.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection_path.metadata = {'url': '/collections/{collectionName}/getCollectionPath'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py new file mode 100644 index 000000000000..5a2156c7e9e6 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/aio/operations/_resource_set_rules_operations.py @@ -0,0 +1,786 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...operations._resource_set_rules_operations import build_create_or_update_resource_set_rule_request, build_delete_resource_set_rule_request, build_get_resource_set_rule_request, build_list_resource_set_rules_request + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResourceSetRulesOperations: + """ResourceSetRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_resource_set_rule( + self, + **kwargs: Any + ) -> Any: + """Get a resource set config service model. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_set_rule_request( + template_url=self.get_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace_async + async def create_or_update_resource_set_rule( + self, + resource_set_rule_config: Any, + **kwargs: Any + ) -> Any: + """Creates or updates an resource set config. + + :param resource_set_rule_config: + :type resource_set_rule_config: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource_set_rule_config = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = resource_set_rule_config + + request = build_create_or_update_resource_set_rule_request( + content_type=content_type, + json=json, + template_url=self.create_or_update_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace_async + async def delete_resource_set_rule( + self, + **kwargs: Any + ) -> None: + """Deletes a ResourceSetRuleConfig resource. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_resource_set_rule_request( + template_url=self.delete_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def list_resource_set_rules( + self, + *, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable[Any]: + """Get a resource set config service model. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.async_paging.AsyncItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=self.list_resource_set_rules.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_resource_set_rules.metadata = {'url': '/resourceSetRuleConfigs'} # type: ignore diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py new file mode 100644 index 000000000000..9b3934fb09cb --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/__init__.py @@ -0,0 +1,17 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._accounts_operations import AccountsOperations +from ._collections_operations import CollectionsOperations +from ._resource_set_rules_operations import ResourceSetRulesOperations + +__all__ = [ + 'AccountsOperations', + 'CollectionsOperations', + 'ResourceSetRulesOperations', +] diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py new file mode 100644 index 000000000000..4694fce07df3 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_accounts_operations.py @@ -0,0 +1,531 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_account_properties_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_access_keys_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/listkeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_access_key_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/regeneratekeys') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class AccountsOperations(object): + """AccountsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_account_properties( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """Get an account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_account_properties_request( + template_url=self.get_account_properties.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace + def update_account_properties( + self, + account_update_parameters, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Updates an account. + + :param account_update_parameters: + :type account_update_parameters: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + account_update_parameters = { + "friendlyName": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "id": "str (optional)", + "identity": { + "principalId": "str (optional)", + "tenantId": "str (optional)", + "type": "str (optional)" + }, + "location": "str (optional)", + "name": "str (optional)", + "properties": { + "cloudConnectors": { + "awsExternalId": "str (optional)" + }, + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByObjectId": "str (optional)", + "endpoints": { + "catalog": "str (optional)", + "guardian": "str (optional)", + "scan": "str (optional)" + }, + "friendlyName": "str (optional)", + "managedResourceGroupName": "str (optional)", + "managedResources": { + "eventHubNamespace": "str (optional)", + "resourceGroup": "str (optional)", + "storageAccount": "str (optional)" + }, + "privateEndpointConnections": [ + { + "id": "str (optional)", + "name": "str (optional)", + "properties": { + "privateEndpoint": { + "id": "str (optional)" + }, + "privateLinkServiceConnectionState": { + "actionsRequired": "str (optional)", + "description": "str (optional)", + "status": "str (optional)" + }, + "provisioningState": "str (optional)" + }, + "type": "str (optional)" + } + ], + "provisioningState": "str (optional)", + "publicNetworkAccess": "str (optional). Default value is \"Enabled\"" + }, + "sku": { + "capacity": "int (optional)", + "name": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + }, + "tags": { + "str": "str (optional)" + }, + "type": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = account_update_parameters + + request = build_update_account_properties_request( + content_type=content_type, + json=json, + template_url=self.update_account_properties.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_account_properties.metadata = {'url': '/'} # type: ignore + + + @distributed_trace + def get_access_keys( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """List the authorization keys associated with this account. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_access_keys_request( + template_url=self.get_access_keys.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_keys.metadata = {'url': '/listkeys'} # type: ignore + + + @distributed_trace + def regenerate_access_key( + self, + key_options, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Regenerate the authorization keys associated with this data catalog. + + :param key_options: + :type key_options: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + key_options = { + "keyType": "str (optional)" + } + + # response body for status code(s): 200 + response.json() == { + "atlasKafkaPrimaryEndpoint": "str (optional)", + "atlasKafkaSecondaryEndpoint": "str (optional)" + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = key_options + + request = build_regenerate_access_key_request( + content_type=content_type, + json=json, + template_url=self.regenerate_access_key.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_access_key.metadata = {'url': '/regeneratekeys'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py new file mode 100644 index 000000000000..73d946a278a0 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_collections_operations.py @@ -0,0 +1,729 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport._base import _format_url_section +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_collection_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_collections_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_child_collection_names_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getChildCollectionNames') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_collection_path_request( + collection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/collections/{collectionName}/getCollectionPath') + path_format_arguments = { + "collectionName": _SERIALIZER.url("collection_name", collection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class CollectionsOperations(object): + """CollectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_collection( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + """Get a collection. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_request( + collection_name=collection_name, + template_url=self.get_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def create_or_update_collection( + self, + collection_name, # type: str + collection, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Creates or updates a collection entity. + + :param collection_name: + :type collection_name: str + :param collection: + :type collection: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + collection = { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + + # response body for status code(s): 200 + response.json() == { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = collection + + request = build_create_or_update_collection_request( + collection_name=collection_name, + content_type=content_type, + json=json, + template_url=self.create_or_update_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def delete_collection( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Collection entity. + + :param collection_name: + :type collection_name: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_collection_request( + collection_name=collection_name, + template_url=self.delete_collection.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_collection.metadata = {'url': '/collections/{collectionName}'} # type: ignore + + + @distributed_trace + def list_collections( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """List the collections in the account. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "collectionProvisioningState": "str (optional)", + "description": "str (optional)", + "friendlyName": "str (optional)", + "name": "str (optional)", + "parentCollection": { + "referenceName": "str (optional)", + "type": "str (optional)" + }, + "systemData": { + "createdAt": "datetime (optional)", + "createdBy": "str (optional)", + "createdByType": "str (optional)", + "lastModifiedAt": "datetime (optional)", + "lastModifiedBy": "str (optional)", + "lastModifiedByType": "str (optional)" + } + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=self.list_collections.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_collections_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_collections.metadata = {'url': '/collections'} # type: ignore + + @distributed_trace + def list_child_collection_names( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """Lists the child collections names in the collection. + + :param collection_name: + :type collection_name: str + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "friendlyName": "str (optional)", + "name": "str (optional)" + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=self.list_child_collection_names.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_child_collection_names_request( + collection_name=collection_name, + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_child_collection_names.metadata = {'url': '/collections/{collectionName}/getChildCollectionNames'} # type: ignore + + @distributed_trace + def get_collection_path( + self, + collection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Any + """Gets the parent name and parent friendly name chains that represent the collection path. + + :param collection_name: + :type collection_name: str + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "parentFriendlyNameChain": [ + "str (optional)" + ], + "parentNameChain": [ + "str (optional)" + ] + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_collection_path_request( + collection_name=collection_name, + template_url=self.get_collection_path.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_collection_path.metadata = {'url': '/collections/{collectionName}/getCollectionPath'} # type: ignore + diff --git a/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py b/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py new file mode 100644 index 000000000000..4e65e11cab96 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/operations/_resource_set_rules_operations.py @@ -0,0 +1,907 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from json import loads as _loads +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from msrest import Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +# fmt: off + +def build_get_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_resource_set_rule_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs/defaultResourceSetRuleConfig') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_resource_set_rules_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + api_version = "2019-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/resourceSetRuleConfigs') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class ResourceSetRulesOperations(object): + """ResourceSetRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_resource_set_rule( + self, + **kwargs # type: Any + ): + # type: (...) -> Any + """Get a resource set config service model. + + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_set_rule_request( + template_url=self.get_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def create_or_update_resource_set_rule( + self, + resource_set_rule_config, # type: Any + **kwargs # type: Any + ): + # type: (...) -> Any + """Creates or updates an resource set config. + + :param resource_set_rule_config: + :type resource_set_rule_config: Any + :return: JSON object + :rtype: Any + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + resource_set_rule_config = { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + + # response body for status code(s): 200 + response.json() == { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + """ + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + json = resource_set_rule_config + + request = build_create_or_update_resource_set_rule_request( + content_type=content_type, + json=json, + template_url=self.create_or_update_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def delete_resource_set_rule( + self, + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a ResourceSetRuleConfig resource. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_resource_set_rule_request( + template_url=self.delete_resource_set_rule.metadata['url'], + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) + + delete_resource_set_rule.metadata = {'url': '/resourceSetRuleConfigs/defaultResourceSetRuleConfig'} # type: ignore + + + @distributed_trace + def list_resource_set_rules( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable[Any] + """Get a resource set config service model. + + :keyword skip_token: + :paramtype skip_token: str + :return: An iterator like instance of JSON object + :rtype: ~azure.core.paging.ItemPaged[Any] + :raises: ~azure.core.exceptions.HttpResponseError + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response.json() == { + "count": "long (optional)", + "nextLink": "str (optional)", + "value": [ + { + "advancedResourceSet": { + "modifiedAt": "datetime (optional)", + "resourceSetProcessing": "str (optional)" + }, + "name": "str (optional)", + "pathPatternConfig": { + "acceptedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "complexReplacers": [ + { + "createdBy": "str (optional)", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool (optional)", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional)", + "name": "str (optional)", + "typeName": "str (optional)" + } + ], + "createdBy": "str", + "enableDefaultPatterns": "bool", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "normalizationRules": [ + { + "description": "str (optional)", + "disabled": "bool (optional)", + "dynamicReplacement": "bool (optional)", + "entityTypes": [ + "str (optional)" + ], + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)", + "version": "float (optional)" + } + ], + "regexReplacers": [ + { + "condition": "str (optional)", + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "description": "str (optional)", + "disableRecursiveReplacerApplication": "bool (optional)", + "disabled": "bool", + "doNotReplaceRegex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "regex": { + "maxDigits": "int (optional)", + "maxLetters": "int (optional)", + "minDashes": "int (optional)", + "minDigits": "int (optional)", + "minDigitsOrLetters": "int (optional)", + "minDots": "int (optional)", + "minHex": "int (optional)", + "minLetters": "int (optional)", + "minUnderscores": "int (optional)", + "options": "int (optional)", + "regexStr": "str (optional)" + }, + "replaceWith": "str (optional)" + } + ], + "rejectedPatterns": [ + { + "createdBy": "str (optional). Default value is \"AzureDataCatalog\"", + "filterType": "str (optional). Default value is \"Pattern\"", + "lastUpdatedTimestamp": "long (optional)", + "modifiedBy": "str (optional). Default value is \"AzureDataCatalog\"", + "name": "str", + "path": "str" + } + ], + "scopedRules": [ + { + "bindingUrl": "str", + "rules": [ + { + "displayName": "str (optional)", + "isResourceSet": "bool (optional). Default value is True", + "lastUpdatedTimestamp": "long (optional)", + "name": "str (optional)", + "qualifiedName": "str" + } + ], + "storeType": "str" + } + ], + "version": "int (optional). Default value is 0" + } + } + ] + } + """ + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=self.list_resource_set_rules.metadata['url'], + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_resource_set_rules_request( + skip_token=skip_token, + template_url=next_link, + )._to_pipeline_transport_request() + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = _loads(pipeline_response.http_response.body()) + list_of_elem = deserialized["value"] + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.get("nextLink", None), iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_resource_set_rules.metadata = {'url': '/resourceSetRuleConfigs'} # type: ignore diff --git a/sdk/purview/azure-purview-account/azure/purview/account/py.typed b/sdk/purview/azure-purview-account/azure/purview/account/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/purview/azure-purview-account/azure/purview/account/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/dev_requirements.txt b/sdk/purview/azure-purview-account/dev_requirements.txt new file mode 100644 index 000000000000..60e6d0eeff43 --- /dev/null +++ b/sdk/purview/azure-purview-account/dev_requirements.txt @@ -0,0 +1,6 @@ +-e ../../../tools/azure-sdk-tools +-e ../../../tools/azure-devtools +../../core/azure-core +-e ../../identity/azure-identity +../../nspkg/azure-purview-nspkg +aiohttp>=3.0; python_version >= '3.5' \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/sdk_packaging.toml b/sdk/purview/azure-purview-account/sdk_packaging.toml new file mode 100644 index 000000000000..6f823f446798 --- /dev/null +++ b/sdk/purview/azure-purview-account/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +auto_update = false +package_name = "azure-purview-account" +package_pprint_name = "Azure Purview Account" +is_stable = false +is_arm = false + +# Package owners should uncomment and set this doc id. +# package_doc_id = "purview-account" \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/setup.cfg b/sdk/purview/azure-purview-account/setup.cfg new file mode 100644 index 000000000000..3480374bc2f2 --- /dev/null +++ b/sdk/purview/azure-purview-account/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/setup.py b/sdk/purview/azure-purview-account/setup.py new file mode 100644 index 000000000000..43175e611ea0 --- /dev/null +++ b/sdk/purview/azure-purview-account/setup.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-purview-account" +PACKAGE_PPRINT_NAME = "Azure Purview Account" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + "Development Status :: 4 - Beta", + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.purview', + ]), + install_requires=[ + "azure-core<2.0.0,>=1.16.0", + "msrest>=0.6.21", + 'six>=1.11.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-purview-nspkg'], + ":python_version<'3.5'": ['typing'], + } +) \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/swagger/README.md b/sdk/purview/azure-purview-account/swagger/README.md new file mode 100644 index 000000000000..a863f80392a6 --- /dev/null +++ b/sdk/purview/azure-purview-account/swagger/README.md @@ -0,0 +1,36 @@ +# Azure Purview for Python + +> see https://aka.ms/autorest + +### Setup + +Install Autorest v3 + +```ps +npm install -g autorest +``` + +### Generation + +```ps +cd +autorest +``` + +### Settings + +```yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json +output-folder: ../azure/purview/account +namespace: azure.purview.account +package-name: azure-purview-account +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +no-namespace-folders: true +python: true +title: PurviewAccountClient +version-tolerant: true +package-version: 1.0.0b1 +add-credential: true +credential-scopes: https://purview.azure.net/.default +``` diff --git a/sdk/purview/azure-purview-account/tests/_util.py b/sdk/purview/azure-purview-account/tests/_util.py new file mode 100644 index 000000000000..2f45bd9149a5 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/_util.py @@ -0,0 +1,25 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure_devtools.scenario_tests import RecordingProcessor +import json + + +class PurviewAccountRecordingProcessor(RecordingProcessor): + def process_response(self, response): + response["body"]["string"] = '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + return response + + +class PurviewAccountCollectionsRecordingProcessor(RecordingProcessor): + def process_response(self, response): + try: + body = json.loads(response["body"]["string"]) + for value in body["value"]: + value["systemData"] = "000" + response["body"]["string"] = json.dumps(body) + finally: + return response diff --git a/sdk/purview/azure-purview-account/tests/conftest.py b/sdk/purview/azure-purview-account/tests/conftest.py new file mode 100644 index 000000000000..a6ab83f7f5f0 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/conftest.py @@ -0,0 +1,15 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import sys + +# fixture needs to be visible from conftest + +# Ignore async tests for Python < 3.5 +collect_ignore_glob = [] +if sys.version_info < (3, 5): + collect_ignore_glob.append("*_async.py") \ No newline at end of file diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml new file mode 100644 index 000000000000..ccfa4efef067 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_basic_smoke_test.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://fake_account.account.purview.azure.com/listkeys?api-version=2019-11-01-preview + response: + body: + string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Aug 2021 03:00:07 GMT + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml new file mode 100644 index 000000000000..a9c39433f1e5 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke.test_collections_list.yaml @@ -0,0 +1,34 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://fake_account.account.purview.azure.com/collections?api-version=2019-11-01-preview + response: + body: + string: '{"value": [{"name": "purview-msyyc", "friendlyName": "purview-msyyc", + "description": "The root collection.", "systemData": "000", "collectionProvisioningState": + "Succeeded"}], "count": 1}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Aug 2021 03:00:09 GMT + server: + - Kestrel + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml new file mode 100644 index 000000000000..480b26a80f6c --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_basic_smoke_test.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://fake_account.account.purview.azure.com/listkeys?api-version=2019-11-01-preview + response: + body: + string: '{"atlasKafkaPrimaryEndpoint":"000","atlasKafkaSecondaryEndpoint":"000"}' + headers: + content-type: application/json; charset=utf-8 + date: Tue, 24 Aug 2021 03:00:26 GMT + server: Kestrel + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://purview-msyyc.purview.azure.com/listkeys?api-version=2019-11-01-preview +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml new file mode 100644 index 000000000000..c0a4f323f0cc --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/recordings/test_smoke_async.test_collections_list.yaml @@ -0,0 +1,26 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-purview-account/1.0.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://fake_account.account.purview.azure.com/collections?api-version=2019-11-01-preview + response: + body: + string: '{"value": [{"name": "purview-msyyc", "friendlyName": "purview-msyyc", + "description": "The root collection.", "systemData": "000", "collectionProvisioningState": + "Succeeded"}], "count": 1}' + headers: + content-type: application/json; charset=utf-8 + date: Tue, 24 Aug 2021 03:00:29 GMT + server: Kestrel + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://purview-msyyc.purview.azure.com/collections?api-version=2019-11-01-preview +version: 1 diff --git a/sdk/purview/azure-purview-account/tests/test_smoke.py b/sdk/purview/azure-purview-account/tests/test_smoke.py new file mode 100644 index 000000000000..104feb458b65 --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/test_smoke.py @@ -0,0 +1,27 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +from testcase import PurviewAccountTest, PurviewAccountPowerShellPreparer +from _util import PurviewAccountRecordingProcessor, PurviewAccountCollectionsRecordingProcessor + + +class PurviewAccountSmokeTest(PurviewAccountTest): + + @PurviewAccountPowerShellPreparer() + def test_basic_smoke_test(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountRecordingProcessor()) + client = self.create_client(endpoint=purviewaccount_endpoint) + response = client.accounts.get_access_keys() + assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) + + @PurviewAccountPowerShellPreparer() + def test_collections_list(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountCollectionsRecordingProcessor()) + client = self.create_client(endpoint=purviewaccount_endpoint) + response = client.collections.list_collections() + result = [item for item in response] + for item in result: + assert set(item.keys()) == set(['name', 'friendlyName', 'description', 'systemData', 'collectionProvisioningState']) diff --git a/sdk/purview/azure-purview-account/tests/test_smoke_async.py b/sdk/purview/azure-purview-account/tests/test_smoke_async.py new file mode 100644 index 000000000000..7d98e1042b5d --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/test_smoke_async.py @@ -0,0 +1,28 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +from testcase import PurviewAccountPowerShellPreparer +from testcase_async import PurviewAccountTestAsync +from _util import PurviewAccountRecordingProcessor, PurviewAccountCollectionsRecordingProcessor + + +class PurviewAccountSmokeTestAsync(PurviewAccountTestAsync): + + @PurviewAccountPowerShellPreparer() + async def test_basic_smoke_test(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountRecordingProcessor()) + client = self.create_async_client(endpoint=purviewaccount_endpoint) + response = await client.accounts.get_access_keys() + assert set(response.keys()) == set(['atlasKafkaPrimaryEndpoint', 'atlasKafkaSecondaryEndpoint']) + + @PurviewAccountPowerShellPreparer() + async def test_collections_list(self, purviewaccount_endpoint): + self.recording_processors.append(PurviewAccountCollectionsRecordingProcessor()) + client = self.create_async_client(endpoint=purviewaccount_endpoint) + response = client.collections.list_collections() + result = [item async for item in response] + for item in result: + assert set(item.keys()) == set(['name', 'friendlyName', 'description', 'systemData', 'collectionProvisioningState']) diff --git a/sdk/purview/azure-purview-account/tests/testcase.py b/sdk/purview/azure-purview-account/tests/testcase.py new file mode 100644 index 000000000000..1668f540b03c --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/testcase.py @@ -0,0 +1,29 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import functools +from devtools_testutils import AzureTestCase, PowerShellPreparer +from azure.purview.account import PurviewAccountClient + + +class PurviewAccountTest(AzureTestCase): + def __init__(self, method_name, **kwargs): + super(PurviewAccountTest, self).__init__(method_name, **kwargs) + + def create_client(self, endpoint): + credential = self.get_credential(PurviewAccountClient) + return self.create_client_from_credential( + PurviewAccountClient, + credential=credential, + endpoint=endpoint, + ) + + +PurviewAccountPowerShellPreparer = functools.partial( + PowerShellPreparer, + "purviewaccount", + purviewaccount_endpoint="https://fake_account.account.purview.azure.com" +) diff --git a/sdk/purview/azure-purview-account/tests/testcase_async.py b/sdk/purview/azure-purview-account/tests/testcase_async.py new file mode 100644 index 000000000000..0b45881ee9cc --- /dev/null +++ b/sdk/purview/azure-purview-account/tests/testcase_async.py @@ -0,0 +1,21 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from devtools_testutils import AzureTestCase +from azure.purview.account.aio import PurviewAccountClient as AsyncPurviewAccountClient + + +class PurviewAccountTestAsync(AzureTestCase): + def __init__(self, method_name, **kwargs): + super(PurviewAccountTestAsync, self).__init__(method_name, **kwargs) + + def create_async_client(self, endpoint): + credential = self.get_credential(AsyncPurviewAccountClient, is_async=True) + return self.create_client_from_credential( + AsyncPurviewAccountClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/purview/ci.yml b/sdk/purview/ci.yml index ec7853234383..2eac49904741 100644 --- a/sdk/purview/ci.yml +++ b/sdk/purview/ci.yml @@ -35,3 +35,5 @@ extends: safeName: azurepurviewscanning - name: azure-purview-catalog safeName: azurepurviewcatalog + - name: azure-purview-account + safeName: azurepurviewaccount diff --git a/shared_requirements.txt b/shared_requirements.txt index d100dfb35818..5daec10fa2d5 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -279,6 +279,8 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-resourcegraph msrest>=0.6.21 #override azure-purview-scanning azure-core<2.0.0,>=1.8.2 #override azure-purview-scanning msrest>=0.6.21 +#override azure-purview-account msrest>=0.6.21 +#override azure-purview-account azure-core<2.0.0,>=1.16.0 #override azure-mgmt-rdbms msrest>=0.6.21 #override azure-mgmt-peering msrest>=0.6.21 #override azure-mgmt-elastic msrest>=0.6.21 From 8920509cea96bd95740a4d3bcd7f216c2e574266 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 25 Aug 2021 08:55:05 -0700 Subject: [PATCH 15/16] skip custom translation model samples (#20414) --- scripts/devops_tasks/test_run_samples.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index 94f105587c9d..2dae08c2f310 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -123,6 +123,8 @@ "sample_list_translations_with_filters_async.py", "sample_list_document_statuses_with_filters.py", "sample_list_translations_with_filters.py", + "sample_translation_with_custom_model.py", + "sample_translation_with_custom_model_async.py", ] } From 37cb22cffbb65a27a4f50d01b2038071cee9d63f Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Wed, 25 Aug 2021 09:25:44 -0700 Subject: [PATCH 16/16] Address API view issues (#20407) * logs client * lc-2 * models changes * more changes * more changes * more arch changes * changelog * tests * lint * fix tests * timespan --- sdk/monitor/azure-monitor-query/CHANGELOG.md | 5 + .../azure/monitor/query/__init__.py | 4 +- .../azure/monitor/query/_helpers.py | 2 +- .../azure/monitor/query/_logs_query_client.py | 22 +- .../monitor/query/_metrics_query_client.py | 22 +- .../azure/monitor/query/_models.py | 172 ++++++----- .../query/aio/_logs_query_client_async.py | 9 +- .../query/aio/_metrics_query_client_async.py | 24 +- .../sample_metrics_query_client_async.py | 17 +- .../samples/champion_scenarios.md | 288 ++++++++++++++++++ .../samples/sample_batch_query.py | 11 +- .../samples/sample_log_query_client.py | 13 +- .../samples/sample_metrics_query_client.py | 22 +- .../tests/async/test_logs_client_async.py | 26 ++ .../tests/async/test_metrics_client_async.py | 12 +- .../tests/test_logs_client.py | 16 +- .../tests/test_metrics_client.py | 2 +- 17 files changed, 496 insertions(+), 171 deletions(-) create mode 100644 sdk/monitor/azure-monitor-query/samples/champion_scenarios.md diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md index ea4ae667b247..5805d4278e0b 100644 --- a/sdk/monitor/azure-monitor-query/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md @@ -8,6 +8,7 @@ - Added a `MetricClass` enum to provide the class of a metric. - Added a `metric_class` attribute to the `MetricDefinition` type. - Added a `MetricNamespaceClassification` enum to support the `namespace_classification` attribute on `MetricNamespace` type. +- Added a `MetricUnit` enum to describe the unit of the metric. ### Breaking Changes @@ -30,6 +31,10 @@ - Removed `LogsBatchResultError` type. - `LogsQueryResultTable` is named to `LogsTable` - `LogsQueryResultColumn` is renamed to `LogsTableColumn` +- `LogsTableColumn` is now removed. Column labels are strings instead. +- `start_time` in `list_metric_namespaces` API is now a datetime. +- The order of params in `LogsBatchQuery` is changed. Also, `headers` is no longer accepted. +- `timespan` is now a required keyword-only argument in logs APIs. ### Bugs Fixed diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py index 386aec140be1..d201fbff31bb 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py @@ -12,12 +12,12 @@ LogsBatchQueryResult, LogsQueryResult, LogsTable, - LogsTableColumn, MetricsResult, LogsBatchQuery, MetricNamespace, MetricNamespaceClassification, MetricDefinition, + MetricUnit, TimeSeriesElement, Metric, MetricValue, @@ -32,13 +32,13 @@ "LogsQueryClient", "LogsBatchQueryResult", "LogsQueryResult", - "LogsTableColumn", "LogsTable", "LogsBatchQuery", "MetricsQueryClient", "MetricNamespace", "MetricNamespaceClassification", "MetricDefinition", + "MetricUnit", "MetricsResult", "TimeSeriesElement", "Metric", diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py index 205239d1816f..cda750cd845e 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py @@ -90,4 +90,4 @@ def native_col_type(col_type, value): return value def process_row(col_types, row): - return [native_col_type(col_types[ind].type, val) for ind, val in enumerate(row)] + return [native_col_type(col_types[ind], val) for ind, val in enumerate(row)] 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 7431510fb04d..eaac63c874bc 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 @@ -5,7 +5,7 @@ # license information. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Any, Union, Sequence, Dict, Optional +from typing import TYPE_CHECKING, Any, Union, Sequence, Dict, List from azure.core.exceptions import HttpResponseError from azure.core.tracing.decorator import distributed_trace @@ -17,7 +17,7 @@ if TYPE_CHECKING: from azure.core.credentials import TokenCredential - from datetime import timedelta + from datetime import timedelta, datetime class LogsQueryClient(object): @@ -51,8 +51,8 @@ def __init__(self, credential, **kwargs): self._query_op = self._client.query @distributed_trace - def query(self, workspace_id, query, timespan=None, **kwargs): - # type: (str, str, Optional[timedelta], Any) -> LogsQueryResult + def query(self, workspace_id, query, **kwargs): + # type: (str, str, Any) -> LogsQueryResult """Execute an Analytics query. Executes an Analytics query for data. @@ -63,9 +63,9 @@ def query(self, workspace_id, query, timespan=None, **kwargs): :param query: The Analytics query. Learn more about the `Analytics query syntax `_. :type query: str - :param timespan: The timespan for which to query the data. This can be a timedelta, + :keyword timespan: The timespan for which to query the data. This can be a timedelta, a timedelta and a start datetime, or a start datetime/end datetime. - :type timespan: ~datetime.timedelta or tuple[~datetime.datetime, ~datetime.timedelta] + :paramtype timespan: ~datetime.timedelta or tuple[~datetime.datetime, ~datetime.timedelta] or tuple[~datetime.datetime, ~datetime.datetime] :keyword int server_timeout: the server timeout in seconds. The default timeout is 3 minutes, and the maximum timeout is 10 minutes. @@ -76,7 +76,7 @@ def query(self, workspace_id, query, timespan=None, **kwargs): :keyword additional_workspaces: A list of workspaces that are included in the query. These can be qualified workspace names, workspace Ids, or Azure resource Ids. :paramtype additional_workspaces: list[str] - :return: QueryResults, or the result of cls(response) + :return: LogsQueryResult, or the result of cls(response) :rtype: ~azure.monitor.query.LogsQueryResult :raises: ~azure.core.exceptions.HttpResponseError @@ -89,7 +89,9 @@ def query(self, workspace_id, query, timespan=None, **kwargs): :dedent: 0 :caption: Get a response for a single Log Query """ - timespan = construct_iso8601(timespan) + if 'timespan' not in kwargs: + raise TypeError("query() missing 1 required keyword-only argument: 'timespan'") + timespan = construct_iso8601(kwargs.pop('timespan')) include_statistics = kwargs.pop("include_statistics", False) include_visualization = kwargs.pop("include_visualization", False) server_timeout = kwargs.pop("server_timeout", None) @@ -126,7 +128,7 @@ def query(self, workspace_id, query, timespan=None, **kwargs): @distributed_trace def query_batch(self, queries, **kwargs): - # type: (Union[Sequence[Dict], Sequence[LogsBatchQuery]], Any) -> Sequence[LogsBatchQueryResult] + # type: (Union[Sequence[Dict], Sequence[LogsBatchQuery]], Any) -> List[LogsBatchQueryResult] """Execute a list of analytics queries. Each request can be either a LogQueryRequest object or an equivalent serialized model. @@ -135,7 +137,7 @@ def query_batch(self, queries, **kwargs): :param queries: The list of queries that should be processed :type queries: list[dict] or list[~azure.monitor.query.LogsBatchQuery] :return: List of LogsBatchQueryResult, or the result of cls(response) - :rtype: ~list[~azure.monitor.query.LogsBatchQueryResult] + :rtype: list[~azure.monitor.query.LogsBatchQueryResult] :raises: ~azure.core.exceptions.HttpResponseError .. admonition:: Example: 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 aae99348a479..30a99f6f82a0 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 @@ -8,6 +8,7 @@ # pylint: disable=anomalous-backslash-in-string from typing import TYPE_CHECKING, Any, Optional +from msrest.serialization import Serializer from azure.core.tracing.decorator import distributed_trace from ._generated._monitor_query_client import ( @@ -59,9 +60,6 @@ def query(self, resource_uri, metric_names, **kwargs): # type: (str, list, Optional[timedelta], Any) -> MetricsResult """Lists the metric values for a resource. - **Note**: Although the start_time, end_time, duration are optional parameters, it is highly - recommended to specify the timespan. If not, the entire dataset is queried. - :param resource_uri: The identifier of the resource. :type resource_uri: str :param metric_names: The names of the metrics to retrieve. @@ -93,9 +91,6 @@ def query(self, resource_uri, metric_names, **kwargs): ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and B eq ‘\ *’ and C eq ‘*\ ’**. :paramtype filter: str - :keyword result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. - :paramtype result_type: str or ~monitor_query_client.models.ResultType :keyword metric_namespace: Metric namespace to query metric definitions for. :paramtype metric_namespace: str :return: Response, or the result of cls(response) @@ -131,15 +126,19 @@ def list_metric_namespaces(self, resource_uri, **kwargs): :param resource_uri: The identifier of the resource. :type resource_uri: str - :keyword start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. - :paramtype start_time: str + :keyword start_time: The start time from which to query for metric + namespaces. This should be provided as a datetime object. + :paramtype start_time: ~datetime.datetime :return: An iterator like instance of either MetricNamespace or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricNamespace] :raises: ~azure.core.exceptions.HttpResponseError """ + start_time = kwargs.pop('start_time', None) + if start_time: + start_time = Serializer.serialize_iso(start_time) return self._namespace_op.list( resource_uri, + start_time, cls=kwargs.pop( "cls", lambda objs: [ @@ -155,12 +154,13 @@ def list_metric_definitions(self, resource_uri, metric_namespace=None, **kwargs) :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metric_namespace: Metric namespace to query metric definitions for. - :type metric_namespace: str + :keyword namespace: Metric namespace to query metric definitions for. + :paramtype namespace: str :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricDefinition] :raises: ~azure.core.exceptions.HttpResponseError """ + metric_namespace = kwargs.pop('namespace', None) return self._definitions_op.list( resource_uri, metric_namespace, diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py index 2b3a33672ec6..18cfa1245435 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py @@ -11,7 +11,6 @@ from ._helpers import construct_iso8601, process_row from ._generated.models import ( - Column as InternalColumn, BatchQueryRequest as InternalLogQueryRequest, ) @@ -21,49 +20,33 @@ class LogsTable(object): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the table. - :type name: str - :param columns: Required. The list of columns in this table. - :type columns: list[~azure.monitor.query.LogsTableColumn] - :param rows: Required. The resulting rows from this query. - :type rows: list[list[str]] + :ivar name: Required. The name of the table. + :vartype name: str + :ivar columns: The labels of columns in this table. + :vartype columns: list[str] + :ivar column_types: The types of columns in this table. + :vartype columns: list[object] + :ivar rows: Required. The resulting rows from this query. + :vartype rows: list[list[object]] """ - def __init__(self, name, columns, rows): - # type: (str, List[LogsTableColumn], List[List[str]]) -> None - self.name = name - self.columns = columns - self.rows = [process_row(self.columns, row) for row in rows] + def __init__(self, **kwargs): + # type: (Any) -> None + self.name = kwargs.pop('name', None) # type: str + self.columns = kwargs.pop('columns', None) # type: Optional[str] + self.columns_types = kwargs.pop('column_types', None) # type: Optional[Any] + _rows = kwargs.pop('rows', None) + self.rows = [process_row(self.columns_types, row) for row in _rows] @classmethod def _from_generated(cls, generated): return cls( name=generated.name, - columns=[LogsTableColumn(name=col.name, type=col.type) for col in generated.columns], + columns=[col.name for col in generated.columns], + column_types=[col.type for col in generated.columns], rows=generated.rows ) -class LogsTableColumn(InternalColumn): - """A column in a table. - - :ivar name: The name of this column. - :vartype name: str - :ivar type: The data type of this column. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs): - # type: (Any) -> None - super(LogsTableColumn, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.type = kwargs.get("type", None) - - class LogsQueryResult(object): """Contains the tables, columns & rows resulting from a query. @@ -76,7 +59,7 @@ class LogsQueryResult(object): visualization selected by the query and any properties for that visualization. :vartype visualization: object :ivar error: Any error info. - :vartype error: object + :vartype error: ~azure.core.exceptions.HttpResponseError """ def __init__(self, **kwargs): # type: (Any) -> None @@ -124,7 +107,7 @@ class MetricsResult(object): :ivar resource_region: The region of the resource that has been queried for metrics. :vartype resource_region: str :ivar metrics: Required. The value of the collection. - :vartype metrics: list[~monitor_query_client.models.Metric] + :vartype metrics: list[~azure.monitor.query.Metric] """ def __init__(self, **kwargs): # type: (Any) -> None @@ -158,9 +141,9 @@ class LogsBatchQuery(object): :param query: The Analytics query. Learn more about the `Analytics query syntax `_. :type query: str - :param timespan: The timespan for which to query the data. This can be a timedelta, + :keyword timespan: The timespan for which to query the data. This can be a timedelta, a timedelta and a start datetime, or a start datetime/end datetime. - :type timespan: ~datetime.timedelta or tuple[~datetime.datetime, ~datetime.timedelta] + :paramtype timespan: ~datetime.timedelta or tuple[~datetime.datetime, ~datetime.timedelta] or tuple[~datetime.datetime, ~datetime.datetime] :keyword additional_workspaces: A list of workspaces that are included in the query. These can be qualified workspace names, workspace Ids, or Azure resource Ids. @@ -171,12 +154,12 @@ class LogsBatchQuery(object): :keyword bool include_visualization: In the query language, it is possible to specify different visualization options. By default, the API does not return information regarding the type of visualization to show. - :keyword headers: Dictionary of :code:``. - :paramtype headers: dict[str, str] """ - def __init__(self, query, workspace_id, timespan, **kwargs): #pylint: disable=super-init-not-called - # type: (str, str, Optional[str], Any) -> None + def __init__(self, workspace_id, query, **kwargs): #pylint: disable=super-init-not-called + # type: (str, str, Any) -> None + if 'timespan' not in kwargs: + raise TypeError("LogsBatchQuery() missing 1 required keyword-only argument: 'timespan'") include_statistics = kwargs.pop("include_statistics", False) include_visualization = kwargs.pop("include_visualization", False) server_timeout = kwargs.pop("server_timeout", None) @@ -192,12 +175,8 @@ def __init__(self, query, workspace_id, timespan, **kwargs): #pylint: disable=su prefer += "," prefer += "include-render=true" - headers = kwargs.get("headers", None) - try: - headers['Prefer'] = prefer - except TypeError: - headers = {'Prefer': prefer} - timespan = construct_iso8601(timespan) + headers = {'Prefer': prefer} + timespan = construct_iso8601(kwargs.pop('timespan')) additional_workspaces = kwargs.pop("additional_workspaces", None) self.id = str(uuid.uuid4()) self.body = { @@ -230,7 +209,7 @@ class LogsBatchQueryResult(object): visualization selected by the query and any properties for that visualization. :vartype visualization: object :ivar error: Any error info. - :vartype error: object + :vartype error: ~azure.core.exceptions.HttpResponseError """ def __init__( self, @@ -276,16 +255,16 @@ class MetricNamespaceClassification(str, Enum): class MetricNamespace(object): """Metric namespace class specifies the metadata for a metric namespace. - :keyword id: The ID of the metricNamespace. - :paramtype id: str - :keyword type: The type of the namespace. - :paramtype type: str - :keyword name: The name of the namespace. - :paramtype name: str - :keyword fully_qualified_namespace: The fully qualified namespace name. - :paramtype fully_qualified_namespace: str - :keyword namespace_classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". - :paramtype namespace_classification: str or ~azure.monitor.query.MetricNamespaceClassification + :ivar id: The ID of the metricNamespace. + :vartype id: str + :ivar type: The type of the namespace. + :vartype type: str + :ivar name: The name of the namespace. + :vartype name: str + :ivar fully_qualified_namespace: The fully qualified namespace name. + :vartype fully_qualified_namespace: str + :ivar namespace_classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :vartype namespace_classification: str or ~azure.monitor.query.MetricNamespaceClassification """ def __init__( self, @@ -327,35 +306,35 @@ class MetricClass(str, Enum): class MetricDefinition(object): #pylint: disable=too-many-instance-attributes """Metric definition class specifies the metadata for a metric. - :keyword dimension_required: Flag to indicate whether the dimension is required. - :paramtype dimension_required: bool - :keyword resource_id: the resource identifier of the resource that emitted the metric. - :paramtype resource_id: str - :keyword namespace: the namespace the metric belongs to. - :paramtype namespace: str - :keyword name: the name and the display name of the metric, i.e. it is a localizable string. - :paramtype name: str - :keyword unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + :ivar dimension_required: Flag to indicate whether the dimension is required. + :vartype dimension_required: bool + :ivar resource_id: the resource identifier of the resource that emitted the metric. + :vartype resource_id: str + :ivar namespace: the namespace the metric belongs to. + :vartype namespace: str + :ivar name: the name and the display name of the metric, i.e. it is a localizable string. + :vartype name: str + :ivar unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". - :paramtype unit: str or ~monitor_query_client.models.Unit - :keyword primary_aggregation_type: the primary aggregation type value defining how to use the + :vartype unit: str or ~azure.monitor.query.MetricUnit + :ivar primary_aggregation_type: the primary aggregation type value defining how to use the values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum", "Total". - :paramtype primary_aggregation_type: str or ~azure.monitor.query.MetricAggregationType - :keyword metric_class: The class of the metric. Possible values include: "Availability", + :vartype primary_aggregation_type: str or ~azure.monitor.query.MetricAggregationType + :ivar metric_class: The class of the metric. Possible values include: "Availability", "Transactions", "Errors", "Latency", "Saturation". - :paramtype metric_class: str or ~azure.monitor.query.MetricClass - :keyword supported_aggregation_types: the collection of what aggregation types are supported. - :paramtype supported_aggregation_types: list[str or ~azure.monitor.query.MetricAggregationType] - :keyword metric_availabilities: the collection of what aggregation intervals are available to be + :vartype metric_class: str or ~azure.monitor.query.MetricClass + :ivar supported_aggregation_types: the collection of what aggregation types are supported. + :vartype supported_aggregation_types: list[str or ~azure.monitor.query.MetricAggregationType] + :ivar metric_availabilities: the collection of what aggregation intervals are available to be queried. - :paramtype metric_availabilities: list[~azure.monitor.query.MetricAvailability] - :keyword id: the resource identifier of the metric definition. - :paramtype id: str - :keyword dimensions: the name and the display name of the dimension, i.e. it is a localizable + :vartype metric_availabilities: list[~azure.monitor.query.MetricAvailability] + :ivar id: the resource identifier of the metric definition. + :vartype id: str + :ivar dimensions: the name and the display name of the dimension, i.e. it is a localizable string. - :paramtype dimensions: list[str] + :vartype dimensions: list[str] """ def __init__( self, @@ -459,7 +438,7 @@ class Metric(object): "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond". :vartype unit: str :ivar timeseries: Required. The time series returned when a data query is performed. - :vartype timeseries: list[~monitor_query_client.models.TimeSeriesElement] + :vartype timeseries: list[~azure.monitor.query.TimeSeriesElement] :ivar display_description: Detailed description of this metric. :vartype display_description: str """ @@ -498,7 +477,7 @@ class TimeSeriesElement(object): :vartype metadata_values: dict(str, str) :ivar data: An array of data points representing the metric values. This is only returned if a result type of data is specified. - :vartype data: list[~monitor_query_client.models.MetricValue] + :vartype data: list[~azure.monitor.query.MetricValue] """ _attribute_map = { @@ -530,12 +509,12 @@ class MetricAvailability(object): """Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain. - :keyword granularity: the time grain specifies the aggregation interval for the metric. Expressed + :ivar granularity: the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - :paramtype granularity: ~datetime.timedelta - :keyword retention: the retention period for the metric at the specified timegrain. Expressed as + :vartype granularity: ~datetime.timedelta + :ivar retention: the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - :paramtype retention: ~datetime.timedelta + :vartype retention: ~datetime.timedelta """ def __init__( self, @@ -565,3 +544,22 @@ class MetricAggregationType(str, Enum): MINIMUM = "Minimum" MAXIMUM = "Maximum" TOTAL = "Total" + + +class MetricUnit(str, Enum): + """The unit of the metric. + """ + + COUNT = "Count" + BYTES = "Bytes" + SECONDS = "Seconds" + COUNT_PER_SECOND = "CountPerSecond" + BYTES_PER_SECOND = "BytesPerSecond" + PERCENT = "Percent" + MILLI_SECONDS = "MilliSeconds" + BYTE_SECONDS = "ByteSeconds" + UNSPECIFIED = "Unspecified" + CORES = "Cores" + MILLI_CORES = "MilliCores" + NANO_CORES = "NanoCores" + BITS_PER_SECOND = "BitsPerSecond" 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 deb3ba2a99f9..5039f62402f6 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 @@ -6,7 +6,7 @@ # -------------------------------------------------------------------------- from datetime import datetime, timedelta -from typing import Any, Tuple, Union, Sequence, Dict, Optional, TYPE_CHECKING +from typing import Any, Tuple, Union, Sequence, Dict, List, TYPE_CHECKING from azure.core.exceptions import HttpResponseError from azure.core.tracing.decorator_async import distributed_trace_async @@ -45,7 +45,8 @@ async def query( self, workspace_id: str, query: str, - timespan: Optional[Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]]] = None, + *, + timespan: Union[timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime]], **kwargs: Any) -> LogsQueryResult: """Execute an Analytics query. @@ -114,7 +115,7 @@ async def query_batch( self, queries: Union[Sequence[Dict], Sequence[LogsBatchQuery]], **kwargs: Any - ) -> Sequence[LogsBatchQueryResult]: + ) -> List[LogsBatchQueryResult]: """Execute a list of analytics queries. Each request can be either a LogQueryRequest object or an equivalent serialized model. @@ -123,7 +124,7 @@ async def query_batch( :param queries: The list of queries that should be processed :type queries: list[dict] or list[~azure.monitor.query.LogsBatchQuery] :return: list of LogsBatchQueryResult objects, or the result of cls(response) - :rtype: ~list[~azure.monitor.query.LogsBatchQueryResult] + :rtype: list[~azure.monitor.query.LogsBatchQueryResult] :raises: ~azure.core.exceptions.HttpResponseError """ try: 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 dfdc2906f38b..0d06cbe8a0b1 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 @@ -9,6 +9,7 @@ from datetime import timedelta from typing import TYPE_CHECKING, Any, List, Optional +from msrest.serialization import Serializer from azure.core.async_paging import AsyncItemPaged from azure.core.tracing.decorator import distributed_trace @@ -88,9 +89,6 @@ async def query( ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and B eq ‘\ *’ and C eq ‘*\ ’**. :paramtype filter: str - :keyword result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. - :paramtype result_type: str or ~monitor_query_client.models.ResultType :keyword metric_namespace: Metric namespace to query metric definitions for. :paramtype metric_namespace: str :return: Response, or the result of cls(response) @@ -115,15 +113,19 @@ def list_metric_namespaces(self, resource_uri: str, **kwargs: Any) -> AsyncItemP :param resource_uri: The identifier of the resource. :type resource_uri: str - :keyword start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. - :paramtype start_time: str + :keyword start_time: The start time from which to query for metric + namespaces. This should be provided as a datetime object. + :paramtype start_time: ~datetime.datetime :return: An iterator like instance of either MetricNamespace or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricNamespace] + :rtype: ~azure.core.paging.AsyncItemPaged[:class: `~azure.monitor.query.MetricNamespace`] :raises: ~azure.core.exceptions.HttpResponseError """ + start_time = kwargs.pop('start_time', None) + if start_time: + start_time = Serializer.serialize_iso(start_time) return self._namespace_op.list( resource_uri, + start_time, cls=kwargs.pop( "cls", lambda objs: [ @@ -136,19 +138,19 @@ def list_metric_namespaces(self, resource_uri: str, **kwargs: Any) -> AsyncItemP def list_metric_definitions( self, resource_uri: str, - metric_namespace: str = None, **kwargs: Any ) -> AsyncItemPaged[MetricDefinition]: """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. :type resource_uri: str - :param metric_namespace: Metric namespace to query metric definitions for. - :type metric_namespace: str + :keyword namespace: Metric namespace to query metric definitions for. + :paramtype namespace: str :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricDefinition] + :rtype: ~azure.core.paging.AsyncItemPaged[:class: `~azure.monitor.query.MetricDefinition`] :raises: ~azure.core.exceptions.HttpResponseError """ + metric_namespace = kwargs.pop('namespace', None) return self._definitions_op.list( resource_uri, metric_namespace, diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py index c4578b06747c..4b52d4186807 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py @@ -4,17 +4,13 @@ import os import asyncio from datetime import datetime, timedelta -import urllib3 from azure.monitor.query.aio import MetricsQueryClient +from azure.monitor.query import MetricAggregationType from azure.identity.aio import DefaultAzureCredential -urllib3.disable_warnings() - async def query_metrics(): credential = DefaultAzureCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] + ) client = MetricsQueryClient(credential) @@ -23,16 +19,17 @@ async def query_metrics(): async with client: response = await client.query( metrics_uri, - metric_names=["PublishSuccessCount"], - start_time=datetime(2021, 5, 25), - duration=timedelta(days=1) + metric_names=["Ingress"], + timespan=timedelta(hours=2), + granularity=timedelta(minutes=15), + aggregations=[MetricAggregationType.AVERAGE], ) for metric in response.metrics: print(metric.name) for time_series_element in metric.timeseries: for metric_value in time_series_element.data: - print(metric_value.time_stamp) + print(metric_value.timestamp) if __name__ == '__main__': loop = asyncio.get_event_loop() diff --git a/sdk/monitor/azure-monitor-query/samples/champion_scenarios.md b/sdk/monitor/azure-monitor-query/samples/champion_scenarios.md new file mode 100644 index 000000000000..d104a65ead8f --- /dev/null +++ b/sdk/monitor/azure-monitor-query/samples/champion_scenarios.md @@ -0,0 +1,288 @@ +## Azure Monitor Query Champion Scenarios + +This document covers the basic champion Scenarios to use the package. + +### Authenticate the client + +Consider the following example, which creates and authenticates clients for both logs and metrics querying: + +```python +from azure.identity import DefaultAzureCredential +from azure.monitor.query import LogsQueryClient, MetricsQueryClient + +credential = DefaultAzureCredential() +logs_client = LogsQueryClient(credential) +metrics_client = MetricsQueryClient(credential) +``` + +### Make a simple query to the service + +* Each row is converted into a native python data type. For example, time is a datetime object instead of string. + +#### Results in tabular form + +```python +import os +import pandas as pd +from datetime import timedelta +from azure.monitor.query import LogsQueryClient +from azure.identity import DefaultAzureCredential + +def query(): + query = """AppRequests | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" + + response = client.query(os.environ['LOG_WORKSPACE_ID'], query, + timespan=timedelta(days=1)) + + if not response.tables: + return None + + primary_table = response.tables[0] + df = pd.DataFrame(table.rows, columns=table.columns) + return df + +if __name__ == '__main__': + print(query()) + +""" + TimeGenerated _ResourceId avgRequestDuration +0 2021-05-27T08:40:00Z /subscriptions/... 27.307699999999997 +1 2021-05-27T08:50:00Z /subscriptions/... 18.11655 +2 2021-05-27T09:00:00Z /subscriptions/... 24.5271 +""" + +``` + +#### Results in Key Value form + +```python +import os +import pandas as pd +from datetime import timedelta +from azure.monitor.query import LogsQueryClient +from azure.identity import DefaultAzureCredential + +def query(): + query = """AppRequests | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" + + response = client.query(os.environ['LOG_WORKSPACE_ID'], query, + timespan=timedelta(days=1)) + + if not response.tables: + return None + + primary_table = response.tables[0] + df = pd.DataFrame(table.rows, columns=table.columns) + return df.to_dict(orient='records') + +if __name__ == '__main__': + print(query()) + + +""" +[ + { + 'TimeGenerated': Timestamp('2021-08-24 01:10:00+0000'), + '_ResourceId': '/subscriptions/faa080af....', + 'avgRequestDuration': 19.7987 + }, + { + 'TimeGenerated': Timestamp('2021-08-24 01:10:00+0000'), + '_ResourceId': '/subscriptions/faa08....', + 'avgRequestDuration': 33.9654 + }, + { + 'TimeGenerated': Timestamp('2021-08-24 01:10:00+0000'), + '_ResourceId': '/subscriptions/faa080....', + 'avgRequestDuration': 44.13115 + } +] +""" + +``` + +### Run multiple queries in 1 api call + +* batch_query returns the results as a list in the same order in which the requests were sent. +* Each item in the result will have an error attribute if there is an error. + +#### Results in tabular form + +```python +from datetime import datetime, timedelta +import os +import pandas as pd +from azure.monitor.query import LogsQueryClient, LogsBatchQuery +from azure.identity import DefaultAzureCredential + + +credential = DefaultAzureCredential() + +client = LogsQueryClient(credential) + +requests = [ + LogsBatchQuery( + query="AzureActivity | summarize count()", + timespan=timedelta(hours=1), + workspace_id= os.environ['LOG_WORKSPACE_ID'] + ), + LogsBatchQuery( + query= """AppRequests | take 5 | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""", + timespan=(datetime(2021, 6, 2), timedelta(hours=1)), + workspace_id= os.environ['LOG_WORKSPACE_ID'] + ), + LogsBatchQuery( + query= """AppRequests | take 5 | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""", + workspace_id= os.environ['LOG_WORKSPACE_ID'], + timespan=(datetime(2021, 6, 2), datetime(2021, 6, 3)), + include_statistics=True + ), +] +results = client.query_batch(requests) + +for response in results: + if response.error is not None: + error = response.error.innererror + print(error) + + table = response.tables[0] + df = pd.DataFrame(table.rows, columns=table.columns) + print(df) + print("\n\n-------------------------\n\n") + +""" + count_ +0 2 + + +------------------------- + + + TimeGenerated _ResourceId avgRequestDuration +0 2021-06-02 00:20:00+00:00 /subscriptions/... 18.12380 +1 2021-06-02 00:00:00+00:00 /subscriptions/... 20.84805 +2 2021-06-02 00:10:00+00:00 /subscriptions/... 19.72410 +3 2021-06-02 00:30:00+00:00 /subscriptions/... 19.41265 +4 2021-06-02 00:40:00+00:00 /subscriptions/... 19.17145 + + +------------------------- + + + + TimeGenerated _ResourceId avgRequestDuration +0 2021-06-02 00:20:00+00:00 /subscriptions/... 18.12380 +1 2021-06-02 00:00:00+00:00 /subscriptions/... 20.84805 +2 2021-06-02 00:10:00+00:00 /subscriptions/... 19.72410 +3 2021-06-02 00:30:00+00:00 /subscriptions/... 19.41265 +4 2021-06-02 00:40:00+00:00 /subscriptions/... 19.17145 + + + +------------------------- +""" +``` + +#### Results in Key Value form + + +Very Simlar to above: + +```python +for response in results: + if response.error is not None: + error = response.error.innererror + print(error) + + table = response.tables[0] + df = pd.DataFrame(table.rows, columns=table.columns) + print(df.to_dict(orient='records')) + print("\n\n-------------------------\n\n") +``` + +### Run a complex query to set server timeout for more than 3 minutes. + +```python +import os +import pandas as pd +from azure.core.serialization import NULL +from azure.monitor.query import LogsQueryClient +from azure.identity import DefaultAzureCredential + + +credential = DefaultAzureCredential() + +client = LogsQueryClient(credential) + +response = client.query( + os.environ['LOG_WORKSPACE_ID'], + "range x from 1 to 10000000000 step 1 | count", + timespan=NULL, # can pass None too + server_timeout=600 + ) + +### results in server timeout +``` + +### Run a metrics Query + +```python +import os +from datetime import timedelta +from azure.monitor.query import MetricsQueryClient, MetricAggregationType +from azure.identity import DefaultAzureCredential + +credential = DefaultAzureCredential() + +client = MetricsQueryClient(credential) + +metrics_uri = os.environ['METRICS_RESOURCE_URI'] +response = client.query( + metrics_uri, + metric_names=["Ingress"], + timespan=timedelta(hours=2), + granularity=timedelta(minutes=5), + aggregations=[MetricAggregationType.AVERAGE], + ) + +for metric in response.metrics: + print(metric.name + ' -- ' + metric.display_description) + for time_series_element in metric.timeseries: + for metric_value in time_series_element.data: + print('The ingress at {} is {}'.format( + metric_value.timestamp, + metric_value.average + )) + +""" +Ingress -- The amount of ingress data, in bytes. This number includes ingress from an external client into Azure Storage as well as ingress within Azure. +The ingress at 2021-08-23 23:58:00+00:00 is 567.4285714285714 +The ingress at 2021-08-24 00:03:00+00:00 is 812.0 +The ingress at 2021-08-24 00:08:00+00:00 is 812.0 +The ingress at 2021-08-24 00:13:00+00:00 is 812.0 +The ingress at 2021-08-24 00:18:00+00:00 is 812.0 +The ingress at 2021-08-24 00:23:00+00:00 is 3623.3333333333335 +The ingress at 2021-08-24 00:28:00+00:00 is 1082.75 +The ingress at 2021-08-24 00:33:00+00:00 is 1160.6666666666667 +The ingress at 2021-08-24 00:38:00+00:00 is 1060.75 +The ingress at 2021-08-24 00:43:00+00:00 is 1081.75 +The ingress at 2021-08-24 00:48:00+00:00 is 1061.25 +The ingress at 2021-08-24 00:53:00+00:00 is 1160.3333333333333 +The ingress at 2021-08-24 00:58:00+00:00 is 1082.0 +The ingress at 2021-08-24 01:03:00+00:00 is 1628.6666666666667 +The ingress at 2021-08-24 01:08:00+00:00 is 794.6666666666666 +The ingress at 2021-08-24 01:13:00+00:00 is 1060.25 +The ingress at 2021-08-24 01:18:00+00:00 is 1160.0 +The ingress at 2021-08-24 01:23:00+00:00 is 1082.0 +The ingress at 2021-08-24 01:28:00+00:00 is 1060.5 +The ingress at 2021-08-24 01:33:00+00:00 is 1630.0 +The ingress at 2021-08-24 01:38:00+00:00 is 795.0 +The ingress at 2021-08-24 01:43:00+00:00 is 827.6 +The ingress at 2021-08-24 01:48:00+00:00 is 1250.5 +The ingress at 2021-08-24 01:53:00+00:00 is 1061.75 +""" +``` \ No newline at end of file diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py index c7e1ec025b93..3705d94cf494 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py @@ -16,19 +16,19 @@ requests = [ LogsBatchQuery( query="AzureActivity | summarize count()", - duration=timedelta(hours=1), + timespan=timedelta(hours=1), workspace_id= os.environ['LOG_WORKSPACE_ID'] ), LogsBatchQuery( query= """AppRequests | take 10 | summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""", - duration=timedelta(hours=1), - start_time=datetime(2021, 6, 2), + timespan=(datetime(2021, 6, 2), timedelta(hours=1)), workspace_id= os.environ['LOG_WORKSPACE_ID'] ), LogsBatchQuery( - query= "AppRequestss | take 5", + query= "AppRequests | take 5", workspace_id= os.environ['LOG_WORKSPACE_ID'], + timespan=(datetime(2021, 6, 2), datetime(2021, 6, 3)), include_statistics=True ), ] @@ -39,7 +39,8 @@ table = response.tables[0] df = pd.DataFrame(table.rows, columns=[col.name for col in table.columns]) print(df) + print("\n\n-------------------------\n\n") except TypeError: - print(response.error) + print(response.error.innererror) # [END send_query_batch] \ No newline at end of file diff --git a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py index fd2d13a4b891..917f6a16e698 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py @@ -3,8 +3,7 @@ import os import pandas as pd -from datetime import datetime, timedelta -from msrest.serialization import UTC +from datetime import timedelta from azure.monitor.query import LogsQueryClient from azure.identity import DefaultAzureCredential @@ -20,13 +19,6 @@ query = """AppRequests | summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" -query = """ -AppRequests -| where TimeGenerated > ago(1h) -| fork - ( summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId ) -""" - # returns LogsQueryResult response = client.query(os.environ['LOG_WORKSPACE_ID'], query, timespan=timedelta(days=1)) @@ -35,8 +27,7 @@ for table in response.tables: try: - print ([col.name for col in table.columns]) - df = pd.DataFrame(table.rows, columns=[col.name for col in table.columns]) + df = pd.DataFrame(table.rows, columns=table.columns) print(df) except TypeError: print(response.error) diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py index 224d7f05e8ea..4027ddd1b308 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py @@ -7,7 +7,7 @@ from azure.monitor.query import MetricsQueryClient, MetricAggregationType from azure.identity import DefaultAzureCredential -urllib3.disable_warnings() +# urllib3.disable_warnings() # [START metrics_client_auth_with_token_cred] credential = DefaultAzureCredential() @@ -19,20 +19,18 @@ metrics_uri = os.environ['METRICS_RESOURCE_URI'] response = client.query( metrics_uri, - metric_names=["MatchedEventCount", "DeliverySuccesssCount"], - timespan=timedelta(days=1), - aggregations=[MetricAggregationType.COUNT] + metric_names=["Ingress"], + timespan=timedelta(hours=2), + granularity=timedelta(minutes=5), + aggregations=[MetricAggregationType.AVERAGE], ) for metric in response.metrics: - print(metric.name) + print(metric.name + ' -- ' + metric.display_description) for time_series_element in metric.timeseries: for metric_value in time_series_element.data: - if metric_value.count != 0: - print( - "There are {} matched events at {}".format( - metric_value.count, - metric_value.time_stamp - ) - ) + print('The ingress at {} is {}'.format( + metric_value.timestamp, + metric_value.average + )) # [END send_metrics_query] diff --git a/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py b/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py index 6c9ea9f6fd13..fb49883cff6d 100644 --- a/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py @@ -16,6 +16,7 @@ def _credential(): return credential @pytest.mark.live_test_only +@pytest.mark.asyncio async def test_logs_auth(): credential = _credential() client = LogsQueryClient(credential) @@ -29,8 +30,23 @@ async def test_logs_auth(): assert response is not None assert response.tables is not None +@pytest.mark.live_test_only +@pytest.mark.asyncio +async def test_logs_auth_no_timespan(): + credential = _credential() + client = LogsQueryClient(credential) + query = """AppRequests | + where TimeGenerated > ago(12h) | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" + + # returns LogsQueryResult + with pytest.raises(TypeError): + await client.query(os.environ['LOG_WORKSPACE_ID'], query) + + @pytest.mark.skip("https://github.com/Azure/azure-sdk-for-python/issues/19917") @pytest.mark.live_test_only +@pytest.mark.asyncio async def test_logs_server_timeout(): client = LogsQueryClient(_credential()) with pytest.raises(HttpResponseError) as e: @@ -43,6 +59,16 @@ async def test_logs_server_timeout(): assert e.message.contains('Gateway timeout') @pytest.mark.live_test_only +@pytest.mark.asyncio +async def test_logs_query_batch_raises_on_no_timespan(): + with pytest.raises(TypeError): + LogsBatchQuery( + query="AzureActivity | summarize count()", + workspace_id= os.environ['LOG_WORKSPACE_ID'] + ) + +@pytest.mark.live_test_only +@pytest.mark.asyncio async def test_logs_query_batch(): client = LogsQueryClient(_credential()) diff --git a/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py b/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py index e205e67734e2..ae9ba2f52b2d 100644 --- a/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/async/test_metrics_client_async.py @@ -43,17 +43,21 @@ async def test_metrics_granularity(): assert response.granularity == timedelta(minutes=5) @pytest.mark.live_test_only +@pytest.mark.asyncio async def test_metrics_namespaces(): client = MetricsQueryClient(_credential()) - response = await client.list_metric_namespaces(os.environ['METRICS_RESOURCE_URI']) + async with client: + response = client.list_metric_namespaces(os.environ['METRICS_RESOURCE_URI']) - assert response is not None + assert response is not None @pytest.mark.live_test_only +@pytest.mark.asyncio async def test_metrics_definitions(): client = MetricsQueryClient(_credential()) - response = await client.list_metric_definitions(os.environ['METRICS_RESOURCE_URI'], metric_namespace='microsoft.eventgrid/topics') + async with client: + response = client.list_metric_definitions(os.environ['METRICS_RESOURCE_URI'], namespace='microsoft.eventgrid/topics') - assert response is not None + assert response is not None diff --git a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py index e9e91b316dcc..dba61f5471d1 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py @@ -22,11 +22,23 @@ def test_logs_single_query(): summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" # returns LogsQueryResult - response = client.query(os.environ['LOG_WORKSPACE_ID'], query) + response = client.query(os.environ['LOG_WORKSPACE_ID'], query, timespan=None) assert response is not None assert response.tables is not None +@pytest.mark.live_test_only +def test_logs_single_query_raises_no_timespan(): + credential = _credential() + client = LogsQueryClient(credential) + query = """AppRequests | + where TimeGenerated > ago(12h) | + summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId""" + + # returns LogsQueryResult + with pytest.raises(TypeError): + client.query(os.environ['LOG_WORKSPACE_ID'], query) + @pytest.mark.live_test_only def test_logs_single_query_with_non_200(): credential = _credential() @@ -107,7 +119,7 @@ def test_logs_single_query_with_render(): query = """AppRequests""" # returns LogsQueryResult - response = client.query(os.environ['LOG_WORKSPACE_ID'], query, include_visualization=True) + response = client.query(os.environ['LOG_WORKSPACE_ID'], query, timespan=None, include_visualization=True) assert response.visualization is not None diff --git a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py index ecdb7e7c8a3a..17f61ccb812b 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_metrics_client.py @@ -51,6 +51,6 @@ def test_metrics_namespaces(): def test_metrics_definitions(): client = MetricsQueryClient(_credential()) - response = client.list_metric_definitions(os.environ['METRICS_RESOURCE_URI'], metric_namespace='microsoft.eventgrid/topics') + response = client.list_metric_definitions(os.environ['METRICS_RESOURCE_URI'], namespace='microsoft.eventgrid/topics') assert response is not None