diff --git a/sdk/eventhub/azure-mgmt-eventhub/README.md b/sdk/eventhub/azure-mgmt-eventhub/README.md index eb8a9550deb5..4e106d7738e8 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/README.md +++ b/sdk/eventhub/azure-mgmt-eventhub/README.md @@ -1,26 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure EventHub Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. - -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) library. - -For a more complete set of Azure libraries, see the [azure](https://pypi.python.org/pypi/azure) bundle package. - -## Usage +# Usage For code examples, see [EventHub Management](https://docs.microsoft.com/python/api/overview/azure/event-hub) on docs.microsoft.com. -## Provide Feedback + +# Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-eventhub%2FREADME.png) \ No newline at end of file + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-eventhub%2FREADME.png) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py index deb5a1fd0fd5..17380b1b3d8c 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py @@ -119,12 +119,15 @@ def consumer_groups(self): * 2015-08-01: :class:`ConsumerGroupsOperations` * 2017-04-01: :class:`ConsumerGroupsOperations` + * 2018-01-01-preview: :class:`ConsumerGroupsOperations` """ api_version = self._get_api_version('consumer_groups') if api_version == '2015-08-01': from .v2015_08_01.operations import ConsumerGroupsOperations as OperationClass elif api_version == '2017-04-01': from .v2017_04_01.operations import ConsumerGroupsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import ConsumerGroupsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -134,10 +137,13 @@ def disaster_recovery_configs(self): """Instance depends on the API version: * 2017-04-01: :class:`DisasterRecoveryConfigsOperations` + * 2018-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 else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -148,12 +154,15 @@ def event_hubs(self): * 2015-08-01: :class:`EventHubsOperations` * 2017-04-01: :class:`EventHubsOperations` + * 2018-01-01-preview: :class:`EventHubsOperations` """ api_version = self._get_api_version('event_hubs') if api_version == '2015-08-01': from .v2015_08_01.operations import EventHubsOperations as OperationClass elif 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 NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -201,10 +210,13 @@ 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 NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py index dd766335d387..dac0334ae47b 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py @@ -532,7 +532,7 @@ def get_authorization_rule( return deserialized get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} - def postt_authorization_rule( + def post_authorization_rule( self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): """Gets an AuthorizationRule for an Event Hub by rule name. @@ -558,7 +558,7 @@ def postt_authorization_rule( :raises: :class:`CloudError` """ # Construct URL - url = self.postt_authorization_rule.metadata['url'] + url = self.post_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), @@ -600,7 +600,7 @@ def postt_authorization_rule( return client_raw_response return deserialized - postt_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + post_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} def delete_authorization_rule( self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py index 14cecbac9af4..b4debbf32617 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py @@ -13,11 +13,11 @@ from msrest import Serializer, Deserializer from ._configuration import EventHubManagementClientConfiguration -from .operations import Operations from .operations import NamespacesOperations from .operations import DisasterRecoveryConfigsOperations from .operations import EventHubsOperations from .operations import ConsumerGroupsOperations +from .operations import Operations from .operations import RegionsOperations from . import models @@ -28,8 +28,6 @@ class EventHubManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: EventHubManagementClientConfiguration - :ivar operations: Operations operations - :vartype operations: azure.mgmt.eventhub.v2017_04_01.operations.Operations :ivar namespaces: Namespaces operations :vartype namespaces: azure.mgmt.eventhub.v2017_04_01.operations.NamespacesOperations :ivar disaster_recovery_configs: DisasterRecoveryConfigs operations @@ -38,6 +36,8 @@ class EventHubManagementClient(SDKClient): :vartype event_hubs: azure.mgmt.eventhub.v2017_04_01.operations.EventHubsOperations :ivar consumer_groups: ConsumerGroups operations :vartype consumer_groups: azure.mgmt.eventhub.v2017_04_01.operations.ConsumerGroupsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.eventhub.v2017_04_01.operations.Operations :ivar regions: Regions operations :vartype regions: azure.mgmt.eventhub.v2017_04_01.operations.RegionsOperations @@ -62,8 +62,6 @@ def __init__( self._serialize = Serializer(client_models) 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.disaster_recovery_configs = DisasterRecoveryConfigsOperations( @@ -72,5 +70,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.consumer_groups = ConsumerGroupsOperations( self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) self.regions = RegionsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py index c92d44cdcc3e..aaca8db73866 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py @@ -65,17 +65,18 @@ from ._paged_models import EHNamespacePaged from ._paged_models import EventhubPaged from ._paged_models import MessagingRegionsPaged +from ._paged_models import NetworkRuleSetPaged from ._paged_models import OperationPaged from ._event_hub_management_client_enums import ( - SkuName, - SkuTier, AccessRights, KeyType, - EntityStatus, - EncodingCaptureDescription, UnavailableReason, ProvisioningStateDR, RoleDisasterRecovery, + EncodingCaptureDescription, + EntityStatus, + SkuName, + SkuTier, NetworkRuleIPAction, DefaultAction, ) @@ -105,22 +106,23 @@ 'Sku', 'Subnet', 'TrackedResource', - 'OperationPaged', - 'EHNamespacePaged', 'AuthorizationRulePaged', + 'EHNamespacePaged', + 'NetworkRuleSetPaged', 'ArmDisasterRecoveryPaged', 'EventhubPaged', 'ConsumerGroupPaged', + 'OperationPaged', 'MessagingRegionsPaged', - 'SkuName', - 'SkuTier', 'AccessRights', 'KeyType', - 'EntityStatus', - 'EncodingCaptureDescription', 'UnavailableReason', 'ProvisioningStateDR', 'RoleDisasterRecovery', + 'EncodingCaptureDescription', + 'EntityStatus', + 'SkuName', + 'SkuTier', 'NetworkRuleIPAction', 'DefaultAction', ] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_event_hub_management_client_enums.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_event_hub_management_client_enums.py index 8ee7a46c2aa3..6449c19d66b0 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_event_hub_management_client_enums.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_event_hub_management_client_enums.py @@ -12,18 +12,6 @@ from enum import Enum -class SkuName(str, Enum): - - basic = "Basic" - standard = "Standard" - - -class SkuTier(str, Enum): - - basic = "Basic" - standard = "Standard" - - class AccessRights(str, Enum): manage = "Manage" @@ -37,25 +25,6 @@ class KeyType(str, Enum): secondary_key = "SecondaryKey" -class EntityStatus(str, Enum): - - active = "Active" - disabled = "Disabled" - restoring = "Restoring" - send_disabled = "SendDisabled" - receive_disabled = "ReceiveDisabled" - creating = "Creating" - deleting = "Deleting" - renaming = "Renaming" - unknown = "Unknown" - - -class EncodingCaptureDescription(str, Enum): - - avro = "Avro" - avro_deflate = "AvroDeflate" - - class UnavailableReason(str, Enum): none = "None" @@ -80,6 +49,37 @@ class RoleDisasterRecovery(str, Enum): secondary = "Secondary" +class EncodingCaptureDescription(str, Enum): + + avro = "Avro" + avro_deflate = "AvroDeflate" + + +class EntityStatus(str, Enum): + + active = "Active" + disabled = "Disabled" + restoring = "Restoring" + send_disabled = "SendDisabled" + receive_disabled = "ReceiveDisabled" + creating = "Creating" + deleting = "Deleting" + renaming = "Renaming" + unknown = "Unknown" + + +class SkuName(str, Enum): + + basic = "Basic" + standard = "Standard" + + +class SkuTier(str, Enum): + + basic = "Basic" + standard = "Standard" + + class NetworkRuleIPAction(str, Enum): allow = "Allow" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py index 4796e7bf4622..7ca88da51d35 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models.py @@ -73,16 +73,16 @@ def __init__(self, **kwargs): class Resource(Model): - """The Resource definition. + """The resource definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str """ @@ -112,11 +112,11 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or @@ -176,11 +176,11 @@ class AuthorizationRule(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param rights: Required. The rights associated with the rule. :type rights: list[str or @@ -329,11 +329,11 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: datetime @@ -403,20 +403,20 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """Definition of Resource. + """Definition of resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] """ @@ -446,15 +446,15 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of sku resource :type sku: ~azure.mgmt.eventhub.v2017_04_01.models.Sku @@ -524,7 +524,7 @@ def __init__(self, **kwargs): class ErrorResponse(Model): - """Error response indicates EventHub service is not able to process the + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. :param code: Error code. @@ -562,11 +562,11 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -631,15 +631,15 @@ class MessagingPlan(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :ivar sku: Sku type :vartype sku: int @@ -687,17 +687,17 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] - :param properties: + :param properties: Properties of Messaging Region :type properties: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingRegionsProperties """ @@ -723,7 +723,7 @@ def __init__(self, **kwargs): class MessagingRegionsProperties(Model): - """MessagingRegionsProperties. + """Properties of Messaging Region. Variables are only populated by the server, and will be ignored when sending a request. @@ -756,11 +756,11 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py index 7a56ad25fa52..b9be9c007aea 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py @@ -73,16 +73,16 @@ def __init__(self, **kwargs) -> None: class Resource(Model): - """The Resource definition. + """The resource definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str """ @@ -112,11 +112,11 @@ class ArmDisasterRecovery(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar provisioning_state: Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or @@ -176,11 +176,11 @@ class AuthorizationRule(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param rights: Required. The rights associated with the rule. :type rights: list[str or @@ -329,11 +329,11 @@ class ConsumerGroup(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar created_at: Exact time the message was created. :vartype created_at: datetime @@ -403,20 +403,20 @@ def __init__(self, *, name: str=None, storage_account_resource_id: str=None, blo class TrackedResource(Resource): - """Definition of Resource. + """Definition of resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] """ @@ -446,15 +446,15 @@ class EHNamespace(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of sku resource :type sku: ~azure.mgmt.eventhub.v2017_04_01.models.Sku @@ -524,7 +524,7 @@ def __init__(self, *, location: str=None, tags=None, sku=None, is_auto_inflate_e class ErrorResponse(Model): - """Error response indicates EventHub service is not able to process the + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. :param code: Error code. @@ -562,11 +562,11 @@ class Eventhub(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :ivar partition_ids: Current number of shards on the Event Hub. :vartype partition_ids: list[str] @@ -631,15 +631,15 @@ class MessagingPlan(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :ivar sku: Sku type :vartype sku: int @@ -687,17 +687,17 @@ class MessagingRegions(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] - :param properties: + :param properties: Properties of Messaging Region :type properties: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingRegionsProperties """ @@ -723,7 +723,7 @@ def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) class MessagingRegionsProperties(Model): - """MessagingRegionsProperties. + """Properties of Messaging Region. Variables are only populated by the server, and will be ignored when sending a request. @@ -756,11 +756,11 @@ class NetworkRuleSet(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_paged_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_paged_models.py index e12c4a12fc16..2434d3dfa657 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_paged_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_paged_models.py @@ -12,19 +12,19 @@ from msrest.paging import Paged -class OperationPaged(Paged): +class AuthorizationRulePaged(Paged): """ - A paging container for iterating over a list of :class:`Operation ` object + A paging container for iterating over a list of :class:`AuthorizationRule ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} + 'current_page': {'key': 'value', 'type': '[AuthorizationRule]'} } def __init__(self, *args, **kwargs): - super(OperationPaged, self).__init__(*args, **kwargs) + super(AuthorizationRulePaged, self).__init__(*args, **kwargs) class EHNamespacePaged(Paged): """ A paging container for iterating over a list of :class:`EHNamespace ` object @@ -38,19 +38,19 @@ class EHNamespacePaged(Paged): def __init__(self, *args, **kwargs): super(EHNamespacePaged, self).__init__(*args, **kwargs) -class AuthorizationRulePaged(Paged): +class NetworkRuleSetPaged(Paged): """ - A paging container for iterating over a list of :class:`AuthorizationRule ` object + A paging container for iterating over a list of :class:`NetworkRuleSet ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AuthorizationRule]'} + 'current_page': {'key': 'value', 'type': '[NetworkRuleSet]'} } def __init__(self, *args, **kwargs): - super(AuthorizationRulePaged, self).__init__(*args, **kwargs) + super(NetworkRuleSetPaged, self).__init__(*args, **kwargs) class ArmDisasterRecoveryPaged(Paged): """ A paging container for iterating over a list of :class:`ArmDisasterRecovery ` object @@ -90,6 +90,19 @@ class ConsumerGroupPaged(Paged): def __init__(self, *args, **kwargs): super(ConsumerGroupPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) class MessagingRegionsPaged(Paged): """ A paging container for iterating over a list of :class:`MessagingRegions ` object diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py index a2c1bb0c3b69..f5b3516944ea 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py @@ -9,18 +9,18 @@ # regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations from ._namespaces_operations import NamespacesOperations from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations from ._event_hubs_operations import EventHubsOperations from ._consumer_groups_operations import ConsumerGroupsOperations +from ._operations import Operations from ._regions_operations import RegionsOperations __all__ = [ - 'Operations', 'NamespacesOperations', 'DisasterRecoveryConfigsOperations', 'EventHubsOperations', 'ConsumerGroupsOperations', + 'Operations', 'RegionsOperations', ] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py index f67c245d69b7..01e3b125308f 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py @@ -75,7 +75,7 @@ def create_or_update( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_name, 'str', max_length=50, min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -146,7 +146,7 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_name, 'str', max_length=50, min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -206,7 +206,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_name, 'str', max_length=50, min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -282,7 +282,7 @@ def prepare_request(next_link=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), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py index 1940f83917ce..026bceb9469b 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py @@ -38,6 +38,215 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_authorization_rules( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """Gets a list of 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} + + def get_authorization_rule( + self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} + + def list_keys( + self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} + def check_name_availability( self, resource_group_name, namespace_name, name, custom_headers=None, raw=False, **operation_config): """Check the give Namespace name availability. @@ -106,7 +315,7 @@ def check_name_availability( return client_raw_response return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/checkNameAvailability'} def list( self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): @@ -490,212 +699,3 @@ def fail_over( client_raw_response = ClientRawResponse(None, response) return client_raw_response fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} - - def list_authorization_rules( - self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): - """Gets a list of 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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AuthorizationRule - :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] - :raises: - :class:`ErrorResponseException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_authorization_rules.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules'} - - def get_authorization_rule( - self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets an AuthorizationRule 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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AuthorizationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.get_authorization_rule.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AuthorizationRule', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}'} - - def list_keys( - self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list_keys.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AccessKeys', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/AuthorizationRules/{authorizationRuleName}/listKeys'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py index a29f63419898..b29c5a82e64e 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py @@ -38,41 +38,36 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def list_by_namespace( - self, resource_group_name, namespace_name, skip=None, top=None, custom_headers=None, raw=False, **operation_config): - """Gets all the Event Hubs in a Namespace. + def list_authorization_rules( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Gets the authorization rules for an Event Hub. :param resource_group_name: Name 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 + :param event_hub_name: The Event Hub name + :type event_hub_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of Eventhub + :return: An iterator like instance of AuthorizationRule :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.EventhubPaged[~azure.mgmt.eventhub.v2017_04_01.models.Eventhub] + ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] :raises: :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_namespace.metadata['url'] + url = self.list_authorization_rules.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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) @@ -80,10 +75,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.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) else: url = next_link @@ -117,15 +108,16 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.EventhubPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs'} + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'} - def create_or_update( - self, resource_group_name, namespace_name, event_hub_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a new Event Hub as a nested resource within a - Namespace. + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): + """Creates or updates an AuthorizationRule for the specified Event Hub. + Creation/update of the AuthorizationRule will take a few seconds to + take effect. :param resource_group_name: Name of the resource group within the azure subscription. @@ -134,26 +126,31 @@ def create_or_update( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str - :param parameters: Parameters supplied to create an Event Hub - resource. - :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: Eventhub or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub or + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + parameters = models.AuthorizationRule(rights=rights) + # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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) @@ -174,7 +171,7 @@ def create_or_update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'Eventhub') + body_content = self._serialize.body(parameters, 'AuthorizationRule') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -185,18 +182,18 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Eventhub', response) + deserialized = self._deserialize('AuthorizationRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} - def delete( - self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): - """Deletes an Event Hub from the specified Namespace and resource group. + def get_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule for an Event Hub by rule name. :param resource_group_name: Name of the resource group within the azure subscription. @@ -205,22 +202,26 @@ def delete( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.delete.metadata['url'] + url = self.get_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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) @@ -231,6 +232,7 @@ def delete( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -239,20 +241,26 @@ def delete( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 204]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + if raw: - client_raw_response = ClientRawResponse(None, response) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} - def get( - self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): - """Gets an Event Hubs description for the specified Event Hub. + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + + def delete_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an Event Hub AuthorizationRule. :param resource_group_name: Name of the resource group within the azure subscription. @@ -261,23 +269,25 @@ def get( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: Eventhub or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub or - ~msrest.pipeline.ClientRawResponse + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['url'] + url = self.delete_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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) @@ -288,7 +298,6 @@ def get( # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -297,101 +306,20 @@ def get( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Eventhub', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} - - def list_authorization_rules( - self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): - """Gets the authorization rules for an Event Hub. - - :param resource_group_name: Name of the resource group within the - azure subscription. - :type resource_group_name: str - :param namespace_name: The Namespace name - :type namespace_name: str - :param event_hub_name: The Event Hub name - :type event_hub_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AuthorizationRule - :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] - :raises: - :class:`ErrorResponseException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_authorization_rules.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'} - - def create_or_update_authorization_rule( - self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): - """Creates or updates an AuthorizationRule for the specified Event Hub. + def list_keys( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets the ACS and SAS connection strings for the Event Hub. :param resource_group_name: Name of the resource group within the azure subscription. @@ -402,28 +330,23 @@ def create_or_update_authorization_rule( :type event_hub_name: str :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str - :param rights: The rights associated with the rule. - :type rights: list[str or - ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AuthorizationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - parameters = models.AuthorizationRule(rights=rights) - # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] + url = self.list_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -436,7 +359,6 @@ def create_or_update_authorization_rule( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -444,11 +366,8 @@ def create_or_update_authorization_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'AuthorizationRule') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -456,18 +375,18 @@ def create_or_update_authorization_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AuthorizationRule', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/listKeys'} - def get_authorization_rule( - self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets an AuthorizationRule for an Event Hub by rule name. + def regenerate_keys( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the ACS and SAS connection strings for the Event Hub. :param resource_group_name: Name of the resource group within the azure subscription. @@ -478,23 +397,31 @@ def get_authorization_rule( :type event_hub_name: str :param authorization_rule_name: The authorization rule name. :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.eventhub.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AuthorizationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + # Construct URL - url = self.get_authorization_rule.metadata['url'] + url = self.regenerate_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -507,6 +434,7 @@ def get_authorization_rule( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -514,8 +442,11 @@ def get_authorization_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -523,18 +454,103 @@ def get_authorization_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AuthorizationRule', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} - def delete_authorization_rule( - self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes an Event Hub AuthorizationRule. + def list_by_namespace( + self, resource_group_name, namespace_name, skip=None, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all the Event Hubs 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Eventhub + :rtype: + ~azure.mgmt.eventhub.v2017_04_01.models.EventhubPaged[~azure.mgmt.eventhub.v2017_04_01.models.Eventhub] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventhubPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs'} + + def create_or_update( + self, resource_group_name, namespace_name, event_hub_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a new Event Hub as a nested resource within a + Namespace. :param resource_group_name: Name of the resource group within the azure subscription. @@ -543,25 +559,26 @@ def delete_authorization_rule( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str - :param authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str + :param parameters: Parameters supplied to create an Event Hub + resource. + :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse + :return: Eventhub or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.delete_authorization_rule.metadata['url'] + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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) @@ -572,6 +589,8 @@ def delete_authorization_rule( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -579,21 +598,30 @@ def delete_authorization_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'Eventhub') + # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 204]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Eventhub', response) + if raw: - client_raw_response = ClientRawResponse(None, response) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response - delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} - def list_keys( - self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets the ACS and SAS connection strings for the Event Hub. + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} + + def delete( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Deletes an Event Hub from the specified Namespace and resource group. :param resource_group_name: Name of the resource group within the azure subscription. @@ -602,26 +630,22 @@ def list_keys( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str - :param authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or - ~msrest.pipeline.ClientRawResponse + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_keys.metadata['url'] + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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) @@ -632,7 +656,6 @@ def list_keys( # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -641,26 +664,20 @@ def list_keys( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AccessKeys', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} - return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/ListKeys'} - - def regenerate_keys( - self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): - """Regenerates the ACS and SAS connection strings for the Event Hub. + def get( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Gets an Event Hubs description for the specified Event Hub. :param resource_group_name: Name of the resource group within the azure subscription. @@ -669,34 +686,23 @@ def regenerate_keys( :type namespace_name: str :param event_hub_name: The Event Hub name :type event_hub_name: str - :param authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str - :param key_type: The access key to regenerate. Possible values - include: 'PrimaryKey', 'SecondaryKey' - :type key_type: str or ~azure.mgmt.eventhub.v2017_04_01.models.KeyType - :param key: Optional, if the key value provided, is set for KeyType or - autogenerated Key value set for keyType - :type key: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or + :return: Eventhub or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) - # Construct URL - url = self.regenerate_keys.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), - 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', min_length=1), - 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_rule_name, 'str', min_length=1), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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) @@ -708,7 +714,6 @@ def regenerate_keys( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -716,11 +721,8 @@ def regenerate_keys( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -728,11 +730,11 @@ def regenerate_keys( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AccessKeys', response) + deserialized = self._deserialize('Eventhub', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py index aa22918f9d55..b04faa45a59b 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py @@ -40,90 +40,33 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): - """Check the give Namespace name availability. - - :param name: Name to check the namespace name availability - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - parameters = models.CheckNameAvailabilityParameter(name=name) - - # Construct URL - url = self.check_name_availability.metadata['url'] - 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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameter') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/CheckNameAvailability'} - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all the available Namespaces within a subscription, irrespective - of the resource groups. + def list_authorization_rules( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of 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 dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of EHNamespace + :return: An iterator like instance of AuthorizationRule :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespacePaged[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] + ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] :raises: :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list_authorization_rules.metadata['url'] path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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) @@ -164,88 +107,44 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.EHNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces'} + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules'} - def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): - """Lists the available Namespaces within a resource group. + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): + """Creates or updates an AuthorizationRule 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 rights: The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of EHNamespace - :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespacePaged[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] - 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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.EHNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces'} - + parameters = models.AuthorizationRule(rights=rights) - def _create_or_update_initial( - self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -266,89 +165,53 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'EHNamespace') + body_content = self._serialize.body(parameters, 'AuthorizationRule') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('EHNamespace', response) - if response.status_code == 201: - deserialized = self._deserialize('EHNamespace', response) + deserialized = self._deserialize('AuthorizationRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} - def create_or_update( - self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updates a namespace. Once created, this namespace's resource - manifest is immutable. This operation is idempotent. + def delete_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an AuthorizationRule 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: Parameters for creating a namespace resource. - :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns EHNamespace or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace]] + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('EHNamespace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} - - - def _delete_initial( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.delete.metadata['url'] + url = self.delete_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -370,82 +233,106 @@ def _delete_initial( request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} - def delete( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes an existing namespace. This operation also removes all - associated resources under the namespace. + def get_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule 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 :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - namespace_name=namespace_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) + # Construct URL + url = self.get_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - def get( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets the description of the specified namespace. + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} + + def list_keys( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """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 :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: EHNamespace or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get.metadata['url'] + url = self.list_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -465,53 +352,60 @@ def get( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 201]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('EHNamespace', response) - if response.status_code == 201: - deserialized = self._deserialize('EHNamespace', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys'} - def update( - self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a namespace. Once created, this namespace's resource - manifest is immutable. This operation is idempotent. + def regenerate_keys( + self, resource_group_name, namespace_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the primary or secondary connection strings 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 - :param parameters: Parameters for updating a namespace resource. - :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or ~azure.mgmt.eventhub.v2017_04_01.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: EHNamespace or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + # Construct URL - url = self.update.metadata['url'] + url = self.regenerate_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -532,53 +426,49 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'EHNamespace') + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('EHNamespace', response) - if response.status_code == 201: - deserialized = self._deserialize('EHNamespace', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} - def get_messaging_plan( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets messaging plan for specified namespace. + def check_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """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 name: Name to check the namespace name availability + :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: MessagingPlan or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingPlan or + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + parameters = models.CheckNameAvailabilityParameter(name=name) + # Construct URL - url = self.get_messaging_plan.metadata['url'] + url = self.check_name_availability.metadata['url'] path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_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) @@ -590,6 +480,7 @@ def get_messaging_plan( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -597,8 +488,11 @@ def get_messaging_plan( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameter') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -606,42 +500,105 @@ def get_messaging_plan( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MessagingPlan', response) + deserialized = self._deserialize('CheckNameAvailabilityResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_messaging_plan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability'} - def list_authorization_rules( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of authorization rules for a Namespace. + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the available Namespaces within a subscription, irrespective + of the resource groups. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of EHNamespace + :rtype: + ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespacePaged[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EHNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists 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 - :param namespace_name: The Namespace name - :type namespace_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of AuthorizationRule + :return: An iterator like instance of EHNamespace :rtype: - ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule] + ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespacePaged[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] :raises: :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_authorization_rules.metadata['url'] + url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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) @@ -682,44 +639,122 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.EHNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces'} - def create_or_update_authorization_rule( - self, resource_group_name, namespace_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): - """Creates or updates an AuthorizationRule for a Namespace. + + def _create_or_update_initial( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'EHNamespace') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('EHNamespace', response) + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a 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 authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str - :param rights: The rights associated with the rule. - :type rights: list[str or - ~azure.mgmt.eventhub.v2017_04_01.models.AccessRights] + :param parameters: Parameters for creating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AuthorizationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or - ~msrest.pipeline.ClientRawResponse + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns EHNamespace or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace]] :raises: :class:`ErrorResponseException` """ - parameters = models.AuthorizationRule(rights=rights) + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('EHNamespace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} + + + def _delete_initial( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.create_or_update_authorization_rule.metadata['url'] + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -730,8 +765,6 @@ def create_or_update_authorization_rule( # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -739,111 +772,86 @@ def create_or_update_authorization_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'AuthorizationRule') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AuthorizationRule', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} - - def delete_authorization_rule( - self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes an AuthorizationRule for a Namespace. + def delete( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, polling=True, **operation_config): + """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 - :param authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] :raises: :class:`ErrorResponseException` """ - # Construct URL - url = self.delete_authorization_rule.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + namespace_name=namespace_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) - if response.status_code not in [200, 204]: - raise models.ErrorResponseException(self._deserialize, response) + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} - def get_authorization_rule( - self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets an AuthorizationRule for a Namespace by rule name. + def get( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets the description of 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 authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AuthorizationRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule or + :return: EHNamespace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.get_authorization_rule.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -866,48 +874,50 @@ def get_authorization_rule( request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 201]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AuthorizationRule', response) + deserialized = self._deserialize('EHNamespace', response) + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} - def list_keys( - self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets the primary and secondary connection strings for the Namespace. + def update( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a 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 authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str + :param parameters: Parameters for updating a namespace resource. + :type parameters: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or + :return: EHNamespace or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_keys.metadata['url'] + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -919,6 +929,7 @@ def list_keys( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -926,61 +937,54 @@ def list_keys( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'EHNamespace') + # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 201, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AccessKeys', response) + deserialized = self._deserialize('EHNamespace', response) + if response.status_code == 201: + deserialized = self._deserialize('EHNamespace', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} - def regenerate_keys( - self, resource_group_name, namespace_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): - """Regenerates the primary or secondary connection strings for the - specified Namespace. + def get_messaging_plan( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets messaging plan for 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 authorization_rule_name: The authorization rule name. - :type authorization_rule_name: str - :param key_type: The access key to regenerate. Possible values - include: 'PrimaryKey', 'SecondaryKey' - :type key_type: str or ~azure.mgmt.eventhub.v2017_04_01.models.KeyType - :param key: Optional, if the key value provided, is set for KeyType or - autogenerated Key value set for keyType - :type key: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: AccessKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys or + :return: MessagingPlan or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingPlan or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) - # Construct URL - url = self.regenerate_keys.metadata['url'] + url = self.get_messaging_plan.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -992,7 +996,6 @@ def regenerate_keys( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -1000,11 +1003,8 @@ def regenerate_keys( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -1012,14 +1012,14 @@ def regenerate_keys( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('AccessKeys', response) + deserialized = self._deserialize('MessagingPlan', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'} + get_messaging_plan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/messagingplan'} def create_or_update_network_rule_set( self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -1149,3 +1149,75 @@ def get_network_rule_set( return deserialized get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} + + def list_network_rule_sets( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NetworkRuleSet + :rtype: + ~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSetPaged[~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSet] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_network_rule_sets.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.NetworkRuleSetPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_network_rule_sets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py index 2de5631fce6b..c83349d33ff5 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import EventHub2018PreviewManagementClientConfiguration -from ._event_hub2018_preview_management_client import EventHub2018PreviewManagementClient -__all__ = ['EventHub2018PreviewManagementClient', 'EventHub2018PreviewManagementClientConfiguration'] +from ._configuration import EventHubManagementClientConfiguration +from ._event_hub_management_client import EventHubManagementClient +__all__ = ['EventHubManagementClient', 'EventHubManagementClientConfiguration'] from .version import VERSION diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py index 7a17e91dfac1..9842ccd20b40 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py @@ -13,8 +13,8 @@ from .version import VERSION -class EventHub2018PreviewManagementClientConfiguration(AzureConfiguration): - """Configuration for EventHub2018PreviewManagementClient +class EventHubManagementClientConfiguration(AzureConfiguration): + """Configuration for EventHubManagementClient Note that all parameters used to create this instance are saved as instance attributes. @@ -38,7 +38,7 @@ def __init__( if not base_url: base_url = 'https://management.azure.com' - super(EventHub2018PreviewManagementClientConfiguration, self).__init__(base_url) + super(EventHubManagementClientConfiguration, self).__init__(base_url) # Starting Autorest.Python 4.0.64, make connection pool activated by default self.keep_alive = True diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub2018_preview_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py similarity index 59% rename from sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub2018_preview_management_client.py rename to sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py index 46f6b33b1411..f7f98a57a279 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub2018_preview_management_client.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py @@ -12,28 +12,40 @@ from msrest.service_client import SDKClient from msrest import Serializer, Deserializer -from ._configuration import EventHub2018PreviewManagementClientConfiguration -from .operations import Operations +from ._configuration import EventHubManagementClientConfiguration from .operations import ClustersOperations -from .operations import ConfigurationOperations from .operations import NamespacesOperations +from .operations import ConfigurationOperations +from .operations import DisasterRecoveryConfigsOperations +from .operations import EventHubsOperations +from .operations import ConsumerGroupsOperations +from .operations import Operations +from .operations import RegionsOperations from . import models -class EventHub2018PreviewManagementClient(SDKClient): - """Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules resources. +class EventHubManagementClient(SDKClient): + """EventHubManagementClient :ivar config: Configuration for client. - :vartype config: EventHub2018PreviewManagementClientConfiguration + :vartype config: EventHubManagementClientConfiguration - :ivar operations: Operations operations - :vartype operations: azure.mgmt.eventhub.v2018_01_01_preview.operations.Operations :ivar clusters: Clusters operations :vartype clusters: azure.mgmt.eventhub.v2018_01_01_preview.operations.ClustersOperations - :ivar configuration: Configuration operations - :vartype configuration: azure.mgmt.eventhub.v2018_01_01_preview.operations.ConfigurationOperations :ivar namespaces: Namespaces operations :vartype namespaces: azure.mgmt.eventhub.v2018_01_01_preview.operations.NamespacesOperations + :ivar configuration: Configuration operations + :vartype configuration: azure.mgmt.eventhub.v2018_01_01_preview.operations.ConfigurationOperations + :ivar disaster_recovery_configs: DisasterRecoveryConfigs operations + :vartype disaster_recovery_configs: azure.mgmt.eventhub.v2018_01_01_preview.operations.DisasterRecoveryConfigsOperations + :ivar event_hubs: EventHubs operations + :vartype event_hubs: azure.mgmt.eventhub.v2018_01_01_preview.operations.EventHubsOperations + :ivar consumer_groups: ConsumerGroups operations + :vartype consumer_groups: azure.mgmt.eventhub.v2018_01_01_preview.operations.ConsumerGroupsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.eventhub.v2018_01_01_preview.operations.Operations + :ivar regions: Regions operations + :vartype regions: azure.mgmt.eventhub.v2018_01_01_preview.operations.RegionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -48,19 +60,26 @@ class EventHub2018PreviewManagementClient(SDKClient): def __init__( self, credentials, subscription_id, base_url=None): - self.config = EventHub2018PreviewManagementClientConfiguration(credentials, subscription_id, base_url) - super(EventHub2018PreviewManagementClient, self).__init__(self.config.credentials, self.config) + self.config = EventHubManagementClientConfiguration(credentials, subscription_id, base_url) + super(EventHubManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-01-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) self.clusters = ClustersOperations( self._client, self.config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations( + self._client, self.config, self._serialize, self._deserialize) self.configuration = ConfigurationOperations( self._client, self.config, self._serialize, self._deserialize) - self.namespaces = NamespacesOperations( + 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.consumer_groups = ConsumerGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.regions = RegionsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py index 9d1ede2b9be6..e243dcd6dce6 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py @@ -10,89 +10,162 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AccessKeys + from ._models_py3 import ArmDisasterRecovery + from ._models_py3 import AuthorizationRule from ._models_py3 import AvailableCluster from ._models_py3 import AvailableClustersList + from ._models_py3 import CaptureDescription + from ._models_py3 import CheckNameAvailabilityParameter + from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import Cluster from ._models_py3 import ClusterQuotaConfigurationProperties from ._models_py3 import ClusterSku + from ._models_py3 import ConsumerGroup + from ._models_py3 import Destination from ._models_py3 import EHNamespace from ._models_py3 import EHNamespaceIdContainer from ._models_py3 import EHNamespaceIdListResult + from ._models_py3 import Encryption from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import Eventhub + from ._models_py3 import Identity from ._models_py3 import IpFilterRule + from ._models_py3 import KeyVaultProperties + from ._models_py3 import MessagingRegions + from ._models_py3 import MessagingRegionsProperties from ._models_py3 import NetworkRuleSet from ._models_py3 import NWRuleSetIpRules from ._models_py3 import NWRuleSetVirtualNetworkRules from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import RegenerateAccessKeyParameters from ._models_py3 import Resource from ._models_py3 import Sku from ._models_py3 import Subnet from ._models_py3 import TrackedResource from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): + from ._models import AccessKeys + from ._models import ArmDisasterRecovery + from ._models import AuthorizationRule from ._models import AvailableCluster from ._models import AvailableClustersList + from ._models import CaptureDescription + from ._models import CheckNameAvailabilityParameter + from ._models import CheckNameAvailabilityResult from ._models import Cluster from ._models import ClusterQuotaConfigurationProperties from ._models import ClusterSku + from ._models import ConsumerGroup + from ._models import Destination from ._models import EHNamespace from ._models import EHNamespaceIdContainer from ._models import EHNamespaceIdListResult + from ._models import Encryption from ._models import ErrorResponse, ErrorResponseException + from ._models import Eventhub + from ._models import Identity from ._models import IpFilterRule + from ._models import KeyVaultProperties + from ._models import MessagingRegions + from ._models import MessagingRegionsProperties from ._models import NetworkRuleSet from ._models import NWRuleSetIpRules from ._models import NWRuleSetVirtualNetworkRules from ._models import Operation from ._models import OperationDisplay + from ._models import RegenerateAccessKeyParameters from ._models import Resource from ._models import Sku from ._models import Subnet from ._models import TrackedResource from ._models import VirtualNetworkRule +from ._paged_models import ArmDisasterRecoveryPaged +from ._paged_models import AuthorizationRulePaged from ._paged_models import ClusterPaged +from ._paged_models import ConsumerGroupPaged from ._paged_models import EHNamespacePaged +from ._paged_models import EventhubPaged from ._paged_models import IpFilterRulePaged +from ._paged_models import MessagingRegionsPaged from ._paged_models import OperationPaged from ._paged_models import VirtualNetworkRulePaged -from ._event_hub2018_preview_management_client_enums import ( +from ._event_hub_management_client_enums import ( + IPAction, SkuName, SkuTier, - IPAction, + IdentityType, + KeySource, NetworkRuleIPAction, DefaultAction, + AccessRights, + KeyType, + UnavailableReason, + ProvisioningStateDR, + RoleDisasterRecovery, + EncodingCaptureDescription, + EntityStatus, ) __all__ = [ + 'AccessKeys', + 'ArmDisasterRecovery', + 'AuthorizationRule', 'AvailableCluster', 'AvailableClustersList', + 'CaptureDescription', + 'CheckNameAvailabilityParameter', + 'CheckNameAvailabilityResult', 'Cluster', 'ClusterQuotaConfigurationProperties', 'ClusterSku', + 'ConsumerGroup', + 'Destination', 'EHNamespace', 'EHNamespaceIdContainer', 'EHNamespaceIdListResult', + 'Encryption', 'ErrorResponse', 'ErrorResponseException', + 'Eventhub', + 'Identity', 'IpFilterRule', + 'KeyVaultProperties', + 'MessagingRegions', + 'MessagingRegionsProperties', 'NetworkRuleSet', 'NWRuleSetIpRules', 'NWRuleSetVirtualNetworkRules', 'Operation', 'OperationDisplay', + 'RegenerateAccessKeyParameters', 'Resource', 'Sku', 'Subnet', 'TrackedResource', 'VirtualNetworkRule', - 'OperationPaged', 'ClusterPaged', - 'EHNamespacePaged', 'IpFilterRulePaged', + 'EHNamespacePaged', 'VirtualNetworkRulePaged', + 'AuthorizationRulePaged', + 'ArmDisasterRecoveryPaged', + 'EventhubPaged', + 'ConsumerGroupPaged', + 'OperationPaged', + 'MessagingRegionsPaged', + 'IPAction', 'SkuName', 'SkuTier', - 'IPAction', + 'IdentityType', + 'KeySource', 'NetworkRuleIPAction', 'DefaultAction', + 'AccessRights', + 'KeyType', + 'UnavailableReason', + 'ProvisioningStateDR', + 'RoleDisasterRecovery', + 'EncodingCaptureDescription', + 'EntityStatus', ] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub2018_preview_management_client_enums.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub2018_preview_management_client_enums.py deleted file mode 100644 index c4fc0941ad4a..000000000000 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub2018_preview_management_client_enums.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class SkuName(str, Enum): - - basic = "Basic" - standard = "Standard" - - -class SkuTier(str, Enum): - - basic = "Basic" - standard = "Standard" - - -class IPAction(str, Enum): - - accept = "Accept" - reject = "Reject" - - -class NetworkRuleIPAction(str, Enum): - - allow = "Allow" - - -class DefaultAction(str, Enum): - - allow = "Allow" - deny = "Deny" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub_management_client_enums.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub_management_client_enums.py new file mode 100644 index 000000000000..58f147028288 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_event_hub_management_client_enums.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license 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 + + +class IPAction(str, Enum): + + accept = "Accept" + reject = "Reject" + + +class SkuName(str, Enum): + + basic = "Basic" + standard = "Standard" + + +class SkuTier(str, Enum): + + basic = "Basic" + standard = "Standard" + + +class IdentityType(str, Enum): + + system_assigned = "SystemAssigned" + + +class KeySource(str, Enum): + + microsoft_key_vault = "Microsoft.KeyVault" + + +class NetworkRuleIPAction(str, Enum): + + allow = "Allow" + + +class DefaultAction(str, Enum): + + allow = "Allow" + deny = "Deny" + + +class AccessRights(str, Enum): + + manage = "Manage" + send = "Send" + listen = "Listen" + + +class KeyType(str, Enum): + + primary_key = "PrimaryKey" + secondary_key = "SecondaryKey" + + +class UnavailableReason(str, Enum): + + none = "None" + invalid_name = "InvalidName" + subscription_is_disabled = "SubscriptionIsDisabled" + name_in_use = "NameInUse" + name_in_lockdown = "NameInLockdown" + too_many_namespace_in_current_subscription = "TooManyNamespaceInCurrentSubscription" + + +class ProvisioningStateDR(str, Enum): + + accepted = "Accepted" + succeeded = "Succeeded" + failed = "Failed" + + +class RoleDisasterRecovery(str, Enum): + + primary = "Primary" + primary_not_replicating = "PrimaryNotReplicating" + secondary = "Secondary" + + +class EncodingCaptureDescription(str, Enum): + + avro = "Avro" + avro_deflate = "AvroDeflate" + + +class EntityStatus(str, Enum): + + active = "Active" + disabled = "Disabled" + restoring = "Restoring" + send_disabled = "SendDisabled" + receive_disabled = "ReceiveDisabled" + creating = "Creating" + deleting = "Deleting" + renaming = "Renaming" + unknown = "Unknown" diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py index 199ddbc2b6b2..0c8377ab0a8f 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models.py @@ -13,6 +13,199 @@ from msrest.exceptions import HttpOperationError +class AccessKeys(Model): + """Namespace/EventHub 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 AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the + created namespace AuthorizationRule. + :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 AuthorizationRule. + :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 Resource(Model): + """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 + """ + + _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.eventhub.v2018_01_01_preview.models.ProvisioningStateDR + :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: Alternate name specified when alias and namespace + names are same. + :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.eventhub.v2018_01_01_preview.models.RoleDisasterRecovery + :ivar pending_replication_operations_count: Number of entities pending to + be replicated. + :vartype pending_replication_operations_count: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'role': {'readonly': True}, + 'pending_replication_operations_count': {'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': 'ProvisioningStateDR'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'RoleDisasterRecovery'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + } + + def __init__(self, **kwargs): + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.partner_namespace = kwargs.get('partner_namespace', None) + self.alternate_name = kwargs.get('alternate_name', None) + self.role = None + self.pending_replication_operations_count = None + + +class AuthorizationRule(Resource): + """Single item in a List or Get AuthorizationRule operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param rights: Required. The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'rights': {'required': 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(AuthorizationRule, self).__init__(**kwargs) + self.rights = kwargs.get('rights', None) + + class AvailableCluster(Model): """Pre-provisioned and readily available Event Hubs Cluster count per region. @@ -47,62 +240,139 @@ def __init__(self, **kwargs): self.value = kwargs.get('value', None) -class CloudError(Model): - """CloudError. +class CaptureDescription(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. Note: 'AvroDeflate' will be deprecated in New API + Version. Possible values include: 'Avro', 'AvroDeflate' + :type encoding: str or + ~azure.mgmt.eventhub.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 + :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 to 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.eventhub.v2018_01_01_preview.models.Destination + :param skip_empty_archives: A value that indicates whether to Skip Empty + Archives + :type skip_empty_archives: bool """ + _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': 'EncodingCaptureDescription'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + 'skip_empty_archives': {'key': 'skipEmptyArchives', 'type': 'bool'}, } + 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) + self.skip_empty_archives = kwargs.get('skip_empty_archives', None) -class Resource(Model): - """The Resource definition. + +class CheckNameAvailabilityParameter(Model): + """Parameter supplied to check Namespace name availability operation . + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name to check the namespace name availability + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckNameAvailabilityParameter, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class CheckNameAvailabilityResult(Model): + """The Result of the CheckNameAvailability 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 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.eventhub.v2018_01_01_preview.models.UnavailableReason """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'UnavailableReason'}, } def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } class TrackedResource(Resource): - """Definition of an Azure resource. + """Definition of resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] """ @@ -132,15 +402,15 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of the cluster SKU. :type sku: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ClusterSku @@ -237,24 +507,105 @@ def __init__(self, **kwargs): self.capacity = kwargs.get('capacity', None) +class ConsumerGroup(Resource): + """Single item in List or Get Consumer group 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 created_at: Exact time the message was created. + :vartype created_at: datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: datetime + :param user_metadata: User Metadata is a placeholder to store user-defined + string data with maximum length 1024. e.g. it can be used to store + descriptive data, such as list of teams and their contact information also + user-defined configuration settings can be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ConsumerGroup, self).__init__(**kwargs) + self.created_at = None + self.updated_at = None + self.user_metadata = kwargs.get('user_metadata', None) + + +class Destination(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 EHNamespace(TrackedResource): """Single Namespace item in List or Get Operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of sku resource :type sku: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Sku + :param identity: Properties of BYOK Identity description + :type identity: ~azure.mgmt.eventhub.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. @@ -264,6 +615,8 @@ class EHNamespace(TrackedResource): :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. :vartype service_bus_endpoint: str + :param cluster_arm_id: Cluster ARM ID of the Namespace. + :type cluster_arm_id: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str :param is_auto_inflate_enabled: Value that indicates whether AutoInflate @@ -279,6 +632,9 @@ class EHNamespace(TrackedResource): :param zone_redundant: Enabling this property creates a Standard Event Hubs Namespace in regions supported availability zones. :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description + :type encryption: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.Encryption """ _validation = { @@ -300,29 +656,35 @@ class EHNamespace(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + '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'}, + 'cluster_arm_id': {'key': 'properties.clusterArmId', 'type': 'str'}, 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, 'is_auto_inflate_enabled': {'key': 'properties.isAutoInflateEnabled', 'type': 'bool'}, 'maximum_throughput_units': {'key': 'properties.maximumThroughputUnits', 'type': 'int'}, 'kafka_enabled': {'key': 'properties.kafkaEnabled', 'type': 'bool'}, 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, } def __init__(self, **kwargs): super(EHNamespace, 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.cluster_arm_id = kwargs.get('cluster_arm_id', None) self.metric_id = None self.is_auto_inflate_enabled = kwargs.get('is_auto_inflate_enabled', None) self.maximum_throughput_units = kwargs.get('maximum_throughput_units', None) self.kafka_enabled = kwargs.get('kafka_enabled', None) self.zone_redundant = kwargs.get('zone_redundant', None) + self.encryption = kwargs.get('encryption', None) class EHNamespaceIdContainer(Model): @@ -358,8 +720,32 @@ def __init__(self, **kwargs): self.value = kwargs.get('value', None) +class Encryption(Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault + :type key_vault_properties: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for + Encryption. Possible values include: 'Microsoft.KeyVault'. Default value: + "Microsoft.KeyVault" . + :type key_source: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeySource + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'key_source': {'key': 'keySource', 'type': 'KeySource'}, + } + + 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 ErrorResponse(Model): - """Error response that indicates the service is not able to process the + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. :param code: Error code. @@ -391,17 +777,114 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +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 + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: 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 the Event + Hub. Possible values include: 'Active', 'Disabled', 'Restoring', + 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', + 'Unknown' + :type status: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.EntityStatus + :param capture_description: Properties of capture description + :type capture_description: + ~azure.mgmt.eventhub.v2018_01_01_preview.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': {'minimum': 1}, + 'partition_count': {'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': 'EntityStatus'}, + '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 Identity(Model): + """Properties to configure Identity for Bring your Own Keys. + + :param principal_id: ObjectId from the KeyVault + :type principal_id: str + :param tenant_id: TenantId from the KeyVault + :type tenant_id: str + :param type: Enumerates the possible value Identity type, which currently + supports only 'SystemAssigned'. Possible values include: 'SystemAssigned'. + Default value: "SystemAssigned" . + :type type: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.IdentityType + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'IdentityType'}, + } + + def __init__(self, **kwargs): + 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): """Single item in a List or Get IpFilterRules operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param ip_mask: IP Mask :type ip_mask: str @@ -435,17 +918,106 @@ def __init__(self, **kwargs): self.filter_name = kwargs.get('filter_name', None) +class KeyVaultProperties(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 + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + 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) + + +class MessagingRegions(TrackedResource): + """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: Resource tags. + :type tags: dict[str, str] + :param properties: Properties of Messaging Region + :type properties: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.MessagingRegionsProperties + """ + + _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': 'MessagingRegionsProperties'}, + } + + def __init__(self, **kwargs): + super(MessagingRegions, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MessagingRegionsProperties(Model): + """Properties of Messaging Region. + + 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(MessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + class NetworkRuleSet(Resource): """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' @@ -585,6 +1157,36 @@ def __init__(self, **kwargs): self.operation = None +class RegenerateAccessKeyParameters(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.eventhub.v2018_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'KeyType'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs.get('key_type', None) + self.key = kwargs.get('key', None) + + class Sku(Model): """SKU parameters supplied to the create namespace operation. @@ -641,11 +1243,11 @@ class VirtualNetworkRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param virtual_network_subnet_id: ARM ID of Virtual Network Subnet :type virtual_network_subnet_id: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py index ff2686722b95..8a3b87cf5eb0 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py @@ -13,6 +13,199 @@ from msrest.exceptions import HttpOperationError +class AccessKeys(Model): + """Namespace/EventHub 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 AuthorizationRule. + :vartype primary_connection_string: str + :ivar secondary_connection_string: Secondary connection string of the + created namespace AuthorizationRule. + :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 AuthorizationRule. + :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) -> None: + 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 Resource(Model): + """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 + """ + + _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) -> None: + 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.eventhub.v2018_01_01_preview.models.ProvisioningStateDR + :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: Alternate name specified when alias and namespace + names are same. + :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.eventhub.v2018_01_01_preview.models.RoleDisasterRecovery + :ivar pending_replication_operations_count: Number of entities pending to + be replicated. + :vartype pending_replication_operations_count: long + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'role': {'readonly': True}, + 'pending_replication_operations_count': {'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': 'ProvisioningStateDR'}, + 'partner_namespace': {'key': 'properties.partnerNamespace', 'type': 'str'}, + 'alternate_name': {'key': 'properties.alternateName', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'RoleDisasterRecovery'}, + 'pending_replication_operations_count': {'key': 'properties.pendingReplicationOperationsCount', 'type': 'long'}, + } + + def __init__(self, *, partner_namespace: str=None, alternate_name: str=None, **kwargs) -> None: + super(ArmDisasterRecovery, self).__init__(**kwargs) + self.provisioning_state = None + self.partner_namespace = partner_namespace + self.alternate_name = alternate_name + self.role = None + self.pending_replication_operations_count = None + + +class AuthorizationRule(Resource): + """Single item in a List or Get AuthorizationRule operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param rights: Required. The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'rights': {'required': 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, **kwargs) -> None: + super(AuthorizationRule, self).__init__(**kwargs) + self.rights = rights + + class AvailableCluster(Model): """Pre-provisioned and readily available Event Hubs Cluster count per region. @@ -47,62 +240,139 @@ def __init__(self, *, value=None, **kwargs) -> None: self.value = value -class CloudError(Model): - """CloudError. +class CaptureDescription(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. Note: 'AvroDeflate' will be deprecated in New API + Version. Possible values include: 'Avro', 'AvroDeflate' + :type encoding: str or + ~azure.mgmt.eventhub.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 + :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 to 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.eventhub.v2018_01_01_preview.models.Destination + :param skip_empty_archives: A value that indicates whether to Skip Empty + Archives + :type skip_empty_archives: bool """ + _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': 'EncodingCaptureDescription'}, + 'interval_in_seconds': {'key': 'intervalInSeconds', 'type': 'int'}, + 'size_limit_in_bytes': {'key': 'sizeLimitInBytes', 'type': 'int'}, + 'destination': {'key': 'destination', 'type': 'Destination'}, + 'skip_empty_archives': {'key': 'skipEmptyArchives', 'type': 'bool'}, } + def __init__(self, *, enabled: bool=None, encoding=None, interval_in_seconds: int=None, size_limit_in_bytes: int=None, destination=None, skip_empty_archives: bool=None, **kwargs) -> None: + 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 + self.skip_empty_archives = skip_empty_archives -class Resource(Model): - """The Resource definition. + +class CheckNameAvailabilityParameter(Model): + """Parameter supplied to check Namespace name availability operation . + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name to check the namespace name availability + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, **kwargs) -> None: + super(CheckNameAvailabilityParameter, self).__init__(**kwargs) + self.name = name + + +class CheckNameAvailabilityResult(Model): + """The Result of the CheckNameAvailability 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 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.eventhub.v2018_01_01_preview.models.UnavailableReason """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'UnavailableReason'}, } - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__(self, *, name_available: bool=None, reason=None, **kwargs) -> None: + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.message = None + self.name_available = name_available + self.reason = reason + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } class TrackedResource(Resource): - """Definition of an Azure resource. + """Definition of resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] """ @@ -132,15 +402,15 @@ class Cluster(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of the cluster SKU. :type sku: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ClusterSku @@ -237,24 +507,105 @@ def __init__(self, *, capacity: int=None, **kwargs) -> None: self.capacity = capacity +class ConsumerGroup(Resource): + """Single item in List or Get Consumer group 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 created_at: Exact time the message was created. + :vartype created_at: datetime + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: datetime + :param user_metadata: User Metadata is a placeholder to store user-defined + string data with maximum length 1024. e.g. it can be used to store + descriptive data, such as list of teams and their contact information also + user-defined configuration settings can be stored. + :type user_metadata: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, + 'updated_at': {'key': 'properties.updatedAt', 'type': 'iso-8601'}, + 'user_metadata': {'key': 'properties.userMetadata', 'type': 'str'}, + } + + def __init__(self, *, user_metadata: str=None, **kwargs) -> None: + super(ConsumerGroup, self).__init__(**kwargs) + self.created_at = None + self.updated_at = None + self.user_metadata = user_metadata + + +class Destination(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: str=None, storage_account_resource_id: str=None, blob_container: str=None, archive_name_format: str=None, **kwargs) -> None: + 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 EHNamespace(TrackedResource): """Single Namespace item in List or Get Operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str - :param location: Resource location + :param location: Resource location. :type location: str - :param tags: Resource tags + :param tags: Resource tags. :type tags: dict[str, str] :param sku: Properties of sku resource :type sku: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Sku + :param identity: Properties of BYOK Identity description + :type identity: ~azure.mgmt.eventhub.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. @@ -264,6 +615,8 @@ class EHNamespace(TrackedResource): :ivar service_bus_endpoint: Endpoint you can use to perform Service Bus operations. :vartype service_bus_endpoint: str + :param cluster_arm_id: Cluster ARM ID of the Namespace. + :type cluster_arm_id: str :ivar metric_id: Identifier for Azure Insights metrics. :vartype metric_id: str :param is_auto_inflate_enabled: Value that indicates whether AutoInflate @@ -279,6 +632,9 @@ class EHNamespace(TrackedResource): :param zone_redundant: Enabling this property creates a Standard Event Hubs Namespace in regions supported availability zones. :type zone_redundant: bool + :param encryption: Properties of BYOK Encryption description + :type encryption: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.Encryption """ _validation = { @@ -300,29 +656,35 @@ class EHNamespace(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + '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'}, + 'cluster_arm_id': {'key': 'properties.clusterArmId', 'type': 'str'}, 'metric_id': {'key': 'properties.metricId', 'type': 'str'}, 'is_auto_inflate_enabled': {'key': 'properties.isAutoInflateEnabled', 'type': 'bool'}, 'maximum_throughput_units': {'key': 'properties.maximumThroughputUnits', 'type': 'int'}, 'kafka_enabled': {'key': 'properties.kafkaEnabled', 'type': 'bool'}, 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + 'encryption': {'key': 'properties.encryption', 'type': 'Encryption'}, } - def __init__(self, *, location: str=None, tags=None, sku=None, is_auto_inflate_enabled: bool=None, maximum_throughput_units: int=None, kafka_enabled: bool=None, zone_redundant: bool=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, sku=None, identity=None, cluster_arm_id: str=None, is_auto_inflate_enabled: bool=None, maximum_throughput_units: int=None, kafka_enabled: bool=None, zone_redundant: bool=None, encryption=None, **kwargs) -> None: super(EHNamespace, 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.cluster_arm_id = cluster_arm_id self.metric_id = None self.is_auto_inflate_enabled = is_auto_inflate_enabled self.maximum_throughput_units = maximum_throughput_units self.kafka_enabled = kafka_enabled self.zone_redundant = zone_redundant + self.encryption = encryption class EHNamespaceIdContainer(Model): @@ -358,8 +720,32 @@ def __init__(self, *, value=None, **kwargs) -> None: self.value = value +class Encryption(Model): + """Properties to configure Encryption. + + :param key_vault_properties: Properties of KeyVault + :type key_vault_properties: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeyVaultProperties + :param key_source: Enumerates the possible value of keySource for + Encryption. Possible values include: 'Microsoft.KeyVault'. Default value: + "Microsoft.KeyVault" . + :type key_source: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeySource + """ + + _attribute_map = { + 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'key_source': {'key': 'keySource', 'type': 'KeySource'}, + } + + def __init__(self, *, key_vault_properties=None, key_source="Microsoft.KeyVault", **kwargs) -> None: + super(Encryption, self).__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.key_source = key_source + + class ErrorResponse(Model): - """Error response that indicates the service is not able to process the + """Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. :param code: Error code. @@ -391,17 +777,114 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +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 + :ivar updated_at: The exact time the message was updated. + :vartype updated_at: 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 the Event + Hub. Possible values include: 'Active', 'Disabled', 'Restoring', + 'SendDisabled', 'ReceiveDisabled', 'Creating', 'Deleting', 'Renaming', + 'Unknown' + :type status: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.EntityStatus + :param capture_description: Properties of capture description + :type capture_description: + ~azure.mgmt.eventhub.v2018_01_01_preview.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': {'minimum': 1}, + 'partition_count': {'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': 'EntityStatus'}, + 'capture_description': {'key': 'properties.captureDescription', 'type': 'CaptureDescription'}, + } + + def __init__(self, *, message_retention_in_days: int=None, partition_count: int=None, status=None, capture_description=None, **kwargs) -> None: + 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 Identity(Model): + """Properties to configure Identity for Bring your Own Keys. + + :param principal_id: ObjectId from the KeyVault + :type principal_id: str + :param tenant_id: TenantId from the KeyVault + :type tenant_id: str + :param type: Enumerates the possible value Identity type, which currently + supports only 'SystemAssigned'. Possible values include: 'SystemAssigned'. + Default value: "SystemAssigned" . + :type type: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.IdentityType + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'IdentityType'}, + } + + def __init__(self, *, principal_id: str=None, tenant_id: str=None, type="SystemAssigned", **kwargs) -> None: + super(Identity, self).__init__(**kwargs) + self.principal_id = principal_id + self.tenant_id = tenant_id + self.type = type + + class IpFilterRule(Resource): """Single item in a List or Get IpFilterRules operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param ip_mask: IP Mask :type ip_mask: str @@ -435,17 +918,106 @@ def __init__(self, *, ip_mask: str=None, action=None, filter_name: str=None, **k self.filter_name = filter_name +class KeyVaultProperties(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 + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__(self, *, key_name: str=None, key_vault_uri: str=None, **kwargs) -> None: + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = key_name + self.key_vault_uri = key_vault_uri + + +class MessagingRegions(TrackedResource): + """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: Resource tags. + :type tags: dict[str, str] + :param properties: Properties of Messaging Region + :type properties: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.MessagingRegionsProperties + """ + + _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': 'MessagingRegionsProperties'}, + } + + def __init__(self, *, location: str=None, tags=None, properties=None, **kwargs) -> None: + super(MessagingRegions, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + + +class MessagingRegionsProperties(Model): + """Properties of Messaging Region. + + 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) -> None: + super(MessagingRegionsProperties, self).__init__(**kwargs) + self.code = None + self.full_name = None + + class NetworkRuleSet(Resource): """Description of topic resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param default_action: Default Action for Network Rule Set. Possible values include: 'Allow', 'Deny' @@ -585,6 +1157,36 @@ def __init__(self, **kwargs) -> None: self.operation = None +class RegenerateAccessKeyParameters(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.eventhub.v2018_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'KeyType'}, + 'key': {'key': 'key', 'type': 'str'}, + } + + def __init__(self, *, key_type, key: str=None, **kwargs) -> None: + super(RegenerateAccessKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + self.key = key + + class Sku(Model): """SKU parameters supplied to the create namespace operation. @@ -641,11 +1243,11 @@ class VirtualNetworkRule(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str - :ivar name: Resource name + :ivar name: Resource name. :vartype name: str - :ivar type: Resource type + :ivar type: Resource type. :vartype type: str :param virtual_network_subnet_id: ARM ID of Virtual Network Subnet :type virtual_network_subnet_id: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_paged_models.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_paged_models.py index ea31956f6882..b62ea2d96e4a 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_paged_models.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_paged_models.py @@ -12,32 +12,32 @@ from msrest.paging import Paged -class OperationPaged(Paged): +class ClusterPaged(Paged): """ - A paging container for iterating over a list of :class:`Operation ` object + A paging container for iterating over a list of :class:`Cluster ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} + 'current_page': {'key': 'value', 'type': '[Cluster]'} } def __init__(self, *args, **kwargs): - super(OperationPaged, self).__init__(*args, **kwargs) -class ClusterPaged(Paged): + super(ClusterPaged, self).__init__(*args, **kwargs) +class IpFilterRulePaged(Paged): """ - A paging container for iterating over a list of :class:`Cluster ` object + A paging container for iterating over a list of :class:`IpFilterRule ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Cluster]'} + 'current_page': {'key': 'value', 'type': '[IpFilterRule]'} } def __init__(self, *args, **kwargs): - super(ClusterPaged, self).__init__(*args, **kwargs) + super(IpFilterRulePaged, self).__init__(*args, **kwargs) class EHNamespacePaged(Paged): """ A paging container for iterating over a list of :class:`EHNamespace ` object @@ -51,29 +51,94 @@ class EHNamespacePaged(Paged): def __init__(self, *args, **kwargs): super(EHNamespacePaged, self).__init__(*args, **kwargs) -class IpFilterRulePaged(Paged): +class VirtualNetworkRulePaged(Paged): """ - A paging container for iterating over a list of :class:`IpFilterRule ` object + A paging container for iterating over a list of :class:`VirtualNetworkRule ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[IpFilterRule]'} + 'current_page': {'key': 'value', 'type': '[VirtualNetworkRule]'} } def __init__(self, *args, **kwargs): - super(IpFilterRulePaged, self).__init__(*args, **kwargs) -class VirtualNetworkRulePaged(Paged): + super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs) +class AuthorizationRulePaged(Paged): """ - A paging container for iterating over a list of :class:`VirtualNetworkRule ` object + A paging container for iterating over a list of :class:`AuthorizationRule ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[VirtualNetworkRule]'} + 'current_page': {'key': 'value', 'type': '[AuthorizationRule]'} } def __init__(self, *args, **kwargs): - super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs) + super(AuthorizationRulePaged, self).__init__(*args, **kwargs) +class ArmDisasterRecoveryPaged(Paged): + """ + A paging container for iterating over a list of :class:`ArmDisasterRecovery ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ArmDisasterRecovery]'} + } + + def __init__(self, *args, **kwargs): + + super(ArmDisasterRecoveryPaged, self).__init__(*args, **kwargs) +class EventhubPaged(Paged): + """ + A paging container for iterating over a list of :class:`Eventhub ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Eventhub]'} + } + + def __init__(self, *args, **kwargs): + + super(EventhubPaged, self).__init__(*args, **kwargs) +class ConsumerGroupPaged(Paged): + """ + A paging container for iterating over a list of :class:`ConsumerGroup ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ConsumerGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(ConsumerGroupPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class MessagingRegionsPaged(Paged): + """ + A paging container for iterating over a list of :class:`MessagingRegions ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MessagingRegions]'} + } + + def __init__(self, *args, **kwargs): + + super(MessagingRegionsPaged, self).__init__(*args, **kwargs) diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py index 26eaeba3af50..fcf9c2abbb04 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py @@ -9,14 +9,22 @@ # regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations from ._clusters_operations import ClustersOperations -from ._configuration_operations import ConfigurationOperations from ._namespaces_operations import NamespacesOperations +from ._configuration_operations import ConfigurationOperations +from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations +from ._event_hubs_operations import EventHubsOperations +from ._consumer_groups_operations import ConsumerGroupsOperations +from ._operations import Operations +from ._regions_operations import RegionsOperations __all__ = [ - 'Operations', 'ClustersOperations', - 'ConfigurationOperations', 'NamespacesOperations', + 'ConfigurationOperations', + 'DisasterRecoveryConfigsOperations', + 'EventHubsOperations', + 'ConsumerGroupsOperations', + 'Operations', + 'RegionsOperations', ] diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py index 46f91ed6c584..addeb7bfb8eb 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py @@ -26,7 +26,7 @@ class ClustersOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-01-01-preview". + :ivar api_version: Client API Version. Constant value: "2018-01-01-preview". """ models = models @@ -101,7 +101,7 @@ def list_by_resource_group( """Lists the available Event Hubs Clusters within an ARM resource group. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -170,7 +170,7 @@ def get( """Gets the resource description of the specified Event Hubs Cluster. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str @@ -277,7 +277,7 @@ def put( """Creates or updates an instance of an Event Hubs Cluster. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str @@ -377,7 +377,7 @@ def patch( is idempotent. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str @@ -467,7 +467,7 @@ def delete( """Deletes an existing Event Hubs Cluster. This operation is idempotent. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str @@ -510,7 +510,7 @@ def list_namespaces( """List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py index 289d9d2f5f86..9768c776c765 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py @@ -24,7 +24,7 @@ class ConfigurationOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-01-01-preview". + :ivar api_version: Client API Version. Constant value: "2018-01-01-preview". """ models = models @@ -45,7 +45,7 @@ def patch( body unmodified. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str @@ -121,7 +121,7 @@ def get( which represent the quotas and settings imposed on the cluster. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param cluster_name: The name of the Event Hubs Cluster. :type cluster_name: str diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py new file mode 100644 index 000000000000..25a8d6fb7cf3 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py @@ -0,0 +1,333 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ConsumerGroupsOperations(object): + """ConsumerGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as 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. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def create_or_update( + self, resource_group_name, namespace_name, event_hub_name, consumer_group_name, user_metadata=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates an Event Hubs consumer group as a nested resource + 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param consumer_group_name: The consumer group name + :type consumer_group_name: str + :param user_metadata: User Metadata is a placeholder to store + user-defined string data with maximum length 1024. e.g. it can be used + to store descriptive data, such as list of teams and their contact + information also user-defined configuration settings can be stored. + :type user_metadata: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConsumerGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.ConsumerGroup(user_metadata=user_metadata) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ConsumerGroup') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConsumerGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} + + def delete( + self, resource_group_name, namespace_name, event_hub_name, consumer_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes a consumer group from the specified Event Hub 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param consumer_group_name: The consumer group name + :type consumer_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} + + def get( + self, resource_group_name, namespace_name, event_hub_name, consumer_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a description for the specified consumer 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param consumer_group_name: The consumer group name + :type consumer_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ConsumerGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'consumerGroupName': self._serialize.url("consumer_group_name", consumer_group_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConsumerGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}'} + + def list_by_event_hub( + self, resource_group_name, namespace_name, event_hub_name, skip=None, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all the consumer groups in a Namespace. An empty feed is returned + if no consumer group exists in 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 event_hub_name: The Event Hub name + :type event_hub_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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ConsumerGroup + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroupPaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_event_hub.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ConsumerGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_event_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py new file mode 100644 index 000000000000..de5885f24913 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py @@ -0,0 +1,704 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class DisasterRecoveryConfigsOperations(object): + """DisasterRecoveryConfigsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as 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. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_authorization_rules( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """Gets a list of 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules'} + + def get_authorization_rule( + self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}'} + + def list_keys( + self, resource_group_name, namespace_name, alias, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys'} + + def check_name_availability( + self, resource_group_name, namespace_name, name, custom_headers=None, raw=False, **operation_config): + """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 name: Name to check the namespace name availability + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.CheckNameAvailabilityParameter(name=name) + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameter') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/checkNameAvailability'} + + def list( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ArmDisasterRecovery + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecoveryPaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ArmDisasterRecoveryPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs'} + + def create_or_update( + self, resource_group_name, namespace_name, alias, partner_namespace=None, alternate_name=None, custom_headers=None, raw=False, **operation_config): + """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 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: Alternate name specified when alias and + namespace names are same. + :type alternate_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ArmDisasterRecovery or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.ArmDisasterRecovery(partner_namespace=partner_namespace, alternate_name=alternate_name) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ArmDisasterRecovery') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} + + def delete( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} + + def get( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ArmDisasterRecovery or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArmDisasterRecovery', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}'} + + def break_pairing( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.break_pairing.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + break_pairing.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing'} + + def fail_over( + self, resource_group_name, namespace_name, alias, custom_headers=None, raw=False, **operation_config): + """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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.fail_over.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + fail_over.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py new file mode 100644 index 000000000000..fc554266f09e --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py @@ -0,0 +1,744 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class EventHubsOperations(object): + """EventHubsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as 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. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_authorization_rules( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Gets the authorization rules for an Event Hub. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AuthorizationRule + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_authorization_rules.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules'} + + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): + """Creates or updates an AuthorizationRule for the specified Event Hub. + Creation/update of the AuthorizationRule will take a few seconds to + take effect. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.AuthorizationRule(rights=rights) + + # Construct URL + url = self.create_or_update_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AuthorizationRule') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + + def get_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule for an Event Hub 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AuthorizationRule or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AuthorizationRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + + def delete_authorization_rule( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an Event Hub AuthorizationRule. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete_authorization_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}'} + + def list_keys( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/listKeys'} + + def regenerate_keys( + self, resource_group_name, namespace_name, event_hub_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the ACS and SAS connection strings for the Event Hub. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + + # Construct URL + url = self.regenerate_keys.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_name, 'str', max_length=50, min_length=1), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} + + def list_by_namespace( + self, resource_group_name, namespace_name, skip=None, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all the Event Hubs 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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Eventhub + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.EventhubPaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_namespace.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.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) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.EventhubPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_namespace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs'} + + def create_or_update( + self, resource_group_name, namespace_name, event_hub_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a new Event Hub as a nested resource 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param parameters: Parameters supplied to create an Event Hub + resource. + :type parameters: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Eventhub or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Eventhub') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Eventhub', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} + + def delete( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Deletes an Event Hub 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 event_hub_name: The Event Hub name + :type event_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} + + def get( + self, resource_group_name, namespace_name, event_hub_name, custom_headers=None, raw=False, **operation_config): + """Gets an Event Hubs description for the specified Event Hub. + + :param resource_group_name: Name of the resource group within the + azure subscription. + :type resource_group_name: str + :param namespace_name: The Namespace name + :type namespace_name: str + :param event_hub_name: The Event Hub name + :type event_hub_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Eventhub or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), + 'eventHubName': self._serialize.url("event_hub_name", event_hub_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Eventhub', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py index 9bbcc08d269e..684edce51763 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py @@ -26,7 +26,6 @@ class NamespacesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-01-01-preview". """ models = models @@ -36,10 +35,280 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-01-01-preview" self.config = config + def list_ip_filter_rules( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of IpFilterRule + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule] + :raises: + :class:`ErrorResponseException` + """ + api_version = "2018-01-01-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_ip_filter_rules.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.IpFilterRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_ip_filter_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules'} + + def create_or_update_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """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.eventhub.v2018_01_01_preview.models.IpFilterRule + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: IpFilterRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + api_version = "2018-01-01-preview" + + # Construct URL + url = self.create_or_update_ip_filter_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'IpFilterRule') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IpFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + + def delete_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + api_version = "2018-01-01-preview" + + # Construct URL + url = self.delete_ip_filter_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + + def get_ip_filter_rule( + self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: IpFilterRule or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + api_version = "2018-01-01-preview" + + # Construct URL + url = self.get_ip_filter_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IpFilterRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + def list( self, custom_headers=None, raw=False, **operation_config): """Lists all the available Namespaces within a subscription, irrespective @@ -56,6 +325,8 @@ def list( :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -67,7 +338,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -111,7 +382,7 @@ def list_by_resource_group( """Lists the available Namespaces within a resource group. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -124,6 +395,8 @@ def list_by_resource_group( :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -136,7 +409,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -178,6 +451,8 @@ def internal_paging(next_link=None): def _create_or_update_initial( self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2018-01-01-preview" + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -189,7 +464,7 @@ def _create_or_update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -231,7 +506,7 @@ def create_or_update( manifest is immutable. This operation is idempotent. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -282,6 +557,8 @@ def get_long_running_output(response): def _delete_initial( self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + api_version = "2018-01-01-preview" + # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -293,7 +570,7 @@ def _delete_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -321,7 +598,7 @@ def delete( associated resources under the namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -364,7 +641,7 @@ def get( """Gets the description of the specified namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -379,6 +656,8 @@ def get( :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -390,7 +669,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -428,7 +707,7 @@ def update( manifest is immutable. This operation is idempotent. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -446,6 +725,8 @@ def update( :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -457,7 +738,7 @@ def update( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -493,12 +774,12 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'} - def list_ip_filter_rules( + def list_virtual_network_rules( self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of IP Filter rules for a Namespace. + """Gets a list of VirtualNetwork rules for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -507,16 +788,18 @@ def list_ip_filter_rules( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of IpFilterRule + :return: An iterator like instance of VirtualNetworkRule :rtype: - ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule] + ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule] :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_ip_filter_rules.metadata['url'] + url = self.list_virtual_network_rules.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), @@ -526,7 +809,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -546,68 +829,200 @@ def prepare_request(next_link=None): request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - request = prepare_request(next_link) + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.VirtualNetworkRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_virtual_network_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules'} + + def create_or_update_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, virtual_network_subnet_id=None, custom_headers=None, raw=False, **operation_config): + """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 virtual_network_subnet_id: ARM ID of Virtual Network Subnet + :type virtual_network_subnet_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VirtualNetworkRule or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id) + + api_version = "2018-01-01-preview" + + # Construct URL + url = self.create_or_update_virtual_network_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'VirtualNetworkRule') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualNetworkRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + + def delete_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + api_version = "2018-01-01-preview" + + # Construct URL + url = self.delete_virtual_network_rule.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - response = self._client.send(request, stream=False, **operation_config) + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) - return response + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) - # Deserialize response - header_dict = None if raw: - header_dict = {} - deserialized = models.IpFilterRulePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_ip_filter_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules'} + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} - def create_or_update_ip_filter_rule( - self, resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates an IpFilterRule for a Namespace. + def get_virtual_network_rule( + self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an VirtualNetworkRule for a Namespace by rule name. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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.eventhub.v2018_01_01_preview.models.IpFilterRule + :param virtual_network_rule_name: The Virtual Network Rule name. + :type virtual_network_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: IpFilterRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule - or ~msrest.pipeline.ClientRawResponse + :return: VirtualNetworkRule or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + # Construct URL - url = self.create_or_update_ip_filter_rule.metadata['url'] + url = self.get_virtual_network_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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), + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -615,11 +1030,8 @@ def create_or_update_ip_filter_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'IpFilterRule') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -627,52 +1039,57 @@ def create_or_update_ip_filter_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IpFilterRule', response) + deserialized = self._deserialize('VirtualNetworkRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + get_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} - def delete_ip_filter_rule( - self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes an IpFilterRule for a Namespace. + def create_or_update_network_rule_set( + self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create or update NetworkRuleSet for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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.eventhub.v2018_01_01_preview.models.NetworkRuleSet :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse + :return: NetworkRuleSet or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + # Construct URL - url = self.delete_ip_filter_rule.metadata['url'] + url = self.create_or_update_network_rule_set.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -680,53 +1097,61 @@ def delete_ip_filter_rule( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'NetworkRuleSet') + # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 204]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('NetworkRuleSet', response) + if raw: - client_raw_response = ClientRawResponse(None, response) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response - delete_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} - def get_ip_filter_rule( - self, resource_group_name, namespace_name, ip_filter_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets an IpFilterRule for a Namespace by rule name. + return deserialized + create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} + + def get_network_rule_set( + self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): + """Gets NetworkRuleSet for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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 dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: IpFilterRule or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule + :return: NetworkRuleSet or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + api_version = "2018-01-01-preview" + # Construct URL - url = self.get_ip_filter_rule.metadata['url'] + url = self.get_network_rule_set.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -747,21 +1172,21 @@ def get_ip_filter_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IpFilterRule', response) + deserialized = self._deserialize('NetworkRuleSet', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_ip_filter_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'} + get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} - def list_virtual_network_rules( + def list_authorization_rules( self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of VirtualNetwork rules for a Namespace. + """Gets a list of authorization rules for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + azure subscription. :type resource_group_name: str :param namespace_name: The Namespace name :type namespace_name: str @@ -770,16 +1195,18 @@ def list_virtual_network_rules( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of VirtualNetworkRule + :return: An iterator like instance of AuthorizationRule :rtype: - ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule] + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRulePaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule] :raises: :class:`ErrorResponseException` """ + api_version = "2017-04-01" + def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_virtual_network_rules.metadata['url'] + url = self.list_authorization_rules.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str', max_length=50, min_length=6), @@ -789,7 +1216,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -823,51 +1250,54 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.VirtualNetworkRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.AuthorizationRulePaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_virtual_network_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules'} + list_authorization_rules.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules'} - def create_or_update_virtual_network_rule( - self, resource_group_name, namespace_name, virtual_network_rule_name, virtual_network_subnet_id=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates an VirtualNetworkRule for a Namespace. + def create_or_update_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, rights, custom_headers=None, raw=False, **operation_config): + """Creates or updates an AuthorizationRule for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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 virtual_network_subnet_id: ARM ID of Virtual Network Subnet - :type virtual_network_subnet_id: str + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str + :param rights: The rights associated with the rule. + :type rights: list[str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessRights] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: VirtualNetworkRule or ClientRawResponse if raw=true + :return: AuthorizationRule or ClientRawResponse if raw=true :rtype: - ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ - parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id) + parameters = models.AuthorizationRule(rights=rights) + + api_version = "2017-04-01" # Construct URL - url = self.create_or_update_virtual_network_rule.metadata['url'] + url = self.create_or_update_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -881,7 +1311,7 @@ def create_or_update_virtual_network_rule( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'VirtualNetworkRule') + body_content = self._serialize.body(parameters, 'AuthorizationRule') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -892,26 +1322,26 @@ def create_or_update_virtual_network_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkRule', response) + deserialized = self._deserialize('AuthorizationRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + create_or_update_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} - def delete_virtual_network_rule( - self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes an VirtualNetworkRule for a Namespace. + def delete_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes an AuthorizationRule for a Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -922,19 +1352,21 @@ def delete_virtual_network_rule( :raises: :class:`ErrorResponseException` """ + api_version = "2017-04-01" + # Construct URL - url = self.delete_virtual_network_rule.metadata['url'] + url = self.delete_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -955,44 +1387,46 @@ def delete_virtual_network_rule( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + delete_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} - def get_virtual_network_rule( - self, resource_group_name, namespace_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): - """Gets an VirtualNetworkRule for a Namespace by rule name. + def get_authorization_rule( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets an AuthorizationRule for a Namespace by rule name. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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 authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: VirtualNetworkRule or ClientRawResponse if raw=true + :return: AuthorizationRule or ClientRawResponse if raw=true :rtype: - ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + api_version = "2017-04-01" + # Construct URL - url = self.get_virtual_network_rule.metadata['url'] + url = self.get_authorization_rule.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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), + 'authorizationRuleName': self._serialize.url("authorization_rule_name", authorization_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -1013,55 +1447,56 @@ def get_virtual_network_rule( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VirtualNetworkRule', response) + deserialized = self._deserialize('AuthorizationRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_virtual_network_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'} + get_authorization_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}'} - def create_or_update_network_rule_set( - self, resource_group_name, namespace_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create or update NetworkRuleSet for a Namespace. + def list_keys( + self, resource_group_name, namespace_name, authorization_rule_name, custom_headers=None, raw=False, **operation_config): + """Gets the primary and secondary connection strings for the Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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.eventhub.v2018_01_01_preview.models.NetworkRuleSet + :param authorization_rule_name: The authorization rule name. + :type authorization_rule_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: NetworkRuleSet or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet - or ~msrest.pipeline.ClientRawResponse + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + api_version = "2017-04-01" + # Construct URL - url = self.create_or_update_network_rule_set.metadata['url'] + url = self.list_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -1069,11 +1504,8 @@ def create_or_update_network_rule_set( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - # Construct body - body_content = self._serialize.body(parameters, 'NetworkRuleSet') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -1081,51 +1513,67 @@ def create_or_update_network_rule_set( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkRuleSet', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_or_update_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/listKeys'} - def get_network_rule_set( - self, resource_group_name, namespace_name, custom_headers=None, raw=False, **operation_config): - """Gets NetworkRuleSet for a Namespace. + def regenerate_keys( + self, resource_group_name, namespace_name, authorization_rule_name, key_type, key=None, custom_headers=None, raw=False, **operation_config): + """Regenerates the primary or secondary connection strings for the + specified Namespace. :param resource_group_name: Name of the resource group within the - Azure subscription. + 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 key_type: The access key to regenerate. Possible values + include: 'PrimaryKey', 'SecondaryKey' + :type key_type: str or + ~azure.mgmt.eventhub.v2018_01_01_preview.models.KeyType + :param key: Optional, if the key value provided, is set for KeyType or + autogenerated Key value set for keyType + :type key: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: NetworkRuleSet or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet - or ~msrest.pipeline.ClientRawResponse + :return: AccessKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ + parameters = models.RegenerateAccessKeyParameters(key_type=key_type, key=key) + + api_version = "2017-04-01" + # Construct URL - url = self.get_network_rule_set.metadata['url'] + url = self.regenerate_keys.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_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', min_length=1), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -1133,8 +1581,11 @@ def get_network_rule_set( if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'RegenerateAccessKeyParameters') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -1142,11 +1593,76 @@ def get_network_rule_set( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('NetworkRuleSet', response) + deserialized = self._deserialize('AccessKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_network_rule_set.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default'} + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}/regenerateKeys'} + + def check_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """Check the give Namespace name availability. + + :param name: Name to check the namespace name availability + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.CheckNameAvailabilityParameter(name=name) + + api_version = "2017-04-01" + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameter') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py index 667d5b47ca96..174059d8d116 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-01-01-preview". + :ivar api_version: Client API Version. Constant value: "2017-04-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-01-01-preview" + self.api_version = "2017-04-01" self.config = config diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py new file mode 100644 index 000000000000..b1fb55fb3c86 --- /dev/null +++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class RegionsOperations(object): + """RegionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as 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. + :ivar api_version: Client API Version. Constant value: "2017-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-01" + + self.config = config + + def list_by_sku( + self, sku, custom_headers=None, raw=False, **operation_config): + """Gets the available Regions for a given sku. + + :param sku: The sku type. + :type sku: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of MessagingRegions + :rtype: + ~azure.mgmt.eventhub.v2018_01_01_preview.models.MessagingRegionsPaged[~azure.mgmt.eventhub.v2018_01_01_preview.models.MessagingRegions] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_sku.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.MessagingRegionsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions'} diff --git a/sdk/eventhub/azure-mgmt-eventhub/setup.py b/sdk/eventhub/azure-mgmt-eventhub/setup.py index b06a1c1e7c45..5b3b40e2a266 100644 --- a/sdk/eventhub/azure-mgmt-eventhub/setup.py +++ b/sdk/eventhub/azure-mgmt-eventhub/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -64,10 +66,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,