diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/HISTORY.rst b/sdk/managednetwork/azure-mgmt-managednetwork/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/MANIFEST.in b/sdk/managednetwork/azure-mgmt-managednetwork/MANIFEST.in new file mode 100644 index 000000000000..e4884efef41b --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/README.rst b/sdk/managednetwork/azure-mgmt-managednetwork/README.rst new file mode 100644 index 000000000000..b7d333a3f2b7 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/README.rst @@ -0,0 +1,33 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure MyService Management Client Library. + +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. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Usage +===== + +For code examples, see `MyService Management +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-managednetwork%2FREADME.png diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/__init__.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/__init__.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/__init__.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/__init__.py new file mode 100644 index 000000000000..b32c521e0689 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import ManagedNetworkManagementClientConfiguration +from ._managed_network_management_client import ManagedNetworkManagementClient +__all__ = ['ManagedNetworkManagementClient', 'ManagedNetworkManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_configuration.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_configuration.py new file mode 100644 index 000000000000..c9023d26ee0b --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_configuration.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class ManagedNetworkManagementClientConfiguration(AzureConfiguration): + """Configuration for ManagedNetworkManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Gets subscription credentials which uniquely + identify Microsoft Azure subscription. The subscription ID forms part of + the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ManagedNetworkManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-managednetwork/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_managed_network_management_client.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_managed_network_management_client.py new file mode 100644 index 000000000000..32c272830837 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/_managed_network_management_client.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import ManagedNetworkManagementClientConfiguration +from .operations import ManagedNetworksOperations +from .operations import ScopeAssignmentsOperations +from .operations import ManagedNetworkGroupsOperations +from .operations import ManagedNetworkPeeringPoliciesOperations +from .operations import Operations +from . import models + + +class ManagedNetworkManagementClient(SDKClient): + """The Microsoft Azure Managed Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to programmatically view, control, change, and monitor your entire Azure network centrally and with ease. + + :ivar config: Configuration for client. + :vartype config: ManagedNetworkManagementClientConfiguration + + :ivar managed_networks: ManagedNetworks operations + :vartype managed_networks: managednetwork.operations.ManagedNetworksOperations + :ivar scope_assignments: ScopeAssignments operations + :vartype scope_assignments: managednetwork.operations.ScopeAssignmentsOperations + :ivar managed_network_groups: ManagedNetworkGroups operations + :vartype managed_network_groups: managednetwork.operations.ManagedNetworkGroupsOperations + :ivar managed_network_peering_policies: ManagedNetworkPeeringPolicies operations + :vartype managed_network_peering_policies: managednetwork.operations.ManagedNetworkPeeringPoliciesOperations + :ivar operations: Operations operations + :vartype operations: managednetwork.operations.Operations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Gets subscription credentials which uniquely + identify Microsoft Azure subscription. The subscription ID forms part of + the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ManagedNetworkManagementClientConfiguration(credentials, subscription_id, base_url) + super(ManagedNetworkManagementClient, 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-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.managed_networks = ManagedNetworksOperations( + self._client, self.config, self._serialize, self._deserialize) + self.scope_assignments = ScopeAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_network_groups = ManagedNetworkGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_network_peering_policies = ManagedNetworkPeeringPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/__init__.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/__init__.py new file mode 100644 index 000000000000..d1d68007939e --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/__init__.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ConnectivityCollection + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import HubAndSpokePeeringPolicyProperties + from ._models_py3 import ManagedNetwork + from ._models_py3 import ManagedNetworkGroup + from ._models_py3 import ManagedNetworkPeeringPolicy + from ._models_py3 import ManagedNetworkPeeringPolicyProperties + from ._models_py3 import ManagedNetworkUpdate + from ._models_py3 import MeshPeeringPolicyProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import ResourceId + from ._models_py3 import ResourceProperties + from ._models_py3 import Scope + from ._models_py3 import ScopeAssignment + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import ConnectivityCollection + from ._models import ErrorResponse, ErrorResponseException + from ._models import HubAndSpokePeeringPolicyProperties + from ._models import ManagedNetwork + from ._models import ManagedNetworkGroup + from ._models import ManagedNetworkPeeringPolicy + from ._models import ManagedNetworkPeeringPolicyProperties + from ._models import ManagedNetworkUpdate + from ._models import MeshPeeringPolicyProperties + from ._models import Operation + from ._models import OperationDisplay + from ._models import ProxyResource + from ._models import Resource + from ._models import ResourceId + from ._models import ResourceProperties + from ._models import Scope + from ._models import ScopeAssignment + from ._models import TrackedResource +from ._paged_models import ManagedNetworkGroupPaged +from ._paged_models import ManagedNetworkPaged +from ._paged_models import ManagedNetworkPeeringPolicyPaged +from ._paged_models import OperationPaged +from ._paged_models import ScopeAssignmentPaged +from ._managed_network_management_client_enums import ( + Kind, + Type, + ProvisioningState, +) + +__all__ = [ + 'ConnectivityCollection', + 'ErrorResponse', 'ErrorResponseException', + 'HubAndSpokePeeringPolicyProperties', + 'ManagedNetwork', + 'ManagedNetworkGroup', + 'ManagedNetworkPeeringPolicy', + 'ManagedNetworkPeeringPolicyProperties', + 'ManagedNetworkUpdate', + 'MeshPeeringPolicyProperties', + 'Operation', + 'OperationDisplay', + 'ProxyResource', + 'Resource', + 'ResourceId', + 'ResourceProperties', + 'Scope', + 'ScopeAssignment', + 'TrackedResource', + 'ManagedNetworkPaged', + 'ScopeAssignmentPaged', + 'ManagedNetworkGroupPaged', + 'ManagedNetworkPeeringPolicyPaged', + 'OperationPaged', + 'Kind', + 'Type', + 'ProvisioningState', +] diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_managed_network_management_client_enums.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_managed_network_management_client_enums.py new file mode 100644 index 000000000000..bf1a67163cd8 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_managed_network_management_client_enums.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class Kind(str, Enum): + + connectivity = "Connectivity" + + +class Type(str, Enum): + + hub_and_spoke_topology = "HubAndSpokeTopology" + mesh_topology = "MeshTopology" + + +class ProvisioningState(str, Enum): + + updating = "Updating" + deleting = "Deleting" + failed = "Failed" + succeeded = "Succeeded" diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models.py new file mode 100644 index 000000000000..bf3a87073b54 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models.py @@ -0,0 +1,723 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConnectivityCollection(Model): + """The collection of Connectivity related groups and policies within the + Managed Network. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar groups: The collection of connectivity related Managed Network + Groups within the Managed Network + :vartype groups: list[~managednetwork.models.ManagedNetworkGroup] + :ivar peerings: The collection of Managed Network Peering Policies within + the Managed Network + :vartype peerings: + list[~managednetwork.models.ManagedNetworkPeeringPolicy] + """ + + _validation = { + 'groups': {'readonly': True}, + 'peerings': {'readonly': True}, + } + + _attribute_map = { + 'groups': {'key': 'groups', 'type': '[ManagedNetworkGroup]'}, + 'peerings': {'key': 'peerings', 'type': '[ManagedNetworkPeeringPolicy]'}, + } + + def __init__(self, **kwargs): + super(ConnectivityCollection, self).__init__(**kwargs) + self.groups = None + self.peerings = None + + +class ErrorResponse(Model): + """The error response that indicates why an operation has failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ResourceProperties(Model): + """Base for resource properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.etag = None + + +class ManagedNetworkPeeringPolicyProperties(ResourceProperties): + """Properties of a Managed Network Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, **kwargs): + super(ManagedNetworkPeeringPolicyProperties, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.hub = kwargs.get('hub', None) + self.spokes = kwargs.get('spokes', None) + self.mesh = kwargs.get('mesh', None) + + +class HubAndSpokePeeringPolicyProperties(ManagedNetworkPeeringPolicyProperties): + """Properties of a Hub and Spoke Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, **kwargs): + super(HubAndSpokePeeringPolicyProperties, self).__init__(**kwargs) + + +class Resource(Model): + """The general resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class ManagedNetwork(TrackedResource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param scope: The collection of management groups, subscriptions, virtual + networks, and subnets by the Managed Network. This is a read-only property + that is reflective of all ScopeAssignments for this Managed Network + :type scope: ~managednetwork.models.Scope + :ivar connectivity: The collection of groups and policies concerned with + connectivity + :vartype connectivity: ~managednetwork.models.ConnectivityCollection + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'connectivity': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'Scope'}, + 'connectivity': {'key': 'properties.connectivity', 'type': 'ConnectivityCollection'}, + } + + def __init__(self, **kwargs): + super(ManagedNetwork, self).__init__(**kwargs) + self.provisioning_state = None + self.etag = None + self.scope = kwargs.get('scope', None) + self.connectivity = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + + +class ManagedNetworkGroup(ProxyResource): + """The Managed Network Group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param management_groups: The collection of management groups covered by + the Managed Network + :type management_groups: list[~managednetwork.models.ResourceId] + :param subscriptions: The collection of subscriptions covered by the + Managed Network + :type subscriptions: list[~managednetwork.models.ResourceId] + :param virtual_networks: The collection of virtual nets covered by the + Managed Network + :type virtual_networks: list[~managednetwork.models.ResourceId] + :param subnets: The collection of subnets covered by the Managed Network + :type subnets: list[~managednetwork.models.ResourceId] + :param kind: Responsibility role under which this Managed Network Group + will be created. Possible values include: 'Connectivity' + :type kind: str or ~managednetwork.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'management_groups': {'key': 'properties.managementGroups', 'type': '[ResourceId]'}, + 'subscriptions': {'key': 'properties.subscriptions', 'type': '[ResourceId]'}, + 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[ResourceId]'}, + 'subnets': {'key': 'properties.subnets', 'type': '[ResourceId]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedNetworkGroup, self).__init__(**kwargs) + self.provisioning_state = None + self.etag = None + self.management_groups = kwargs.get('management_groups', None) + self.subscriptions = kwargs.get('subscriptions', None) + self.virtual_networks = kwargs.get('virtual_networks', None) + self.subnets = kwargs.get('subnets', None) + self.kind = kwargs.get('kind', None) + + +class ManagedNetworkPeeringPolicy(ProxyResource): + """The Managed Network Peering Policy resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param properties: Gets or sets the properties of a Managed Network Policy + :type properties: + ~managednetwork.models.ManagedNetworkPeeringPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagedNetworkPeeringPolicyProperties'}, + } + + def __init__(self, **kwargs): + super(ManagedNetworkPeeringPolicy, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ManagedNetworkUpdate(Model): + """Update Tags of Managed Network. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ManagedNetworkUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class MeshPeeringPolicyProperties(ManagedNetworkPeeringPolicyProperties): + """Properties of a Mesh Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, **kwargs): + super(MeshPeeringPolicyProperties, self).__init__(**kwargs) + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~managednetwork.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ManagedNetwork + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + + +class ResourceId(Model): + """Generic pointer to a resource. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceId, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Scope(Model): + """Scope of a Managed Network. + + :param management_groups: The collection of management groups covered by + the Managed Network + :type management_groups: list[~managednetwork.models.ResourceId] + :param subscriptions: The collection of subscriptions covered by the + Managed Network + :type subscriptions: list[~managednetwork.models.ResourceId] + :param virtual_networks: The collection of virtual nets covered by the + Managed Network + :type virtual_networks: list[~managednetwork.models.ResourceId] + :param subnets: The collection of subnets covered by the Managed Network + :type subnets: list[~managednetwork.models.ResourceId] + """ + + _attribute_map = { + 'management_groups': {'key': 'managementGroups', 'type': '[ResourceId]'}, + 'subscriptions': {'key': 'subscriptions', 'type': '[ResourceId]'}, + 'virtual_networks': {'key': 'virtualNetworks', 'type': '[ResourceId]'}, + 'subnets': {'key': 'subnets', 'type': '[ResourceId]'}, + } + + def __init__(self, **kwargs): + super(Scope, self).__init__(**kwargs) + self.management_groups = kwargs.get('management_groups', None) + self.subscriptions = kwargs.get('subscriptions', None) + self.virtual_networks = kwargs.get('virtual_networks', None) + self.subnets = kwargs.get('subnets', None) + + +class ScopeAssignment(ProxyResource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param assigned_managed_network: The managed network ID with scope will be + assigned to. + :type assigned_managed_network: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'assigned_managed_network': {'key': 'properties.assignedManagedNetwork', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ScopeAssignment, self).__init__(**kwargs) + self.provisioning_state = None + self.etag = None + self.assigned_managed_network = kwargs.get('assigned_managed_network', None) diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models_py3.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models_py3.py new file mode 100644 index 000000000000..7ca25827b1e3 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_models_py3.py @@ -0,0 +1,723 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ConnectivityCollection(Model): + """The collection of Connectivity related groups and policies within the + Managed Network. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar groups: The collection of connectivity related Managed Network + Groups within the Managed Network + :vartype groups: list[~managednetwork.models.ManagedNetworkGroup] + :ivar peerings: The collection of Managed Network Peering Policies within + the Managed Network + :vartype peerings: + list[~managednetwork.models.ManagedNetworkPeeringPolicy] + """ + + _validation = { + 'groups': {'readonly': True}, + 'peerings': {'readonly': True}, + } + + _attribute_map = { + 'groups': {'key': 'groups', 'type': '[ManagedNetworkGroup]'}, + 'peerings': {'key': 'peerings', 'type': '[ManagedNetworkPeeringPolicy]'}, + } + + def __init__(self, **kwargs) -> None: + super(ConnectivityCollection, self).__init__(**kwargs) + self.groups = None + self.peerings = None + + +class ErrorResponse(Model): + """The error response that indicates why an operation has failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ResourceProperties(Model): + """Base for resource properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.etag = None + + +class ManagedNetworkPeeringPolicyProperties(ResourceProperties): + """Properties of a Managed Network Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, *, type, hub=None, spokes=None, mesh=None, **kwargs) -> None: + super(ManagedNetworkPeeringPolicyProperties, self).__init__(**kwargs) + self.type = type + self.hub = hub + self.spokes = spokes + self.mesh = mesh + + +class HubAndSpokePeeringPolicyProperties(ManagedNetworkPeeringPolicyProperties): + """Properties of a Hub and Spoke Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, *, type, hub=None, spokes=None, mesh=None, **kwargs) -> None: + super(HubAndSpokePeeringPolicyProperties, self).__init__(type=type, hub=hub, spokes=spokes, mesh=mesh, **kwargs) + + +class Resource(Model): + """The general resource model definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(location=location, **kwargs) + self.tags = tags + + +class ManagedNetwork(TrackedResource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param scope: The collection of management groups, subscriptions, virtual + networks, and subnets by the Managed Network. This is a read-only property + that is reflective of all ScopeAssignments for this Managed Network + :type scope: ~managednetwork.models.Scope + :ivar connectivity: The collection of groups and policies concerned with + connectivity + :vartype connectivity: ~managednetwork.models.ConnectivityCollection + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'connectivity': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'scope': {'key': 'properties.scope', 'type': 'Scope'}, + 'connectivity': {'key': 'properties.connectivity', 'type': 'ConnectivityCollection'}, + } + + def __init__(self, *, location: str=None, tags=None, scope=None, **kwargs) -> None: + super(ManagedNetwork, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.etag = None + self.scope = scope + self.connectivity = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, **kwargs) -> None: + super(ProxyResource, self).__init__(location=location, **kwargs) + + +class ManagedNetworkGroup(ProxyResource): + """The Managed Network Group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param management_groups: The collection of management groups covered by + the Managed Network + :type management_groups: list[~managednetwork.models.ResourceId] + :param subscriptions: The collection of subscriptions covered by the + Managed Network + :type subscriptions: list[~managednetwork.models.ResourceId] + :param virtual_networks: The collection of virtual nets covered by the + Managed Network + :type virtual_networks: list[~managednetwork.models.ResourceId] + :param subnets: The collection of subnets covered by the Managed Network + :type subnets: list[~managednetwork.models.ResourceId] + :param kind: Responsibility role under which this Managed Network Group + will be created. Possible values include: 'Connectivity' + :type kind: str or ~managednetwork.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'management_groups': {'key': 'properties.managementGroups', 'type': '[ResourceId]'}, + 'subscriptions': {'key': 'properties.subscriptions', 'type': '[ResourceId]'}, + 'virtual_networks': {'key': 'properties.virtualNetworks', 'type': '[ResourceId]'}, + 'subnets': {'key': 'properties.subnets', 'type': '[ResourceId]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, management_groups=None, subscriptions=None, virtual_networks=None, subnets=None, kind=None, **kwargs) -> None: + super(ManagedNetworkGroup, self).__init__(location=location, **kwargs) + self.provisioning_state = None + self.etag = None + self.management_groups = management_groups + self.subscriptions = subscriptions + self.virtual_networks = virtual_networks + self.subnets = subnets + self.kind = kind + + +class ManagedNetworkPeeringPolicy(ProxyResource): + """The Managed Network Peering Policy resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param properties: Gets or sets the properties of a Managed Network Policy + :type properties: + ~managednetwork.models.ManagedNetworkPeeringPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ManagedNetworkPeeringPolicyProperties'}, + } + + def __init__(self, *, location: str=None, properties=None, **kwargs) -> None: + super(ManagedNetworkPeeringPolicy, self).__init__(location=location, **kwargs) + self.properties = properties + + +class ManagedNetworkUpdate(Model): + """Update Tags of Managed Network. + + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(ManagedNetworkUpdate, self).__init__(**kwargs) + self.tags = tags + + +class MeshPeeringPolicyProperties(ManagedNetworkPeeringPolicyProperties): + """Properties of a Mesh Peering Policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param type: Required. Gets or sets the connectivity type of a network + structure policy. Possible values include: 'HubAndSpokeTopology', + 'MeshTopology' + :type type: str or ~managednetwork.models.Type + :param hub: Gets or sets the hub virtual network ID + :type hub: ~managednetwork.models.ResourceId + :param spokes: Gets or sets the spokes group IDs + :type spokes: list[~managednetwork.models.ResourceId] + :param mesh: Gets or sets the mesh group IDs + :type mesh: list[~managednetwork.models.ResourceId] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hub': {'key': 'hub', 'type': 'ResourceId'}, + 'spokes': {'key': 'spokes', 'type': '[ResourceId]'}, + 'mesh': {'key': 'mesh', 'type': '[ResourceId]'}, + } + + def __init__(self, *, type, hub=None, spokes=None, mesh=None, **kwargs) -> None: + super(MeshPeeringPolicyProperties, self).__init__(type=type, hub=hub, spokes=spokes, mesh=mesh, **kwargs) + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~managednetwork.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ManagedNetwork + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class ResourceId(Model): + """Generic pointer to a resource. + + :param id: Resource Id + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(ResourceId, self).__init__(**kwargs) + self.id = id + + +class Scope(Model): + """Scope of a Managed Network. + + :param management_groups: The collection of management groups covered by + the Managed Network + :type management_groups: list[~managednetwork.models.ResourceId] + :param subscriptions: The collection of subscriptions covered by the + Managed Network + :type subscriptions: list[~managednetwork.models.ResourceId] + :param virtual_networks: The collection of virtual nets covered by the + Managed Network + :type virtual_networks: list[~managednetwork.models.ResourceId] + :param subnets: The collection of subnets covered by the Managed Network + :type subnets: list[~managednetwork.models.ResourceId] + """ + + _attribute_map = { + 'management_groups': {'key': 'managementGroups', 'type': '[ResourceId]'}, + 'subscriptions': {'key': 'subscriptions', 'type': '[ResourceId]'}, + 'virtual_networks': {'key': 'virtualNetworks', 'type': '[ResourceId]'}, + 'subnets': {'key': 'subnets', 'type': '[ResourceId]'}, + } + + def __init__(self, *, management_groups=None, subscriptions=None, virtual_networks=None, subnets=None, **kwargs) -> None: + super(Scope, self).__init__(**kwargs) + self.management_groups = management_groups + self.subscriptions = subscriptions + self.virtual_networks = virtual_networks + self.subnets = subnets + + +class ScopeAssignment(ProxyResource): + """The Managed Network resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :ivar provisioning_state: Provisioning state of the ManagedNetwork + resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' + :vartype provisioning_state: str or + ~managednetwork.models.ProvisioningState + :ivar etag: A unique read-only string that changes whenever the resource + is updated. + :vartype etag: str + :param assigned_managed_network: The managed network ID with scope will be + assigned to. + :type assigned_managed_network: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'etag': {'key': 'properties.etag', 'type': 'str'}, + 'assigned_managed_network': {'key': 'properties.assignedManagedNetwork', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, assigned_managed_network: str=None, **kwargs) -> None: + super(ScopeAssignment, self).__init__(location=location, **kwargs) + self.provisioning_state = None + self.etag = None + self.assigned_managed_network = assigned_managed_network diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_paged_models.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_paged_models.py new file mode 100644 index 000000000000..cdd29a32f75a --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/_paged_models.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagedNetworkPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedNetwork ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedNetwork]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedNetworkPaged, self).__init__(*args, **kwargs) +class ScopeAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`ScopeAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ScopeAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(ScopeAssignmentPaged, self).__init__(*args, **kwargs) +class ManagedNetworkGroupPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedNetworkGroup ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedNetworkGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedNetworkGroupPaged, self).__init__(*args, **kwargs) +class ManagedNetworkPeeringPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedNetworkPeeringPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedNetworkPeeringPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedNetworkPeeringPolicyPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/__init__.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/__init__.py new file mode 100644 index 000000000000..331f177ee5bd --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/__init__.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._managed_networks_operations import ManagedNetworksOperations +from ._scope_assignments_operations import ScopeAssignmentsOperations +from ._managed_network_groups_operations import ManagedNetworkGroupsOperations +from ._managed_network_peering_policies_operations import ManagedNetworkPeeringPoliciesOperations +from ._operations import Operations + +__all__ = [ + 'ManagedNetworksOperations', + 'ScopeAssignmentsOperations', + 'ManagedNetworkGroupsOperations', + 'ManagedNetworkPeeringPoliciesOperations', + 'Operations', +] diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_groups_operations.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_groups_operations.py new file mode 100644 index 000000000000..389ac9cc0ce3 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_groups_operations.py @@ -0,0 +1,385 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedNetworkGroupsOperations(object): + """ManagedNetworkGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_network_name, managed_network_group_name, custom_headers=None, raw=False, **operation_config): + """The Get ManagedNetworkGroups operation gets a Managed Network Group + specified by the resource group, Managed Network name, and group name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_group_name: The name of the Managed Network + Group. + :type managed_network_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedNetworkGroup or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ManagedNetworkGroup or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkGroupName': self._serialize.url("managed_network_group_name", managed_network_group_name, '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('ManagedNetworkGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}'} + + + def _create_or_update_initial( + self, managed_network_group, resource_group_name, managed_network_name, managed_network_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkGroupName': self._serialize.url("managed_network_group_name", managed_network_group_name, '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(managed_network_group, 'ManagedNetworkGroup') + + # 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('ManagedNetworkGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedNetworkGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, managed_network_group, resource_group_name, managed_network_name, managed_network_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The Put ManagedNetworkGroups operation creates or updates a Managed + Network Group resource. + + :param managed_network_group: Parameters supplied to the create/update + a Managed Network Group resource + :type managed_network_group: + ~managednetwork.models.ManagedNetworkGroup + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_group_name: The name of the Managed Network + Group. + :type managed_network_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ManagedNetworkGroup or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~managednetwork.models.ManagedNetworkGroup] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~managednetwork.models.ManagedNetworkGroup]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + managed_network_group=managed_network_group, + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + managed_network_group_name=managed_network_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedNetworkGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}'} + + + def _delete_initial( + self, resource_group_name, managed_network_name, managed_network_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkGroupName': self._serialize.url("managed_network_group_name", managed_network_group_name, '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, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, managed_network_name, managed_network_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The Delete ManagedNetworkGroups operation deletes a Managed Network + Group specified by the resource group, Managed Network name, and group + name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_group_name: The name of the Managed Network + Group. + :type managed_network_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + managed_network_group_name=managed_network_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}'} + + def list_by_managed_network( + self, resource_group_name, managed_network_name, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """The ListByManagedNetwork ManagedNetworkGroup operation retrieves all + the Managed Network Groups in a specified Managed Networks in a + paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param top: May be used to limit the number of results in a page for + list queries. + :type top: int + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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 ManagedNetworkGroup + :rtype: + ~managednetwork.models.ManagedNetworkGroupPaged[~managednetwork.models.ManagedNetworkGroup] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_managed_network.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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.ManagedNetworkGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_managed_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups'} diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_peering_policies_operations.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_peering_policies_operations.py new file mode 100644 index 000000000000..6e236412367c --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_network_peering_policies_operations.py @@ -0,0 +1,392 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedNetworkPeeringPoliciesOperations(object): + """ManagedNetworkPeeringPoliciesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_network_name, managed_network_peering_policy_name, custom_headers=None, raw=False, **operation_config): + """The Get ManagedNetworkPeeringPolicies operation gets a Managed Network + Peering Policy resource, specified by the resource group, Managed + Network name, and peering policy name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_peering_policy_name: The name of the Managed + Network Peering Policy. + :type managed_network_peering_policy_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: ManagedNetworkPeeringPolicy or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ManagedNetworkPeeringPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkPeeringPolicyName': self._serialize.url("managed_network_peering_policy_name", managed_network_peering_policy_name, '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('ManagedNetworkPeeringPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_network_name, managed_network_peering_policy_name, location=None, properties=None, custom_headers=None, raw=False, **operation_config): + managed_network_policy = models.ManagedNetworkPeeringPolicy(location=location, properties=properties) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkPeeringPolicyName': self._serialize.url("managed_network_peering_policy_name", managed_network_peering_policy_name, '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(managed_network_policy, 'ManagedNetworkPeeringPolicy') + + # 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('ManagedNetworkPeeringPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedNetworkPeeringPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_network_name, managed_network_peering_policy_name, location=None, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """The Put ManagedNetworkPeeringPolicies operation creates/updates a new + Managed Network Peering Policy. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_peering_policy_name: The name of the Managed + Network Peering Policy. + :type managed_network_peering_policy_name: str + :param location: The geo-location where the resource lives + :type location: str + :param properties: Gets or sets the properties of a Managed Network + Policy + :type properties: + ~managednetwork.models.ManagedNetworkPeeringPolicyProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ManagedNetworkPeeringPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~managednetwork.models.ManagedNetworkPeeringPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~managednetwork.models.ManagedNetworkPeeringPolicy]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + managed_network_peering_policy_name=managed_network_peering_policy_name, + location=location, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedNetworkPeeringPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}'} + + + def _delete_initial( + self, resource_group_name, managed_network_name, managed_network_peering_policy_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str'), + 'managedNetworkPeeringPolicyName': self._serialize.url("managed_network_peering_policy_name", managed_network_peering_policy_name, '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, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, managed_network_name, managed_network_peering_policy_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The Delete ManagedNetworkPeeringPolicies operation deletes a Managed + Network Peering Policy, specified by the resource group, Managed + Network name, and peering policy name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param managed_network_peering_policy_name: The name of the Managed + Network Peering Policy. + :type managed_network_peering_policy_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + managed_network_peering_policy_name=managed_network_peering_policy_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}'} + + def list_by_managed_network( + self, resource_group_name, managed_network_name, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """The ListByManagedNetwork PeeringPolicies operation retrieves all the + Managed Network Peering Policies in a specified Managed Network, in a + paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param top: May be used to limit the number of results in a page for + list queries. + :type top: int + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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 ManagedNetworkPeeringPolicy + :rtype: + ~managednetwork.models.ManagedNetworkPeeringPolicyPaged[~managednetwork.models.ManagedNetworkPeeringPolicy] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_managed_network.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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.ManagedNetworkPeeringPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_managed_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies'} diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_networks_operations.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_networks_operations.py new file mode 100644 index 000000000000..40c945e91507 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_managed_networks_operations.py @@ -0,0 +1,514 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedNetworksOperations(object): + """ManagedNetworksOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_network_name, custom_headers=None, raw=False, **operation_config): + """The Get ManagedNetworks operation gets a Managed Network Resource, + specified by the resource group and Managed Network name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_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: ManagedNetwork or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ManagedNetwork or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, '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('ManagedNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}'} + + def create_or_update( + self, managed_network, resource_group_name, managed_network_name, custom_headers=None, raw=False, **operation_config): + """The Put ManagedNetworks operation creates/updates a Managed Network + Resource, specified by resource group and Managed Network name. + + :param managed_network: Parameters supplied to the create/update a + Managed Network Resource + :type managed_network: ~managednetwork.models.ManagedNetwork + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_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: ManagedNetwork or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ManagedNetwork or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, '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(managed_network, 'ManagedNetwork') + + # 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('ManagedNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedNetwork', 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.ManagedNetwork/managedNetworks/{managedNetworkName}'} + + + def _delete_initial( + self, resource_group_name, managed_network_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, '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, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, managed_network_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The Delete ManagedNetworks operation deletes a Managed Network + Resource, specified by the resource group and Managed Network name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}'} + + + def _update_initial( + self, resource_group_name, managed_network_name, tags=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ManagedNetworkUpdate(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedNetworkName': self._serialize.url("managed_network_name", managed_network_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedNetworkUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedNetwork', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, managed_network_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates the specified Managed Network resource tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param managed_network_name: The name of the Managed Network. + :type managed_network_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ManagedNetwork or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~managednetwork.models.ManagedNetwork] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~managednetwork.models.ManagedNetwork]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + managed_network_name=managed_network_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedNetwork', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}'} + + def list_by_resource_group( + self, resource_group_name, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """The ListByResourceGroup ManagedNetwork operation retrieves all the + Managed Network resources in a resource group in a paginated format. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param top: May be used to limit the number of results in a page for + list queries. + :type top: int + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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 ManagedNetwork + :rtype: + ~managednetwork.models.ManagedNetworkPaged[~managednetwork.models.ManagedNetwork] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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.ManagedNetworkPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks'} + + def list_by_subscription( + self, top=None, skiptoken=None, custom_headers=None, raw=False, **operation_config): + """The ListBySubscription ManagedNetwork operation retrieves all the + Managed Network Resources in the current subscription in a paginated + format. + + :param top: May be used to limit the number of results in a page for + list queries. + :type top: int + :param skiptoken: Skiptoken is only used if a previous operation + returned a partial result. If a previous response contains a nextLink + element, the value of the nextLink element will include a skiptoken + parameter that specifies a starting point to use for subsequent calls. + :type skiptoken: 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 ManagedNetwork + :rtype: + ~managednetwork.models.ManagedNetworkPaged[~managednetwork.models.ManagedNetwork] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.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') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', maximum=20, minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, '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.ManagedNetworkPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks'} diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_operations.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_operations.py new file mode 100644 index 000000000000..f1fe63c18ddb --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available MNC operations. + + :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 Operation + :rtype: + ~managednetwork.models.OperationPaged[~managednetwork.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # 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.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ManagedNetwork/operations'} diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_scope_assignments_operations.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_scope_assignments_operations.py new file mode 100644 index 000000000000..02601c1a704a --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/operations/_scope_assignments_operations.py @@ -0,0 +1,298 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# 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 msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ScopeAssignmentsOperations(object): + """ScopeAssignmentsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def get( + self, scope, scope_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the specified scope assignment. + + :param scope: The base resource of the scope assignment. + :type scope: str + :param scope_assignment_name: The name of the scope assignment to get. + :type scope_assignment_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: ScopeAssignment or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ScopeAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'scopeAssignmentName': self._serialize.url("scope_assignment_name", scope_assignment_name, '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('ScopeAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}'} + + def create_or_update( + self, scope, scope_assignment_name, location=None, assigned_managed_network=None, custom_headers=None, raw=False, **operation_config): + """Creates a scope assignment. + + :param scope: The base resource of the scope assignment to create. The + scope can be any REST resource instance. For example, use + '/subscriptions/{subscription-id}/' for a subscription, + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + for a resource group, and + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + for a resource. + :type scope: str + :param scope_assignment_name: The name of the scope assignment to + create. + :type scope_assignment_name: str + :param location: The geo-location where the resource lives + :type location: str + :param assigned_managed_network: The managed network ID with scope + will be assigned to. + :type assigned_managed_network: 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: ScopeAssignment or ClientRawResponse if raw=true + :rtype: ~managednetwork.models.ScopeAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.ScopeAssignment(location=location, assigned_managed_network=assigned_managed_network) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'scopeAssignmentName': self._serialize.url("scope_assignment_name", scope_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ScopeAssignment') + + # 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('ScopeAssignment', response) + if response.status_code == 201: + deserialized = self._deserialize('ScopeAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}'} + + def delete( + self, scope, scope_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a scope assignment. + + :param scope: The scope of the scope assignment to delete. + :type scope: str + :param scope_assignment_name: The name of the scope assignment to + delete. + :type scope_assignment_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:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'scopeAssignmentName': self._serialize.url("scope_assignment_name", scope_assignment_name, '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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}'} + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """Get the specified scope assignment. + + :param scope: The base resource of the scope assignment. + :type scope: 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 ScopeAssignment + :rtype: + ~managednetwork.models.ScopeAssignmentPaged[~managednetwork.models.ScopeAssignment] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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.ScopeAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments'} diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/version.py b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/version.py new file mode 100644 index 000000000000..15a0084e7417 --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2019-06-01-preview" + diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/sdk_packaging.toml b/sdk/managednetwork/azure-mgmt-managednetwork/sdk_packaging.toml new file mode 100644 index 000000000000..9c3bcd22443e --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-managednetwork" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/setup.cfg b/sdk/managednetwork/azure-mgmt-managednetwork/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/managednetwork/azure-mgmt-managednetwork/setup.py b/sdk/managednetwork/azure-mgmt-managednetwork/setup.py new file mode 100644 index 000000000000..119653a56abe --- /dev/null +++ b/sdk/managednetwork/azure-mgmt-managednetwork/setup.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-managednetwork" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +)