diff --git a/sdk/peering/azure-mgmt-peering/CHANGELOG.md b/sdk/peering/azure-mgmt-peering/CHANGELOG.md index 60d9c636a89b..de698bd44bfb 100644 --- a/sdk/peering/azure-mgmt-peering/CHANGELOG.md +++ b/sdk/peering/azure-mgmt-peering/CHANGELOG.md @@ -1,5 +1,23 @@ # Release History +## 0.2.0 (2020-04-12) + +**Features** + + - Model PeeringServicePrefix has a new parameter peering_service_prefix_key + - Model PeerAsn has a new parameter peer_contact_detail + - Model PeeringService has a new parameter sku + - Added operation group RegisteredPrefixesOperations + - Added operation group PeeringServiceCountriesOperations + - Added operation group RegisteredAsnsOperations + +**Breaking changes** + + - Operation LegacyPeeringsOperations.list has a new signature + - Operation PrefixesOperations.create_or_update has a new signature + - Operation PeeringServiceLocationsOperations.list has a new signature + - Model PeerAsn no longer has parameter peer_contact_info + ## 0.1.0rc2 (2019-10-24) **Breaking changes** diff --git a/sdk/peering/azure-mgmt-peering/README.md b/sdk/peering/azure-mgmt-peering/README.md index 7f013086d5d5..8ee648572b90 100644 --- a/sdk/peering/azure-mgmt-peering/README.md +++ b/sdk/peering/azure-mgmt-peering/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Peering 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.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. +For code examples, see [Peering Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. -For a more complete set of Azure libraries, see the -[azure](https://pypi.python.org/pypi/azure) bundle package. -## Usage +# Provide Feedback -For code examples, see [Peering -Management](https://docs.microsoft.com/python/api/overview/azure/) on -docs.microsoft.com. - -## 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) +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-peering%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-peering%2FREADME.png) diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/_peering_management_client.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/_peering_management_client.py index 9e303a0aa953..fabd77f8a74b 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/_peering_management_client.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/_peering_management_client.py @@ -18,7 +18,10 @@ from .operations import Operations from .operations import PeerAsnsOperations from .operations import PeeringLocationsOperations +from .operations import RegisteredAsnsOperations +from .operations import RegisteredPrefixesOperations from .operations import PeeringsOperations +from .operations import PeeringServiceCountriesOperations from .operations import PeeringServiceLocationsOperations from .operations import PrefixesOperations from .operations import PeeringServiceProvidersOperations @@ -40,8 +43,14 @@ class PeeringManagementClient(PeeringManagementClientOperationsMixin, SDKClient) :vartype peer_asns: azure.mgmt.peering.operations.PeerAsnsOperations :ivar peering_locations: PeeringLocations operations :vartype peering_locations: azure.mgmt.peering.operations.PeeringLocationsOperations + :ivar registered_asns: RegisteredAsns operations + :vartype registered_asns: azure.mgmt.peering.operations.RegisteredAsnsOperations + :ivar registered_prefixes: RegisteredPrefixes operations + :vartype registered_prefixes: azure.mgmt.peering.operations.RegisteredPrefixesOperations :ivar peerings: Peerings operations :vartype peerings: azure.mgmt.peering.operations.PeeringsOperations + :ivar peering_service_countries: PeeringServiceCountries operations + :vartype peering_service_countries: azure.mgmt.peering.operations.PeeringServiceCountriesOperations :ivar peering_service_locations: PeeringServiceLocations operations :vartype peering_service_locations: azure.mgmt.peering.operations.PeeringServiceLocationsOperations :ivar prefixes: Prefixes operations @@ -66,7 +75,7 @@ def __init__( super(PeeringManagementClient, 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 = '2019-09-01-preview' + self.api_version = '2020-01-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -78,8 +87,14 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.peering_locations = PeeringLocationsOperations( self._client, self.config, self._serialize, self._deserialize) + self.registered_asns = RegisteredAsnsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.registered_prefixes = RegisteredPrefixesOperations( + self._client, self.config, self._serialize, self._deserialize) self.peerings = PeeringsOperations( self._client, self.config, self._serialize, self._deserialize) + self.peering_service_countries = PeeringServiceCountriesOperations( + self._client, self.config, self._serialize, self._deserialize) self.peering_service_locations = PeeringServiceLocationsOperations( self._client, self.config, self._serialize, self._deserialize) self.prefixes = PrefixesOperations( diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/__init__.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/__init__.py index afe897a2a540..d6b96d971a13 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/__init__.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/__init__.py @@ -12,7 +12,7 @@ try: from ._models_py3 import BgpSession from ._models_py3 import CheckServiceProviderAvailabilityInput - from ._models_py3 import ContactInfo + from ._models_py3 import ContactDetail from ._models_py3 import DirectConnection from ._models_py3 import DirectPeeringFacility from ._models_py3 import ErrorResponse, ErrorResponseException @@ -28,11 +28,15 @@ from ._models_py3 import PeeringLocationPropertiesExchange from ._models_py3 import PeeringPropertiesDirect from ._models_py3 import PeeringPropertiesExchange + from ._models_py3 import PeeringRegisteredAsn + from ._models_py3 import PeeringRegisteredPrefix from ._models_py3 import PeeringService + from ._models_py3 import PeeringServiceCountry from ._models_py3 import PeeringServiceLocation from ._models_py3 import PeeringServicePrefix from ._models_py3 import PeeringServicePrefixEvent from ._models_py3 import PeeringServiceProvider + from ._models_py3 import PeeringServiceSku from ._models_py3 import PeeringSku from ._models_py3 import Resource from ._models_py3 import ResourceTags @@ -40,7 +44,7 @@ except (SyntaxError, ImportError): from ._models import BgpSession from ._models import CheckServiceProviderAvailabilityInput - from ._models import ContactInfo + from ._models import ContactDetail from ._models import DirectConnection from ._models import DirectPeeringFacility from ._models import ErrorResponse, ErrorResponseException @@ -56,11 +60,15 @@ from ._models import PeeringLocationPropertiesExchange from ._models import PeeringPropertiesDirect from ._models import PeeringPropertiesExchange + from ._models import PeeringRegisteredAsn + from ._models import PeeringRegisteredPrefix from ._models import PeeringService + from ._models import PeeringServiceCountry from ._models import PeeringServiceLocation from ._models import PeeringServicePrefix from ._models import PeeringServicePrefixEvent from ._models import PeeringServiceProvider + from ._models import PeeringServiceSku from ._models import PeeringSku from ._models import Resource from ._models import ResourceTags @@ -69,12 +77,14 @@ from ._paged_models import PeerAsnPaged from ._paged_models import PeeringLocationPaged from ._paged_models import PeeringPaged +from ._paged_models import PeeringRegisteredAsnPaged +from ._paged_models import PeeringRegisteredPrefixPaged +from ._paged_models import PeeringServiceCountryPaged from ._paged_models import PeeringServiceLocationPaged from ._paged_models import PeeringServicePaged from ._paged_models import PeeringServicePrefixPaged from ._paged_models import PeeringServiceProviderPaged from ._peering_management_client_enums import ( - Name, Tier, Family, Size, @@ -85,6 +95,7 @@ SessionStateV6, DirectPeeringType, ProvisioningState, + Role, ValidationState, PrefixValidationState, LearnedType, @@ -93,7 +104,7 @@ __all__ = [ 'BgpSession', 'CheckServiceProviderAvailabilityInput', - 'ContactInfo', + 'ContactDetail', 'DirectConnection', 'DirectPeeringFacility', 'ErrorResponse', 'ErrorResponseException', @@ -109,11 +120,15 @@ 'PeeringLocationPropertiesExchange', 'PeeringPropertiesDirect', 'PeeringPropertiesExchange', + 'PeeringRegisteredAsn', + 'PeeringRegisteredPrefix', 'PeeringService', + 'PeeringServiceCountry', 'PeeringServiceLocation', 'PeeringServicePrefix', 'PeeringServicePrefixEvent', 'PeeringServiceProvider', + 'PeeringServiceSku', 'PeeringSku', 'Resource', 'ResourceTags', @@ -122,11 +137,13 @@ 'OperationPaged', 'PeerAsnPaged', 'PeeringLocationPaged', + 'PeeringRegisteredAsnPaged', + 'PeeringRegisteredPrefixPaged', + 'PeeringServiceCountryPaged', 'PeeringServiceLocationPaged', 'PeeringServicePrefixPaged', 'PeeringServiceProviderPaged', 'PeeringServicePaged', - 'Name', 'Tier', 'Family', 'Size', @@ -137,6 +154,7 @@ 'SessionStateV6', 'DirectPeeringType', 'ProvisioningState', + 'Role', 'ValidationState', 'PrefixValidationState', 'LearnedType', diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models.py index fc31afd88ca0..28e68392fdaf 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models.py @@ -25,12 +25,12 @@ class BgpSession(Model): :param session_prefix_v6: The IPv6 prefix that contains both ends' IPv6 addresses. :type session_prefix_v6: str - :ivar microsoft_session_ipv4_address: The IPv4 session address on + :param microsoft_session_ipv4_address: The IPv4 session address on Microsoft's end. - :vartype microsoft_session_ipv4_address: str - :ivar microsoft_session_ipv6_address: The IPv6 session address on + :type microsoft_session_ipv4_address: str + :param microsoft_session_ipv6_address: The IPv6 session address on Microsoft's end. - :vartype microsoft_session_ipv6_address: str + :type microsoft_session_ipv6_address: str :param peer_session_ipv4_address: The IPv4 session address on peer's end. :type peer_session_ipv4_address: str :param peer_session_ipv6_address: The IPv6 session address on peer's end. @@ -58,8 +58,6 @@ class BgpSession(Model): """ _validation = { - 'microsoft_session_ipv4_address': {'readonly': True}, - 'microsoft_session_ipv6_address': {'readonly': True}, 'session_state_v4': {'readonly': True}, 'session_state_v6': {'readonly': True}, } @@ -82,8 +80,8 @@ def __init__(self, **kwargs): super(BgpSession, self).__init__(**kwargs) self.session_prefix_v4 = kwargs.get('session_prefix_v4', None) self.session_prefix_v6 = kwargs.get('session_prefix_v6', None) - self.microsoft_session_ipv4_address = None - self.microsoft_session_ipv6_address = None + self.microsoft_session_ipv4_address = kwargs.get('microsoft_session_ipv4_address', None) + self.microsoft_session_ipv6_address = kwargs.get('microsoft_session_ipv6_address', None) self.peer_session_ipv4_address = kwargs.get('peer_session_ipv4_address', None) self.peer_session_ipv6_address = kwargs.get('peer_session_ipv6_address', None) self.session_state_v4 = None @@ -96,9 +94,11 @@ def __init__(self, **kwargs): class CheckServiceProviderAvailabilityInput(Model): """Class for CheckServiceProviderAvailabilityInput. - :param peering_service_location: Gets or sets the PeeringServiceLocation + :param peering_service_location: Gets or sets the peering service + location. :type peering_service_location: str - :param peering_service_provider: Gets or sets the PeeringServiceProvider + :param peering_service_provider: Gets or sets the peering service + provider. :type peering_service_provider: str """ @@ -121,23 +121,28 @@ class CloudError(Model): } -class ContactInfo(Model): - """The contact information of the peer. +class ContactDetail(Model): + """The contact detail class. - :param emails: The list of email addresses. - :type emails: list[str] - :param phone: The list of contact numbers. - :type phone: list[str] + :param role: The role of the contact. Possible values include: 'Noc', + 'Policy', 'Technical', 'Service', 'Other' + :type role: str or ~azure.mgmt.peering.models.Role + :param email: The e-mail address of the contact. + :type email: str + :param phone: The phone number of the contact. + :type phone: str """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'phone': {'key': 'phone', 'type': '[str]'}, + 'role': {'key': 'role', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, } def __init__(self, **kwargs): - super(ContactInfo, self).__init__(**kwargs) - self.emails = kwargs.get('emails', None) + super(ContactDetail, self).__init__(**kwargs) + self.role = kwargs.get('role', None) + self.email = kwargs.get('email', None) self.phone = kwargs.get('phone', None) @@ -215,7 +220,7 @@ class DirectPeeringFacility(Model): :param address: The address of the direct peering facility. :type address: str :param direct_peering_type: The type of the direct peering. Possible - values include: 'Edge', 'Transit', 'Cdn', 'Internal' + values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' :type direct_peering_type: str or ~azure.mgmt.peering.models.DirectPeeringType :param peering_db_facility_id: The PeeringDB.com ID of the facility. @@ -493,8 +498,8 @@ class PeerAsn(Resource): :vartype type: str :param peer_asn: The Autonomous System Number (ASN) of the peer. :type peer_asn: int - :param peer_contact_info: The contact information of the peer. - :type peer_contact_info: ~azure.mgmt.peering.models.ContactInfo + :param peer_contact_detail: The contact details of the peer. + :type peer_contact_detail: list[~azure.mgmt.peering.models.ContactDetail] :param peer_name: The name of the peer. :type peer_name: str :param validation_state: The validation state of the ASN associated with @@ -516,7 +521,7 @@ class PeerAsn(Resource): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'peer_asn': {'key': 'properties.peerAsn', 'type': 'int'}, - 'peer_contact_info': {'key': 'properties.peerContactInfo', 'type': 'ContactInfo'}, + 'peer_contact_detail': {'key': 'properties.peerContactDetail', 'type': '[ContactDetail]'}, 'peer_name': {'key': 'properties.peerName', 'type': 'str'}, 'validation_state': {'key': 'properties.validationState', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, @@ -525,7 +530,7 @@ class PeerAsn(Resource): def __init__(self, **kwargs): super(PeerAsn, self).__init__(**kwargs) self.peer_asn = kwargs.get('peer_asn', None) - self.peer_contact_info = kwargs.get('peer_contact_info', None) + self.peer_contact_detail = kwargs.get('peer_contact_detail', None) self.peer_name = kwargs.get('peer_name', None) self.validation_state = kwargs.get('validation_state', None) self.error_message = None @@ -739,7 +744,7 @@ class PeeringPropertiesDirect(Model): :param peer_asn: The reference of the peer ASN. :type peer_asn: ~azure.mgmt.peering.models.SubResource :param direct_peering_type: The type of direct peering. Possible values - include: 'Edge', 'Transit', 'Cdn', 'Internal' + include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' :type direct_peering_type: str or ~azure.mgmt.peering.models.DirectPeeringType """ @@ -784,6 +789,114 @@ def __init__(self, **kwargs): self.peer_asn = kwargs.get('peer_asn', None) +class PeeringRegisteredAsn(Resource): + """The customer's ASN that is registered by the peering service provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :param asn: The customer's ASN from which traffic originates. + :type asn: int + :ivar peering_service_prefix_key: The peering service prefix key that is + to be shared with the customer. + :vartype peering_service_prefix_key: str + :ivar provisioning_state: The provisioning state of the resource. Possible + values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.peering.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'peering_service_prefix_key': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'asn': {'key': 'properties.asn', 'type': 'int'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PeeringRegisteredAsn, self).__init__(**kwargs) + self.asn = kwargs.get('asn', None) + self.peering_service_prefix_key = None + self.provisioning_state = None + + +class PeeringRegisteredPrefix(Resource): + """The customer's prefix that is registered by the peering service provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :param prefix: The customer's prefix from which traffic originates. + :type prefix: str + :ivar prefix_validation_state: The prefix validation state. Possible + values include: 'None', 'Invalid', 'Verified', 'Failed', 'Pending', + 'Warning', 'Unknown' + :vartype prefix_validation_state: str or + ~azure.mgmt.peering.models.PrefixValidationState + :ivar peering_service_prefix_key: The peering service prefix key that is + to be shared with the customer. + :vartype peering_service_prefix_key: str + :ivar error_message: The error message associated with the validation + state, if any. + :vartype error_message: str + :ivar provisioning_state: The provisioning state of the resource. Possible + values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.peering.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'prefix_validation_state': {'readonly': True}, + 'peering_service_prefix_key': {'readonly': True}, + 'error_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'prefix': {'key': 'properties.prefix', 'type': 'str'}, + 'prefix_validation_state': {'key': 'properties.prefixValidationState', 'type': 'str'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, + 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PeeringRegisteredPrefix, self).__init__(**kwargs) + self.prefix = kwargs.get('prefix', None) + self.prefix_validation_state = None + self.peering_service_prefix_key = None + self.error_message = None + self.provisioning_state = None + + class PeeringService(Resource): """Peering Service. @@ -798,6 +911,8 @@ class PeeringService(Resource): :vartype id: str :ivar type: The type of the resource. :vartype type: str + :param sku: The SKU that defines the type of the peering service. + :type sku: ~azure.mgmt.peering.models.PeeringServiceSku :param peering_service_location: The PeeringServiceLocation of the Customer. :type peering_service_location: str @@ -825,6 +940,7 @@ class PeeringService(Resource): 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'PeeringServiceSku'}, 'peering_service_location': {'key': 'properties.peeringServiceLocation', 'type': 'str'}, 'peering_service_provider': {'key': 'properties.peeringServiceProvider', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -834,6 +950,7 @@ class PeeringService(Resource): def __init__(self, **kwargs): super(PeeringService, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) self.peering_service_location = kwargs.get('peering_service_location', None) self.peering_service_provider = kwargs.get('peering_service_provider', None) self.provisioning_state = None @@ -841,8 +958,38 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class PeeringServiceCountry(Resource): + """The peering service country. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PeeringServiceCountry, self).__init__(**kwargs) + + class PeeringServiceLocation(Resource): - """PeeringService location. + """The peering service location. Variables are only populated by the server, and will be ignored when sending a request. @@ -910,6 +1057,8 @@ class PeeringServicePrefix(Resource): :ivar events: The list of events for peering service prefix :vartype events: list[~azure.mgmt.peering.models.PeeringServicePrefixEvent] + :param peering_service_prefix_key: The peering service prefix key + :type peering_service_prefix_key: str :ivar provisioning_state: The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' :vartype provisioning_state: str or @@ -936,6 +1085,7 @@ class PeeringServicePrefix(Resource): 'learned_type': {'key': 'properties.learnedType', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, 'events': {'key': 'properties.events', 'type': '[PeeringServicePrefixEvent]'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } @@ -946,6 +1096,7 @@ def __init__(self, **kwargs): self.learned_type = None self.error_message = None self.events = None + self.peering_service_prefix_key = kwargs.get('peering_service_prefix_key', None) self.provisioning_state = None @@ -1028,14 +1179,27 @@ def __init__(self, **kwargs): self.service_provider_name = kwargs.get('service_provider_name', None) +class PeeringServiceSku(Model): + """The SKU that defines the type of the peering service. + + :param name: The name of the peering service SKU. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PeeringServiceSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + class PeeringSku(Model): """The SKU that defines the tier and kind of the peering. - :param name: The name of the peering SKU. Possible values include: - 'Basic_Exchange_Free', 'Basic_Direct_Free', 'Premium_Direct_Free', - 'Premium_Exchange_Metered', 'Premium_Direct_Metered', - 'Premium_Direct_Unlimited' - :type name: str or ~azure.mgmt.peering.models.Name + :param name: The name of the peering SKU. + :type name: str :param tier: The tier of the peering SKU. Possible values include: 'Basic', 'Premium' :type tier: str or ~azure.mgmt.peering.models.Tier diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models_py3.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models_py3.py index d92200c18eea..7cfe4f0969cd 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models_py3.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_models_py3.py @@ -25,12 +25,12 @@ class BgpSession(Model): :param session_prefix_v6: The IPv6 prefix that contains both ends' IPv6 addresses. :type session_prefix_v6: str - :ivar microsoft_session_ipv4_address: The IPv4 session address on + :param microsoft_session_ipv4_address: The IPv4 session address on Microsoft's end. - :vartype microsoft_session_ipv4_address: str - :ivar microsoft_session_ipv6_address: The IPv6 session address on + :type microsoft_session_ipv4_address: str + :param microsoft_session_ipv6_address: The IPv6 session address on Microsoft's end. - :vartype microsoft_session_ipv6_address: str + :type microsoft_session_ipv6_address: str :param peer_session_ipv4_address: The IPv4 session address on peer's end. :type peer_session_ipv4_address: str :param peer_session_ipv6_address: The IPv6 session address on peer's end. @@ -58,8 +58,6 @@ class BgpSession(Model): """ _validation = { - 'microsoft_session_ipv4_address': {'readonly': True}, - 'microsoft_session_ipv6_address': {'readonly': True}, 'session_state_v4': {'readonly': True}, 'session_state_v6': {'readonly': True}, } @@ -78,12 +76,12 @@ class BgpSession(Model): 'md5_authentication_key': {'key': 'md5AuthenticationKey', 'type': 'str'}, } - def __init__(self, *, session_prefix_v4: str=None, session_prefix_v6: str=None, peer_session_ipv4_address: str=None, peer_session_ipv6_address: str=None, max_prefixes_advertised_v4: int=None, max_prefixes_advertised_v6: int=None, md5_authentication_key: str=None, **kwargs) -> None: + def __init__(self, *, session_prefix_v4: str=None, session_prefix_v6: str=None, microsoft_session_ipv4_address: str=None, microsoft_session_ipv6_address: str=None, peer_session_ipv4_address: str=None, peer_session_ipv6_address: str=None, max_prefixes_advertised_v4: int=None, max_prefixes_advertised_v6: int=None, md5_authentication_key: str=None, **kwargs) -> None: super(BgpSession, self).__init__(**kwargs) self.session_prefix_v4 = session_prefix_v4 self.session_prefix_v6 = session_prefix_v6 - self.microsoft_session_ipv4_address = None - self.microsoft_session_ipv6_address = None + self.microsoft_session_ipv4_address = microsoft_session_ipv4_address + self.microsoft_session_ipv6_address = microsoft_session_ipv6_address self.peer_session_ipv4_address = peer_session_ipv4_address self.peer_session_ipv6_address = peer_session_ipv6_address self.session_state_v4 = None @@ -96,9 +94,11 @@ def __init__(self, *, session_prefix_v4: str=None, session_prefix_v6: str=None, class CheckServiceProviderAvailabilityInput(Model): """Class for CheckServiceProviderAvailabilityInput. - :param peering_service_location: Gets or sets the PeeringServiceLocation + :param peering_service_location: Gets or sets the peering service + location. :type peering_service_location: str - :param peering_service_provider: Gets or sets the PeeringServiceProvider + :param peering_service_provider: Gets or sets the peering service + provider. :type peering_service_provider: str """ @@ -121,23 +121,28 @@ class CloudError(Model): } -class ContactInfo(Model): - """The contact information of the peer. +class ContactDetail(Model): + """The contact detail class. - :param emails: The list of email addresses. - :type emails: list[str] - :param phone: The list of contact numbers. - :type phone: list[str] + :param role: The role of the contact. Possible values include: 'Noc', + 'Policy', 'Technical', 'Service', 'Other' + :type role: str or ~azure.mgmt.peering.models.Role + :param email: The e-mail address of the contact. + :type email: str + :param phone: The phone number of the contact. + :type phone: str """ _attribute_map = { - 'emails': {'key': 'emails', 'type': '[str]'}, - 'phone': {'key': 'phone', 'type': '[str]'}, + 'role': {'key': 'role', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, emails=None, phone=None, **kwargs) -> None: - super(ContactInfo, self).__init__(**kwargs) - self.emails = emails + def __init__(self, *, role=None, email: str=None, phone: str=None, **kwargs) -> None: + super(ContactDetail, self).__init__(**kwargs) + self.role = role + self.email = email self.phone = phone @@ -215,7 +220,7 @@ class DirectPeeringFacility(Model): :param address: The address of the direct peering facility. :type address: str :param direct_peering_type: The type of the direct peering. Possible - values include: 'Edge', 'Transit', 'Cdn', 'Internal' + values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' :type direct_peering_type: str or ~azure.mgmt.peering.models.DirectPeeringType :param peering_db_facility_id: The PeeringDB.com ID of the facility. @@ -493,8 +498,8 @@ class PeerAsn(Resource): :vartype type: str :param peer_asn: The Autonomous System Number (ASN) of the peer. :type peer_asn: int - :param peer_contact_info: The contact information of the peer. - :type peer_contact_info: ~azure.mgmt.peering.models.ContactInfo + :param peer_contact_detail: The contact details of the peer. + :type peer_contact_detail: list[~azure.mgmt.peering.models.ContactDetail] :param peer_name: The name of the peer. :type peer_name: str :param validation_state: The validation state of the ASN associated with @@ -516,16 +521,16 @@ class PeerAsn(Resource): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'peer_asn': {'key': 'properties.peerAsn', 'type': 'int'}, - 'peer_contact_info': {'key': 'properties.peerContactInfo', 'type': 'ContactInfo'}, + 'peer_contact_detail': {'key': 'properties.peerContactDetail', 'type': '[ContactDetail]'}, 'peer_name': {'key': 'properties.peerName', 'type': 'str'}, 'validation_state': {'key': 'properties.validationState', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, } - def __init__(self, *, peer_asn: int=None, peer_contact_info=None, peer_name: str=None, validation_state=None, **kwargs) -> None: + def __init__(self, *, peer_asn: int=None, peer_contact_detail=None, peer_name: str=None, validation_state=None, **kwargs) -> None: super(PeerAsn, self).__init__(**kwargs) self.peer_asn = peer_asn - self.peer_contact_info = peer_contact_info + self.peer_contact_detail = peer_contact_detail self.peer_name = peer_name self.validation_state = validation_state self.error_message = None @@ -739,7 +744,7 @@ class PeeringPropertiesDirect(Model): :param peer_asn: The reference of the peer ASN. :type peer_asn: ~azure.mgmt.peering.models.SubResource :param direct_peering_type: The type of direct peering. Possible values - include: 'Edge', 'Transit', 'Cdn', 'Internal' + include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' :type direct_peering_type: str or ~azure.mgmt.peering.models.DirectPeeringType """ @@ -784,6 +789,114 @@ def __init__(self, *, connections=None, peer_asn=None, **kwargs) -> None: self.peer_asn = peer_asn +class PeeringRegisteredAsn(Resource): + """The customer's ASN that is registered by the peering service provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :param asn: The customer's ASN from which traffic originates. + :type asn: int + :ivar peering_service_prefix_key: The peering service prefix key that is + to be shared with the customer. + :vartype peering_service_prefix_key: str + :ivar provisioning_state: The provisioning state of the resource. Possible + values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.peering.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'peering_service_prefix_key': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'asn': {'key': 'properties.asn', 'type': 'int'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, asn: int=None, **kwargs) -> None: + super(PeeringRegisteredAsn, self).__init__(**kwargs) + self.asn = asn + self.peering_service_prefix_key = None + self.provisioning_state = None + + +class PeeringRegisteredPrefix(Resource): + """The customer's prefix that is registered by the peering service provider. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + :param prefix: The customer's prefix from which traffic originates. + :type prefix: str + :ivar prefix_validation_state: The prefix validation state. Possible + values include: 'None', 'Invalid', 'Verified', 'Failed', 'Pending', + 'Warning', 'Unknown' + :vartype prefix_validation_state: str or + ~azure.mgmt.peering.models.PrefixValidationState + :ivar peering_service_prefix_key: The peering service prefix key that is + to be shared with the customer. + :vartype peering_service_prefix_key: str + :ivar error_message: The error message associated with the validation + state, if any. + :vartype error_message: str + :ivar provisioning_state: The provisioning state of the resource. Possible + values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.peering.models.ProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'prefix_validation_state': {'readonly': True}, + 'peering_service_prefix_key': {'readonly': True}, + 'error_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'prefix': {'key': 'properties.prefix', 'type': 'str'}, + 'prefix_validation_state': {'key': 'properties.prefixValidationState', 'type': 'str'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, + 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, prefix: str=None, **kwargs) -> None: + super(PeeringRegisteredPrefix, self).__init__(**kwargs) + self.prefix = prefix + self.prefix_validation_state = None + self.peering_service_prefix_key = None + self.error_message = None + self.provisioning_state = None + + class PeeringService(Resource): """Peering Service. @@ -798,6 +911,8 @@ class PeeringService(Resource): :vartype id: str :ivar type: The type of the resource. :vartype type: str + :param sku: The SKU that defines the type of the peering service. + :type sku: ~azure.mgmt.peering.models.PeeringServiceSku :param peering_service_location: The PeeringServiceLocation of the Customer. :type peering_service_location: str @@ -825,6 +940,7 @@ class PeeringService(Resource): 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'PeeringServiceSku'}, 'peering_service_location': {'key': 'properties.peeringServiceLocation', 'type': 'str'}, 'peering_service_provider': {'key': 'properties.peeringServiceProvider', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -832,8 +948,9 @@ class PeeringService(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, peering_service_location: str=None, peering_service_provider: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, location: str, sku=None, peering_service_location: str=None, peering_service_provider: str=None, tags=None, **kwargs) -> None: super(PeeringService, self).__init__(**kwargs) + self.sku = sku self.peering_service_location = peering_service_location self.peering_service_provider = peering_service_provider self.provisioning_state = None @@ -841,8 +958,38 @@ def __init__(self, *, location: str, peering_service_location: str=None, peering self.tags = tags +class PeeringServiceCountry(Resource): + """The peering service country. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The name of the resource. + :vartype name: str + :ivar id: The ID of the resource. + :vartype id: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(PeeringServiceCountry, self).__init__(**kwargs) + + class PeeringServiceLocation(Resource): - """PeeringService location. + """The peering service location. Variables are only populated by the server, and will be ignored when sending a request. @@ -910,6 +1057,8 @@ class PeeringServicePrefix(Resource): :ivar events: The list of events for peering service prefix :vartype events: list[~azure.mgmt.peering.models.PeeringServicePrefixEvent] + :param peering_service_prefix_key: The peering service prefix key + :type peering_service_prefix_key: str :ivar provisioning_state: The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' :vartype provisioning_state: str or @@ -936,16 +1085,18 @@ class PeeringServicePrefix(Resource): 'learned_type': {'key': 'properties.learnedType', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, 'events': {'key': 'properties.events', 'type': '[PeeringServicePrefixEvent]'}, + 'peering_service_prefix_key': {'key': 'properties.peeringServicePrefixKey', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, prefix: str=None, **kwargs) -> None: + def __init__(self, *, prefix: str=None, peering_service_prefix_key: str=None, **kwargs) -> None: super(PeeringServicePrefix, self).__init__(**kwargs) self.prefix = prefix self.prefix_validation_state = None self.learned_type = None self.error_message = None self.events = None + self.peering_service_prefix_key = peering_service_prefix_key self.provisioning_state = None @@ -1028,14 +1179,27 @@ def __init__(self, *, service_provider_name: str=None, **kwargs) -> None: self.service_provider_name = service_provider_name +class PeeringServiceSku(Model): + """The SKU that defines the type of the peering service. + + :param name: The name of the peering service SKU. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(PeeringServiceSku, self).__init__(**kwargs) + self.name = name + + class PeeringSku(Model): """The SKU that defines the tier and kind of the peering. - :param name: The name of the peering SKU. Possible values include: - 'Basic_Exchange_Free', 'Basic_Direct_Free', 'Premium_Direct_Free', - 'Premium_Exchange_Metered', 'Premium_Direct_Metered', - 'Premium_Direct_Unlimited' - :type name: str or ~azure.mgmt.peering.models.Name + :param name: The name of the peering SKU. + :type name: str :param tier: The tier of the peering SKU. Possible values include: 'Basic', 'Premium' :type tier: str or ~azure.mgmt.peering.models.Tier @@ -1054,7 +1218,7 @@ class PeeringSku(Model): 'size': {'key': 'size', 'type': 'str'}, } - def __init__(self, *, name=None, tier=None, family=None, size=None, **kwargs) -> None: + def __init__(self, *, name: str=None, tier=None, family=None, size=None, **kwargs) -> None: super(PeeringSku, self).__init__(**kwargs) self.name = name self.tier = tier diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_paged_models.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_paged_models.py index c06074238113..525770f4a3ef 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_paged_models.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_paged_models.py @@ -64,6 +64,45 @@ class PeeringLocationPaged(Paged): def __init__(self, *args, **kwargs): super(PeeringLocationPaged, self).__init__(*args, **kwargs) +class PeeringRegisteredAsnPaged(Paged): + """ + A paging container for iterating over a list of :class:`PeeringRegisteredAsn ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PeeringRegisteredAsn]'} + } + + def __init__(self, *args, **kwargs): + + super(PeeringRegisteredAsnPaged, self).__init__(*args, **kwargs) +class PeeringRegisteredPrefixPaged(Paged): + """ + A paging container for iterating over a list of :class:`PeeringRegisteredPrefix ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PeeringRegisteredPrefix]'} + } + + def __init__(self, *args, **kwargs): + + super(PeeringRegisteredPrefixPaged, self).__init__(*args, **kwargs) +class PeeringServiceCountryPaged(Paged): + """ + A paging container for iterating over a list of :class:`PeeringServiceCountry ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PeeringServiceCountry]'} + } + + def __init__(self, *args, **kwargs): + + super(PeeringServiceCountryPaged, self).__init__(*args, **kwargs) class PeeringServiceLocationPaged(Paged): """ A paging container for iterating over a list of :class:`PeeringServiceLocation ` object diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_peering_management_client_enums.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_peering_management_client_enums.py index 2b757fd4427f..53bea817c995 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_peering_management_client_enums.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/models/_peering_management_client_enums.py @@ -12,16 +12,6 @@ from enum import Enum -class Name(str, Enum): - - basic_exchange_free = "Basic_Exchange_Free" - basic_direct_free = "Basic_Direct_Free" - premium_direct_free = "Premium_Direct_Free" - premium_exchange_metered = "Premium_Exchange_Metered" - premium_direct_metered = "Premium_Direct_Metered" - premium_direct_unlimited = "Premium_Direct_Unlimited" - - class Tier(str, Enum): basic = "Basic" @@ -101,6 +91,8 @@ class DirectPeeringType(str, Enum): transit = "Transit" cdn = "Cdn" internal = "Internal" + ix = "Ix" + ix_rs = "IxRs" class ProvisioningState(str, Enum): @@ -111,6 +103,15 @@ class ProvisioningState(str, Enum): failed = "Failed" +class Role(str, Enum): + + noc = "Noc" + policy = "Policy" + technical = "Technical" + service = "Service" + other = "Other" + + class ValidationState(str, Enum): none = "None" diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/__init__.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/__init__.py index cdd15747d39d..fd6e41d5445e 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/__init__.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/__init__.py @@ -13,7 +13,10 @@ from ._operations import Operations from ._peer_asns_operations import PeerAsnsOperations from ._peering_locations_operations import PeeringLocationsOperations +from ._registered_asns_operations import RegisteredAsnsOperations +from ._registered_prefixes_operations import RegisteredPrefixesOperations from ._peerings_operations import PeeringsOperations +from ._peering_service_countries_operations import PeeringServiceCountriesOperations from ._peering_service_locations_operations import PeeringServiceLocationsOperations from ._prefixes_operations import PrefixesOperations from ._peering_service_providers_operations import PeeringServiceProvidersOperations @@ -25,7 +28,10 @@ 'Operations', 'PeerAsnsOperations', 'PeeringLocationsOperations', + 'RegisteredAsnsOperations', + 'RegisteredPrefixesOperations', 'PeeringsOperations', + 'PeeringServiceCountriesOperations', 'PeeringServiceLocationsOperations', 'PrefixesOperations', 'PeeringServiceProvidersOperations', diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_legacy_peerings_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_legacy_peerings_operations.py index 131a2771c2c1..e2391ffba1c9 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_legacy_peerings_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_legacy_peerings_operations.py @@ -24,7 +24,7 @@ class LegacyPeeringsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ models = models @@ -34,12 +34,12 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config def list( - self, peering_location, kind, custom_headers=None, raw=False, **operation_config): + self, peering_location, kind, asn=None, custom_headers=None, raw=False, **operation_config): """Lists all of the legacy peerings under the given subscription matching the specified kind and location. @@ -48,6 +48,8 @@ def list( :param kind: The kind of the peering. Possible values include: 'Direct', 'Exchange' :type kind: str + :param asn: The ASN number associated with a legacy peering. + :type asn: int :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -72,6 +74,8 @@ def prepare_request(next_link=None): query_parameters = {} query_parameters['peeringLocation'] = self._serialize.query("peering_location", peering_location, 'str') query_parameters['kind'] = self._serialize.query("kind", kind, 'str') + if asn is not None: + query_parameters['asn'] = self._serialize.query("asn", asn, 'int') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_operations.py index 3e049e50cc15..193b6b2ab538 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/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: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peer_asns_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peer_asns_operations.py index cb397734c859..fa965792817c 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peer_asns_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peer_asns_operations.py @@ -24,7 +24,7 @@ class PeerAsnsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_locations_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_locations_operations.py index 6cf7c67dd8ee..c2b71cd7b1b4 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_locations_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_locations_operations.py @@ -24,7 +24,7 @@ class PeeringLocationsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config @@ -47,7 +47,7 @@ def list( 'Direct', 'Exchange' :type kind: str :param direct_peering_type: The type of direct peering. Possible - values include: 'Edge', 'Transit', 'Cdn', 'Internal' + values include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' :type direct_peering_type: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_management_client_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_management_client_operations.py index 85630b814cb2..f42083b22d89 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_management_client_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_management_client_operations.py @@ -21,11 +21,11 @@ def check_service_provider_availability( """Checks if the peering service provider is present within 1000 miles of customer's location. - :param peering_service_location: Gets or sets the - PeeringServiceLocation + :param peering_service_location: Gets or sets the peering service + location. :type peering_service_location: str - :param peering_service_provider: Gets or sets the - PeeringServiceProvider + :param peering_service_provider: Gets or sets the peering service + provider. :type peering_service_provider: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_countries_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_countries_operations.py new file mode 100644 index 000000000000..239997bd1df2 --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_countries_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class PeeringServiceCountriesOperations(object): + """PeeringServiceCountriesOperations 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: The client API version. Constant value: "2020-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available countries for peering service. + + :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 PeeringServiceCountry + :rtype: + ~azure.mgmt.peering.models.PeeringServiceCountryPaged[~azure.mgmt.peering.models.PeeringServiceCountry] + :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.PeeringServiceCountryPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries'} diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_locations_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_locations_operations.py index cdf508d203c0..21bb6997cc78 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_locations_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_locations_operations.py @@ -24,7 +24,7 @@ class PeeringServiceLocationsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ models = models @@ -34,15 +34,17 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available peering service locations for the specified - kind of peering. + self, country=None, custom_headers=None, raw=False, **operation_config): + """Lists all of the available locations for peering service. + :param country: The country of interest, in which the locations are to + be present. + :type country: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -65,6 +67,8 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} + if country is not None: + query_parameters['country'] = self._serialize.query("country", country, 'str') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_providers_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_providers_operations.py index 4aba0deb4a86..85e334e0ca6c 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_providers_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_service_providers_operations.py @@ -24,7 +24,7 @@ class PeeringServiceProvidersOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_services_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_services_operations.py index ecac472f7b58..107dfc1d9f7b 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_services_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peering_services_operations.py @@ -24,7 +24,7 @@ class PeeringServicesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peerings_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peerings_operations.py index 40da1c496759..d45dfc85bdab 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peerings_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_peerings_operations.py @@ -24,7 +24,7 @@ class PeeringsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_prefixes_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_prefixes_operations.py index 3b94252cdd96..1f3b5bb27d6b 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_prefixes_operations.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_prefixes_operations.py @@ -24,7 +24,7 @@ class PrefixesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The client API version. Constant value: "2019-09-01-preview". + :ivar api_version: The client API version. Constant value: "2020-01-01-preview". """ 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 = "2019-09-01-preview" + self.api_version = "2020-01-01-preview" self.config = config @@ -107,7 +107,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'} def create_or_update( - self, resource_group_name, peering_service_name, prefix_name, prefix=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, peering_service_name, prefix_name, prefix=None, peering_service_prefix_key=None, custom_headers=None, raw=False, **operation_config): """Creates a new prefix with the specified name under the given subscription, resource group and peering service. @@ -119,6 +119,8 @@ def create_or_update( :type prefix_name: str :param prefix: The prefix from which your traffic originates. :type prefix: str + :param peering_service_prefix_key: The peering service prefix key + :type peering_service_prefix_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 @@ -130,7 +132,7 @@ def create_or_update( :raises: :class:`ErrorResponseException` """ - peering_service_prefix = models.PeeringServicePrefix(prefix=prefix) + peering_service_prefix = models.PeeringServicePrefix(prefix=prefix, peering_service_prefix_key=peering_service_prefix_key) # Construct URL url = self.create_or_update.metadata['url'] diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_asns_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_asns_operations.py new file mode 100644 index 000000000000..b413f0151b09 --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_asns_operations.py @@ -0,0 +1,305 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 RegisteredAsnsOperations(object): + """RegisteredAsnsOperations 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: The client API version. Constant value: "2020-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-01-preview" + + self.config = config + + def get( + self, resource_group_name, peering_name, registered_asn_name, custom_headers=None, raw=False, **operation_config): + """Gets an existing registered ASN with the specified name under the given + subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_asn_name: The name of the registered ASN. + :type registered_asn_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: PeeringRegisteredAsn or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.peering.models.PeeringRegisteredAsn 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'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredAsnName': self._serialize.url("registered_asn_name", registered_asn_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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('PeeringRegisteredAsn', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'} + + def create_or_update( + self, resource_group_name, peering_name, registered_asn_name, asn=None, custom_headers=None, raw=False, **operation_config): + """Creates a new registered ASN with the specified name under the given + subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_asn_name: The name of the ASN. + :type registered_asn_name: str + :param asn: The customer's ASN from which traffic originates. + :type asn: 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: PeeringRegisteredAsn or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.peering.models.PeeringRegisteredAsn or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + registered_asn = models.PeeringRegisteredAsn(asn=asn) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredAsnName': self._serialize.url("registered_asn_name", registered_asn_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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(registered_asn, 'PeeringRegisteredAsn') + + # 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('PeeringRegisteredAsn', response) + if response.status_code == 201: + deserialized = self._deserialize('PeeringRegisteredAsn', 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.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'} + + def delete( + self, resource_group_name, peering_name, registered_asn_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing registered ASN with the specified name under the + given subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_asn_name: The name of the registered ASN. + :type registered_asn_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'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredAsnName': self._serialize.url("registered_asn_name", registered_asn_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}'} + + def list_by_peering( + self, resource_group_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Lists all registered ASNs under the given subscription, resource group + and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_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 PeeringRegisteredAsn + :rtype: + ~azure.mgmt.peering.models.PeeringRegisteredAsnPaged[~azure.mgmt.peering.models.PeeringRegisteredAsn] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_peering.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.PeeringRegisteredAsnPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_peering.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns'} diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_prefixes_operations.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_prefixes_operations.py new file mode 100644 index 000000000000..b9d8fab0ef8c --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/operations/_registered_prefixes_operations.py @@ -0,0 +1,305 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 RegisteredPrefixesOperations(object): + """RegisteredPrefixesOperations 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: The client API version. Constant value: "2020-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-01-01-preview" + + self.config = config + + def get( + self, resource_group_name, peering_name, registered_prefix_name, custom_headers=None, raw=False, **operation_config): + """Gets an existing registered prefix with the specified name under the + given subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_prefix_name: The name of the registered prefix. + :type registered_prefix_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: PeeringRegisteredPrefix or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.peering.models.PeeringRegisteredPrefix 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'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredPrefixName': self._serialize.url("registered_prefix_name", registered_prefix_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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('PeeringRegisteredPrefix', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'} + + def create_or_update( + self, resource_group_name, peering_name, registered_prefix_name, prefix=None, custom_headers=None, raw=False, **operation_config): + """Creates a new registered prefix with the specified name under the given + subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_prefix_name: The name of the registered prefix. + :type registered_prefix_name: str + :param prefix: The customer's prefix from which traffic originates. + :type prefix: 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: PeeringRegisteredPrefix or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.peering.models.PeeringRegisteredPrefix or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + registered_prefix = models.PeeringRegisteredPrefix(prefix=prefix) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredPrefixName': self._serialize.url("registered_prefix_name", registered_prefix_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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(registered_prefix, 'PeeringRegisteredPrefix') + + # 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('PeeringRegisteredPrefix', response) + if response.status_code == 201: + deserialized = self._deserialize('PeeringRegisteredPrefix', 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.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'} + + def delete( + self, resource_group_name, peering_name, registered_prefix_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing registered prefix with the specified name under the + given subscription, resource group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_name: str + :param registered_prefix_name: The name of the registered prefix. + :type registered_prefix_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'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'registeredPrefixName': self._serialize.url("registered_prefix_name", registered_prefix_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}'} + + def list_by_peering( + self, resource_group_name, peering_name, custom_headers=None, raw=False, **operation_config): + """Lists all registered prefixes under the given subscription, resource + group and peering. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param peering_name: The name of the peering. + :type peering_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 PeeringRegisteredPrefix + :rtype: + ~azure.mgmt.peering.models.PeeringRegisteredPrefixPaged[~azure.mgmt.peering.models.PeeringRegisteredPrefix] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_peering.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.PeeringRegisteredPrefixPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_peering.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes'} diff --git a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/version.py b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/version.py index ad4aa9eb3df5..9bd1dfac7ecb 100644 --- a/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/version.py +++ b/sdk/peering/azure-mgmt-peering/azure/mgmt/peering/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0rc2" +VERSION = "0.2.0" diff --git a/sdk/peering/azure-mgmt-peering/setup.py b/sdk/peering/azure-mgmt-peering/setup.py index f2447b244871..b4fe4810e294 100644 --- a/sdk/peering/azure-mgmt-peering/setup.py +++ b/sdk/peering/azure-mgmt-peering/setup.py @@ -67,6 +67,7 @@ '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, diff --git a/sdk/peering/azure-mgmt-peering/tests/recordings/test_cli_mgmt_peering.test_peering.yaml b/sdk/peering/azure-mgmt-peering/tests/recordings/test_cli_mgmt_peering.test_peering.yaml new file mode 100644 index 000000000000..c1691ca116ac --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/tests/recordings/test_cli_mgmt_peering.test_peering.yaml @@ -0,0 +1,298 @@ +interactions: +- request: + body: '{"properties": {"peerAsn": 65001, "peerContactDetail": [{"role": "Noc", + "email": "noc@contoso.com", "phone": "+1 (234) 567-8999"}, {"role": "Policy", + "email": "abc@contoso.com", "phone": "+1 (234) 567-8900"}, {"role": "Technical", + "email": "xyz@contoso.com", "phone": "+1 (234) 567-8900"}], "peerName": "Contoso"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '314' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Peering/peerAsns/myPeerAsn?api-version=2020-01-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"peerAsn\": 65001,\r\n \"peerContactDetail\"\ + : [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"noc@contoso.com\"\ + ,\r\n \"phone\": \"+1 (234) 567-8999\"\r\n },\r\n {\r\n \ + \ \"role\": \"Policy\",\r\n \"email\": \"abc@contoso.com\",\r\ + \n \"phone\": \"+1 (234) 567-8900\"\r\n },\r\n {\r\n \ + \ \"role\": \"Technical\",\r\n \"email\": \"xyz@contoso.com\",\r\ + \n \"phone\": \"+1 (234) 567-8900\"\r\n }\r\n ],\r\n \"\ + peerName\": \"Contoso\",\r\n \"validationState\": \"Pending\"\r\n },\r\ + \n \"name\": \"myPeerAsn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Peering/peerAsns/myPeerAsn\"\ + ,\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '687' + content-type: + - application/json; charset=utf-8 + date: + - Sun, 12 Apr 2020 12:36:24 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '99' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"peeringServiceLocation": "California", "peeringServiceProvider": + "Kordia Limited"}, "location": "eastus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_peering_test_peeringf49b0dec/providers/Microsoft.Peering/peeringServices/myPeeringService?api-version=2020-01-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"California\"\ + ,\r\n \"peeringServiceProvider\": \"Kordia Limited\",\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"location\": \"eastus\",\r\n \"eTag\": \"04ed594d-7f97-4e30-966e-08641ace08cd\"\ + ,\r\n \"name\": \"myPeeringService\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_peering_test_peeringf49b0dec/providers/Microsoft.Peering/peeringServices/myPeeringService\"\ + ,\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '498' + content-type: + - application/json; charset=utf-8 + date: + - Sun, 12 Apr 2020 12:36:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '99' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_peering_test_peeringf49b0dec/providers/Microsoft.Peering/peeringServices/myPeeringService?api-version=2020-01-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"California\"\ + ,\r\n \"peeringServiceProvider\": \"Kordia Limited\",\r\n \"provisioningState\"\ + : \"Succeeded\"\r\n },\r\n \"location\": \"eastus\",\r\n \"eTag\": \"04ed594d-7f97-4e30-966e-08641ace08cd\"\ + ,\r\n \"name\": \"myPeeringService\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_peering_test_peeringf49b0dec/providers/Microsoft.Peering/peeringServices/myPeeringService\"\ + ,\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '498' + content-type: + - application/json; charset=utf-8 + date: + - Sun, 12 Apr 2020 12:36:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '599' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Peering/peerAsns/myPeerAsn?api-version=2020-01-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"peerAsn\": 65001,\r\n \"peerContactDetail\"\ + : [\r\n {\r\n \"role\": \"Noc\",\r\n \"email\": \"noc@contoso.com\"\ + ,\r\n \"phone\": \"+1 (234) 567-8999\"\r\n },\r\n {\r\n \ + \ \"role\": \"Policy\",\r\n \"email\": \"abc@contoso.com\",\r\ + \n \"phone\": \"+1 (234) 567-8900\"\r\n },\r\n {\r\n \ + \ \"role\": \"Technical\",\r\n \"email\": \"xyz@contoso.com\",\r\ + \n \"phone\": \"+1 (234) 567-8900\"\r\n }\r\n ],\r\n \"\ + peerName\": \"Contoso\",\r\n \"validationState\": \"Pending\"\r\n },\r\ + \n \"name\": \"myPeerAsn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Peering/peerAsns/myPeerAsn\"\ + ,\r\n \"type\": \"Microsoft.Peering/peerAsns\"\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '687' + content-type: + - application/json; charset=utf-8 + date: + - Sun, 12 Apr 2020 12:36:28 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '599' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_peering_test_peeringf49b0dec/providers/Microsoft.Peering/peeringServices/myPeeringService?api-version=2020-01-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 12 Apr 2020 12:36:30 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-peering/0.2.0 Azure-SDK-For-Python + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Peering/peerAsns/myPeerAsn?api-version=2020-01-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Sun, 12 Apr 2020 12:36:36 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14997' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/peering/azure-mgmt-peering/tests/recordings/test_mgmt_peering.test_peering.yaml b/sdk/peering/azure-mgmt-peering/tests/recordings/test_mgmt_peering.test_peering.yaml deleted file mode 100644 index 90ba1891bb3d..000000000000 --- a/sdk/peering/azure-mgmt-peering/tests/recordings/test_mgmt_peering.test_peering.yaml +++ /dev/null @@ -1,183 +0,0 @@ -interactions: -- request: - body: '{"properties": {"peeringServiceLocation": "California", "peeringServiceProvider": - "Kordia Limited"}, "location": "westus"}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '122' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.8 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.8 - msrest_azure/0.4.34 azure-mgmt-peering/0.1.0rc1 Azure-SDK-For-Python - accept-language: - - en-US - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName?api-version=2019-09-01-preview - response: - body: - string: "{\r\n \"properties\": {\r\n \"peeringServiceLocation\": \"California\"\ - ,\r\n \"peeringServiceProvider\": \"Kordia Limited\",\r\n \"provisioningState\"\ - : \"Succeeded\"\r\n },\r\n \"location\": \"westus\",\r\n \"eTag\": \"e242c145-decb-4c6f-be6d-ddd1909a69e4\"\ - ,\r\n \"name\": \"MyPeerServiceName\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName\"\ - ,\r\n \"type\": \"Microsoft.Peering/peeringServices\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '496' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Oct 2019 04:21:06 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '99' - status: - code: 201 - message: Created -- request: - body: '{"properties": {"prefix": "192.168.1.0/24"}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '44' - Content-Type: - - application/json; charset=utf-8 - User-Agent: - - python/3.6.8 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.8 - msrest_azure/0.4.34 azure-mgmt-peering/0.1.0rc1 Azure-SDK-For-Python - accept-language: - - en-US - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName/prefixes/MyPeerPrefix?api-version=2019-09-01-preview - response: - body: - string: "{\r\n \"properties\": {\r\n \"prefix\": \"192.168.1.0/24\",\r\n\ - \ \"prefixValidationState\": \"Pending\",\r\n \"learnedType\": \"None\"\ - ,\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"name\": \"MyPeerPrefix\"\ - ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName/prefixes/MyPeerPrefix\"\ - ,\r\n \"type\": \"Microsoft.Peering/peeringServices/prefixes\"\r\n}" - headers: - cache-control: - - no-cache - content-length: - - '454' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Oct 2019 04:21:07 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.8 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.8 - msrest_azure/0.4.34 azure-mgmt-peering/0.1.0rc1 Azure-SDK-For-Python - accept-language: - - en-US - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName/prefixes/MyPeerPrefix?api-version=2019-09-01-preview - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Thu, 24 Oct 2019 04:21:07 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.8 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.8 - msrest_azure/0.4.34 azure-mgmt-peering/0.1.0rc1 Azure-SDK-For-Python - accept-language: - - en-US - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_peering_test_peeringc05b0c55/providers/Microsoft.Peering/peeringServices/MyPeerServiceName?api-version=2019-09-01-preview - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Thu, 24 Oct 2019 04:21:08 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14998' - status: - code: 200 - message: OK -version: 1 diff --git a/sdk/peering/azure-mgmt-peering/tests/test_cli_mgmt_peering.py b/sdk/peering/azure-mgmt-peering/tests/test_cli_mgmt_peering.py new file mode 100644 index 000000000000..1978762485fe --- /dev/null +++ b/sdk/peering/azure-mgmt-peering/tests/test_cli_mgmt_peering.py @@ -0,0 +1,307 @@ +# coding: utf-8 + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + + +# TEST SCENARIO COVERAGE +# ---------------------- +# Methods Total : 35 +# Methods Covered : 35 +# Examples Total : 38 +# Examples Tested : 18 +# Coverage % : 47 +# ---------------------- + +import unittest + +import azure.mgmt.peering +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtPeeringTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtPeeringTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.peering.PeeringManagementClient + ) + + @ResourceGroupPreparer(location=AZURE_LOCATION) + def test_peering(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + RESOURCE_GROUP = resource_group.name + PEER_ASN_NAME = "myPeerAsn" + PEERING_NAME = "myPeering" + REGISTERED_ASN_NAME = "myRegisteredAsn" + REGISTERED_PREFIX_NAME = "myRegisteredPrefix" + PEERING_SERVICE_NAME = "myPeeringService" + PREFIX_NAME = "myPrefix" + + # /PeerAsns/put/Create a peer ASN[put] + BODY = { + "peer_asn": "65001", + "peer_contact_detail": [ + { + "role": "Noc", + "email": "noc@contoso.com", + "phone": "+1 (234) 567-8999" + }, + { + "role": "Policy", + "email": "abc@contoso.com", + "phone": "+1 (234) 567-8900" + }, + { + "role": "Technical", + "email": "xyz@contoso.com", + "phone": "+1 (234) 567-8900" + } + ], + "peer_name": "Contoso" + } + # result = self.mgmt_client.peer_asns.create_or_update(peer_asn_name=PEER_ASN_NAME, peer_asn=BODY) + + # /Peerings/put/Create an exchange peering[put] + BODY = { + "sku": { + "name": "Basic_Exchange_Free" + }, + "kind": "Exchange", + "location": "eastus", + "exchange": { + "connections": [ + { + "peering_dbfacility_id": "99999", + "bgp_session": { + "peer_session_ipv4address": "192.168.2.1", + "peer_session_ipv6address": "fd00::1", + "max_prefixes_advertised_v4": "1000", + "max_prefixes_advertised_v6": "100", + "md5authentication_key": "test-md5-auth-key" + }, + "connection_identifier": "CE495334-0E94-4E51-8164-8116D6CD284D" + }, + { + "peering_dbfacility_id": "99999", + "bgp_session": { + "peer_session_ipv4address": "192.168.2.2", + "peer_session_ipv6address": "fd00::2", + "max_prefixes_advertised_v4": "1000", + "max_prefixes_advertised_v6": "100", + "md5authentication_key": "test-md5-auth-key" + }, + "connection_identifier": "CDD8E673-CB07-47E6-84DE-3739F778762B" + } + ], + "peer_asn": { + "id": "/subscriptions/" + SUBSCRIPTION_ID + "/providers/Microsoft.Peering/peerAsns/" + PEER_ASN_NAME + "" + } + }, + "peering_location": "peeringLocation0" + } + # result = self.mgmt_client.peerings.create_or_update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, peering=BODY) + + # /Peerings/put/Create a peering with exchange route server[put] + BODY = { + "sku": { + "name": "Premium_Direct_Free" + }, + "kind": "Direct", + "location": "eastus", + "direct": { + "connections": [ + { + "bandwidth_in_mbps": "10000", + "session_address_provider": "Peer", + "use_for_peering_service": True, + "peering_dbfacility_id": "99999", + "bgp_session": { + "session_prefix_v4": "192.168.0.0/24", + "microsoft_session_ipv4address": "192.168.0.123", + "peer_session_ipv4address": "192.168.0.234", + "max_prefixes_advertised_v4": "1000", + "max_prefixes_advertised_v6": "100" + }, + "connection_identifier": "5F4CB5C7-6B43-4444-9338-9ABC72606C16" + } + ], + "peer_asn": { + "id": "/subscriptions/" + SUBSCRIPTION_ID + "/providers/Microsoft.Peering/peerAsns/" + PEER_ASN_NAME + "" + }, + "direct_peering_type": "IxRs" + }, + "peering_location": "peeringLocation0" + } + # result = self.mgmt_client.peerings.create_or_update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, peering=BODY) + + # /Peerings/put/Create a direct peering[put] + BODY = { + "sku": { + "name": "Basic_Direct_Free" + }, + "kind": "Direct", + "location": "eastus", + "direct": { + "connections": [ + { + "bandwidth_in_mbps": "10000", + "session_address_provider": "Peer", + "use_for_peering_service": False, + "peering_dbfacility_id": "99999", + "bgp_session": { + "session_prefix_v4": "192.168.0.0/31", + "session_prefix_v6": "fd00::0/127", + "max_prefixes_advertised_v4": "1000", + "max_prefixes_advertised_v6": "100", + "md5authentication_key": "test-md5-auth-key" + }, + "connection_identifier": "5F4CB5C7-6B43-4444-9338-9ABC72606C16" + }, + { + "bandwidth_in_mbps": "10000", + "session_address_provider": "Microsoft", + "use_for_peering_service": True, + "peering_dbfacility_id": "99999", + "connection_identifier": "8AB00818-D533-4504-A25A-03A17F61201C" + } + ], + "peer_asn": { + "id": "/subscriptions/" + SUBSCRIPTION_ID + "/providers/Microsoft.Peering/peerAsns/" + PEER_ASN_NAME + "" + }, + "direct_peering_type": "Edge" + }, + "peering_location": "peeringLocation0" + } + # result = self.mgmt_client.peerings.create_or_update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, peering=BODY) + + # /PeeringServices/put/Create a peering service[put] + BODY = { + "location": "eastus", + "peering_service_location": "California", + "peering_service_provider": "Kordia Limited" + } + result = self.mgmt_client.peering_services.create_or_update(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME, peering_service=BODY) + + # /RegisteredAsns/put/Create or update a registered ASN for the peering[put] + BODY = { + "asn": "65000" + } + # result = self.mgmt_client.registered_asns.create_or_update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_asn_name=REGISTERED_ASN_NAME, registered_asn=BODY) + + # /Prefixes/put/Create or update a prefix for the peering service[put] + # result = self.mgmt_client.prefixes.create_or_update(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME, prefix_name=PREFIX_NAME, prefix="192.168.1.0/24") + + # /RegisteredPrefixes/put/Create or update a registered prefix for the peering[put] + BODY = { + "prefix": "10.22.20.0/24" + } + # result = self.mgmt_client.registered_prefixes.create_or_update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_prefix_name=REGISTERED_PREFIX_NAME, registered_prefix=BODY) + + # /RegisteredPrefixes/get/Get a registered prefix associated with the peering[get] + # result = self.mgmt_client.registered_prefixes.get(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_prefix_name=REGISTERED_PREFIX_NAME) + + # /Prefixes/get/Get a prefix associated with the peering service[get] + # result = self.mgmt_client.prefixes.get(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME, prefix_name=PREFIX_NAME) + + # /RegisteredAsns/get/Get a registered ASN associated with the peering[get] + # result = self.mgmt_client.registered_asns.get(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_asn_name=REGISTERED_ASN_NAME) + + # /Prefixes/get/List all the prefixes associated with the peering service[get] + result = self.mgmt_client.prefixes.list_by_peering_service(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME) + + # /RegisteredPrefixes/get/List all the registered prefixes associated with the peering[get] + # result = self.mgmt_client.registered_prefixes.list_by_peering(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME) + + # /PeeringServices/get/Get a peering service[get] + result = self.mgmt_client.peering_services.get(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME) + + # /RegisteredAsns/get/List all the registered ASNs associated with the peering[get] + # result = self.mgmt_client.registered_asns.list_by_peering(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME) + + # /Peerings/get/Get a peering[get] + # result = self.mgmt_client.peerings.get(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME) + + # /PeeringServices/get/List peering services in a resource group[get] + result = self.mgmt_client.peering_services.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + + # /Peerings/get/List peerings in a resource group[get] + result = self.mgmt_client.peerings.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + + # /PeerAsns/get/Get a peer ASN[get] + result = self.mgmt_client.peer_asns.get(peer_asn_name=PEER_ASN_NAME) + + # /PeeringServiceCountries/get/List peering service countries[get] + result = self.mgmt_client.peering_service_countries.list() + + # /PeeringServiceLocations/get/List peering service locations[get] + result = self.mgmt_client.peering_service_locations.list(country="country1") + + # /PeeringServiceProviders/get/List peering service providers[get] + result = self.mgmt_client.peering_service_providers.list() + + # /PeeringLocations/get/List exchange peering locations[get] + result = self.mgmt_client.peering_locations.list(kind="Exchange") + + # /PeeringLocations/get/List direct peering locations[get] + result = self.mgmt_client.peering_locations.list(kind="Direct") + + # /PeeringServices/get/List peering services in a subscription[get] + result = self.mgmt_client.peering_services.list_by_subscription() + + # /LegacyPeerings/get/List legacy peerings[get] + result = self.mgmt_client.legacy_peerings.list(peering_location="peeringLocation0", kind="Exchange", asn="65000") + + # /PeerAsns/get/List peer ASNs in a subscription[get] + result = self.mgmt_client.peer_asns.list_by_subscription() + + # /Peerings/get/List peerings in a subscription[get] + result = self.mgmt_client.peerings.list_by_subscription() + + # /Operations/get/List peering operations[get] + result = self.mgmt_client.operations.list() + + # /PeeringServices/patch/Update peering service tags[patch] + TAGS = { + "tag0": "value0", + "tag1": "value1" + } + # result = self.mgmt_client.peering_services.update(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME, tags= + ToSnakeCase(k).toUpperCase() + ) + + # /Peerings/patch/Update peering tags[patch] + TAGS = { + "tag0": "value0", + "tag1": "value1" + } + # result = self.mgmt_client.peerings.update(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, tags= + ToSnakeCase(k).toUpperCase() + ) + + # //post/Check if peering service provider is available in customer location[post] + # result = self.mgmt_client.check_service_provider_availability(peering_service_location="peeringServiceLocation1", peering_service_provider="peeringServiceProvider1") + + # /RegisteredPrefixes/delete/Deletes a registered prefix associated with the peering[delete] + # result = self.mgmt_client.registered_prefixes.delete(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_prefix_name=REGISTERED_PREFIX_NAME) + + # /Prefixes/delete/Delete a prefix associated with the peering service[delete] + # result = self.mgmt_client.prefixes.delete(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME, prefix_name=PREFIX_NAME) + + # /RegisteredAsns/delete/Deletes a registered ASN associated with the peering[delete] + # result = self.mgmt_client.registered_asns.delete(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME, registered_asn_name=REGISTERED_ASN_NAME) + + # /PeeringServices/delete/Delete a peering service[delete] + result = self.mgmt_client.peering_services.delete(resource_group_name=RESOURCE_GROUP, peering_service_name=PEERING_SERVICE_NAME) + + # /Peerings/delete/Delete a peering[delete] + # result = self.mgmt_client.peerings.delete(resource_group_name=RESOURCE_GROUP, peering_name=PEERING_NAME) + + # /PeerAsns/delete/Delete a peer ASN[delete] + result = self.mgmt_client.peer_asns.delete(peer_asn_name=PEER_ASN_NAME) + + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/sdk/peering/azure-mgmt-peering/tests/test_mgmt_peering.py b/sdk/peering/azure-mgmt-peering/tests/test_mgmt_peering.py deleted file mode 100644 index af3c9cad404e..000000000000 --- a/sdk/peering/azure-mgmt-peering/tests/test_mgmt_peering.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding: utf-8 - -#------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -#-------------------------------------------------------------------------- - -import unittest - -import azure.mgmt.peering -from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer - -AZURE_LOCATION = 'westus' - -class MgmtPeeringTest(AzureMgmtTestCase): - - def setUp(self): - super(MgmtPeeringTest, self).setUp() - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.peering.PeeringManagementClient - ) - - @ResourceGroupPreparer(location=AZURE_LOCATION) - def test_peering(self, resource_group): - - PEERING_SERVICE_NAME = "MyPeerServiceName" - PREFIX_NAME = "MyPeerPrefix" - PREFIX_VALUE = "192.168.1.0/24" - - BODY = { - "properties": { - "peeringServiceLocation": "California", - "peeringServiceProvider": "Kordia Limited" - }, - "location": "westus" - } - azure_operation_poller = self.mgmt_client.peering_services.create_or_update(resource_group.name, PEERING_SERVICE_NAME, BODY) - self.assertEqual(azure_operation_poller.name, PEERING_SERVICE_NAME) - self.assertEqual(azure_operation_poller.provisioning_state, "Succeeded") - - azure_operation_poller = self.mgmt_client.prefixes.create_or_update(resource_group.name, PEERING_SERVICE_NAME, PREFIX_NAME, prefix=PREFIX_VALUE) - self.assertEqual(azure_operation_poller.prefix, PREFIX_VALUE) - self.assertEqual(azure_operation_poller.provisioning_state, "Succeeded") - - azure_operation_poller = self.mgmt_client.prefixes.delete(resource_group.name, PEERING_SERVICE_NAME, PREFIX_NAME, prefix=PREFIX_VALUE) - - BODY = {} - azure_operation_poller = self.mgmt_client.peering_services.delete(resource_group.name, PEERING_SERVICE_NAME, BODY) - - -#------------------------------------------------------------------------------ -if __name__ == '__main__': - unittest.main()