diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/__init__.py index c3d2514a8885..1ce510596cc7 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/__init__.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .managed_service_identity_client import ManagedServiceIdentityClient -from .version import VERSION +from ._configuration import ManagedServiceIdentityClientConfiguration +from ._managed_service_identity_client import ManagedServiceIdentityClient +__all__ = ['ManagedServiceIdentityClient', 'ManagedServiceIdentityClientConfiguration'] -__all__ = ['ManagedServiceIdentityClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_configuration.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_configuration.py new file mode 100644 index 000000000000..3bf9b9ba0b70 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_configuration.py @@ -0,0 +1,49 @@ +# 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 ManagedServiceIdentityClientConfiguration(AzureConfiguration): + """Configuration for ManagedServiceIdentityClient + 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: The Id of the Subscription to which the identity + belongs. + :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(ManagedServiceIdentityClientConfiguration, 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-msi/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/managed_service_identity_client.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_managed_service_identity_client.py similarity index 60% rename from sdk/resources/azure-mgmt-msi/azure/mgmt/msi/managed_service_identity_client.py rename to sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_managed_service_identity_client.py index d128b05dac0d..d7e5d13a3234 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/managed_service_identity_client.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_managed_service_identity_client.py @@ -11,44 +11,12 @@ from msrest.service_client import SDKClient from msrest import Serializer, Deserializer -from msrestazure import AzureConfiguration -from .version import VERSION -from .operations.operations import Operations -from .operations.user_assigned_identities_operations import UserAssignedIdentitiesOperations -from . import models - - -class ManagedServiceIdentityClientConfiguration(AzureConfiguration): - """Configuration for ManagedServiceIdentityClient - 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: The Id of the Subscription to which the identity - belongs. - :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(ManagedServiceIdentityClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-mgmt-msi/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials - self.subscription_id = subscription_id +from ._configuration import ManagedServiceIdentityClientConfiguration +from .operations import SystemAssignedIdentitiesOperations +from .operations import Operations +from .operations import UserAssignedIdentitiesOperations +from . import models class ManagedServiceIdentityClient(SDKClient): @@ -57,6 +25,8 @@ class ManagedServiceIdentityClient(SDKClient): :ivar config: Configuration for client. :vartype config: ManagedServiceIdentityClientConfiguration + :ivar system_assigned_identities: SystemAssignedIdentities operations + :vartype system_assigned_identities: azure.mgmt.msi.operations.SystemAssignedIdentitiesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.msi.operations.Operations :ivar user_assigned_identities: UserAssignedIdentities operations @@ -82,6 +52,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.system_assigned_identities = SystemAssignedIdentitiesOperations( + self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.user_assigned_identities = UserAssignedIdentitiesOperations( diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/__init__.py index 1bf860b5697d..43c32c6dacc7 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/__init__.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/__init__.py @@ -10,23 +10,32 @@ # -------------------------------------------------------------------------- try: - from .identity_py3 import Identity - from .operation_display_py3 import OperationDisplay - from .operation_py3 import Operation + from ._models_py3 import Identity + from ._models_py3 import IdentityPatch + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import Resource + from ._models_py3 import SystemAssignedIdentity except (SyntaxError, ImportError): - from .identity import Identity - from .operation_display import OperationDisplay - from .operation import Operation -from .operation_paged import OperationPaged -from .identity_paged import IdentityPaged -from .managed_service_identity_client_enums import ( + from ._models import Identity + from ._models import IdentityPatch + from ._models import Operation + from ._models import OperationDisplay + from ._models import Resource + from ._models import SystemAssignedIdentity +from ._paged_models import IdentityPaged +from ._paged_models import OperationPaged +from ._managed_service_identity_client_enums import ( UserAssignedIdentities, ) __all__ = [ 'Identity', - 'OperationDisplay', + 'IdentityPatch', 'Operation', + 'OperationDisplay', + 'Resource', + 'SystemAssignedIdentity', 'OperationPaged', 'IdentityPaged', 'UserAssignedIdentities', diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/managed_service_identity_client_enums.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_managed_service_identity_client_enums.py similarity index 100% rename from sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/managed_service_identity_client_enums.py rename to sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_managed_service_identity_client_enums.py diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models.py new file mode 100644 index 000000000000..1f5d0d264393 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models.py @@ -0,0 +1,332 @@ +# 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): + """An error response from the ManagedServiceIdentity service. + + :param error: A list of additional details about the error. + :type error: ~azure.mgmt.msi.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the ManagedServiceIdentity service. + + :param code: An identifier for the error. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.msi.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, **kwargs): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class Resource(Model): + """Describes common properties of a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.location = kwargs.get('location', None) + + +class Identity(Resource): + """Describes an identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar type: The type of resource i.e. + Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: + 'Microsoft.ManagedIdentity/userAssignedIdentities' + :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Identity, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.type = None + + +class IdentityPatch(Resource): + """Describes an identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar type: The type of resource i.e. + Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: + 'Microsoft.ManagedIdentity/userAssignedIdentities' + :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IdentityPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.type = None + + +class Operation(Model): + """Microsoft.ManagedIdentity Operation. + + Operation supported by the Microsoft.ManagedIdentity REST API. + + :param name: Operation Name. The name of the REST Operation. This is of + the format {provider}/{resource}/{operation}. + :type name: str + :param display: Operation Display. The object that describes the + operation. + :type display: ~azure.mgmt.msi.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): + """Operation Display. + + The object that describes the operation. + + :param provider: Resource Provider Name. Friendly name of the resource + provider. + :type provider: str + :param operation: Operation Type. The type of operation. For example: + read, write, delete. + :type operation: str + :param resource: Resource Type. The resource type on which the operation + is performed. + :type resource: str + :param description: Operation description. A description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.operation = kwargs.get('operation', None) + self.resource = kwargs.get('resource', None) + self.description = kwargs.get('description', None) + + +class SystemAssignedIdentity(Resource): + """Describes a system assigned identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that + can be queried to obtain the identity credentials. + :vartype client_secret_url: str + :ivar type: The type of resource i.e. + Microsoft.Compute/virtualMachineScaleSets + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'client_secret_url': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'client_secret_url': {'key': 'properties.clientSecretUrl', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SystemAssignedIdentity, self).__init__(**kwargs) + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.client_secret_url = None + self.type = None diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models_py3.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models_py3.py new file mode 100644 index 000000000000..9011b8d240da --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_models_py3.py @@ -0,0 +1,332 @@ +# 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): + """An error response from the ManagedServiceIdentity service. + + :param error: A list of additional details about the error. + :type error: ~azure.mgmt.msi.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the ManagedServiceIdentity service. + + :param code: An identifier for the error. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.msi.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class Resource(Model): + """Describes common properties of a resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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.location = location + + +class Identity(Resource): + """Describes an identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar type: The type of resource i.e. + Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: + 'Microsoft.ManagedIdentity/userAssignedIdentities' + :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(Identity, self).__init__(location=location, **kwargs) + self.tags = tags + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.type = None + + +class IdentityPatch(Resource): + """Describes an identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar type: The type of resource i.e. + Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: + 'Microsoft.ManagedIdentity/userAssignedIdentities' + :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(IdentityPatch, self).__init__(location=location, **kwargs) + self.tags = tags + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.type = None + + +class Operation(Model): + """Microsoft.ManagedIdentity Operation. + + Operation supported by the Microsoft.ManagedIdentity REST API. + + :param name: Operation Name. The name of the REST Operation. This is of + the format {provider}/{resource}/{operation}. + :type name: str + :param display: Operation Display. The object that describes the + operation. + :type display: ~azure.mgmt.msi.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): + """Operation Display. + + The object that describes the operation. + + :param provider: Resource Provider Name. Friendly name of the resource + provider. + :type provider: str + :param operation: Operation Type. The type of operation. For example: + read, write, delete. + :type operation: str + :param resource: Resource Type. The resource type on which the operation + is performed. + :type resource: str + :param description: Operation description. A description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, operation: str=None, resource: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.operation = operation + self.resource = resource + self.description = description + + +class SystemAssignedIdentity(Resource): + """Describes a system assigned identity resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :param location: The Azure region where the resource lives. + :type location: str + :ivar tenant_id: The id of the tenant which the identity belongs to. + :vartype tenant_id: str + :ivar principal_id: The id of the service principal object associated with + the created identity. + :vartype principal_id: str + :ivar client_id: The id of the app associated with the identity. This is a + random generated UUID by MSI. + :vartype client_id: str + :ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that + can be queried to obtain the identity credentials. + :vartype client_secret_url: str + :ivar type: The type of resource i.e. + Microsoft.Compute/virtualMachineScaleSets + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + 'client_secret_url': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'client_id': {'key': 'properties.clientId', 'type': 'str'}, + 'client_secret_url': {'key': 'properties.clientSecretUrl', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, **kwargs) -> None: + super(SystemAssignedIdentity, self).__init__(location=location, **kwargs) + self.tenant_id = None + self.principal_id = None + self.client_id = None + self.client_secret_url = None + self.type = None diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_paged.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_paged_models.py similarity index 69% rename from sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_paged.py rename to sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_paged_models.py index 120a2229ce5f..055c3e96e3c8 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_paged.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/_paged_models.py @@ -25,3 +25,16 @@ class OperationPaged(Paged): def __init__(self, *args, **kwargs): super(OperationPaged, self).__init__(*args, **kwargs) +class IdentityPaged(Paged): + """ + A paging container for iterating over a list of :class:`Identity ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Identity]'} + } + + def __init__(self, *args, **kwargs): + + super(IdentityPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity.py deleted file mode 100644 index d3e39d6d9bab..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Identity(Model): - """Describes an identity resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The id of the created identity. - :vartype id: str - :ivar name: The name of the created identity. - :vartype name: str - :param location: The Azure region where the identity lives. - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar tenant_id: The id of the tenant which the identity belongs to. - :vartype tenant_id: str - :ivar principal_id: The id of the service principal object associated with - the created identity. - :vartype principal_id: str - :ivar client_id: The id of the app associated with the identity. This is a - random generated UUID by MSI. - :vartype client_id: str - :ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that - can be queried to obtain the identity credentials. If identity is user - assigned, then the clientSecretUrl will not be present in the response, - otherwise it will be present. - :vartype client_secret_url: str - :ivar type: The type of resource i.e. - Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: - 'Microsoft.ManagedIdentity/userAssignedIdentities' - :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - 'client_secret_url': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'client_id': {'key': 'properties.clientId', 'type': 'str'}, - 'client_secret_url': {'key': 'properties.clientSecretUrl', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Identity, self).__init__(**kwargs) - self.id = None - self.name = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.tenant_id = None - self.principal_id = None - self.client_id = None - self.client_secret_url = None - self.type = None diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_paged.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_paged.py deleted file mode 100644 index 98a4dfac9d0b..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class IdentityPaged(Paged): - """ - A paging container for iterating over a list of :class:`Identity ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Identity]'} - } - - def __init__(self, *args, **kwargs): - - super(IdentityPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_py3.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_py3.py deleted file mode 100644 index a24c023ab4d7..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/identity_py3.py +++ /dev/null @@ -1,80 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Identity(Model): - """Describes an identity resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The id of the created identity. - :vartype id: str - :ivar name: The name of the created identity. - :vartype name: str - :param location: The Azure region where the identity lives. - :type location: str - :param tags: Resource tags - :type tags: dict[str, str] - :ivar tenant_id: The id of the tenant which the identity belongs to. - :vartype tenant_id: str - :ivar principal_id: The id of the service principal object associated with - the created identity. - :vartype principal_id: str - :ivar client_id: The id of the app associated with the identity. This is a - random generated UUID by MSI. - :vartype client_id: str - :ivar client_secret_url: The ManagedServiceIdentity DataPlane URL that - can be queried to obtain the identity credentials. If identity is user - assigned, then the clientSecretUrl will not be present in the response, - otherwise it will be present. - :vartype client_secret_url: str - :ivar type: The type of resource i.e. - Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: - 'Microsoft.ManagedIdentity/userAssignedIdentities' - :vartype type: str or ~azure.mgmt.msi.models.UserAssignedIdentities - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - 'client_secret_url': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'client_id': {'key': 'properties.clientId', 'type': 'str'}, - 'client_secret_url': {'key': 'properties.clientSecretUrl', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: - super(Identity, self).__init__(**kwargs) - self.id = None - self.name = None - self.location = location - self.tags = tags - self.tenant_id = None - self.principal_id = None - self.client_id = None - self.client_secret_url = None - self.type = None diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation.py deleted file mode 100644 index 3123b2729c32..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Microsoft.ManagedIdentity Operation. - - Operation supported by the Microsoft.ManagedIdentity REST API. - - :param name: Operation Name. The name of the REST Operation. This is of - the format {provider}/{resource}/{operation}. - :type name: str - :param display: Operation Display. The object that describes the - operation. - :type display: ~azure.mgmt.msi.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) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display.py deleted file mode 100644 index 9129b1f8145d..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """Operation Display. - - The object that describes the operation. - - :param provider: Resource Provider Name. Friendly name of the resource - provider. - :type provider: str - :param operation: Operation Type. The type of operation. For example: - read, write, delete. - :type operation: str - :param resource: Resource Type. The resource type on which the operation - is performed. - :type resource: str - :param description: Operation description. A description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - self.resource = kwargs.get('resource', None) - self.description = kwargs.get('description', None) diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display_py3.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display_py3.py deleted file mode 100644 index c0ce73c19513..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_display_py3.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationDisplay(Model): - """Operation Display. - - The object that describes the operation. - - :param provider: Resource Provider Name. Friendly name of the resource - provider. - :type provider: str - :param operation: Operation Type. The type of operation. For example: - read, write, delete. - :type operation: str - :param resource: Resource Type. The resource type on which the operation - is performed. - :type resource: str - :param description: Operation description. A description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__(self, *, provider: str=None, operation: str=None, resource: str=None, description: str=None, **kwargs) -> None: - super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.operation = operation - self.resource = resource - self.description = description diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_py3.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_py3.py deleted file mode 100644 index f4aff37fc086..000000000000 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/models/operation_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Microsoft.ManagedIdentity Operation. - - Operation supported by the Microsoft.ManagedIdentity REST API. - - :param name: Operation Name. The name of the REST Operation. This is of - the format {provider}/{resource}/{operation}. - :type name: str - :param display: Operation Display. The object that describes the - operation. - :type display: ~azure.mgmt.msi.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 diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/__init__.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/__init__.py index 8539791da775..acb5f6ac2481 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/__init__.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/__init__.py @@ -9,10 +9,12 @@ # regenerated. # -------------------------------------------------------------------------- -from .operations import Operations -from .user_assigned_identities_operations import UserAssignedIdentitiesOperations +from ._system_assigned_identities_operations import SystemAssignedIdentitiesOperations +from ._operations import Operations +from ._user_assigned_identities_operations import UserAssignedIdentitiesOperations __all__ = [ + 'SystemAssignedIdentitiesOperations', 'Operations', 'UserAssignedIdentitiesOperations', ] diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_operations.py similarity index 90% rename from sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/operations.py rename to sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_operations.py index 495de7a8d83d..37470bc12bc9 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_operations.py @@ -19,6 +19,8 @@ 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. @@ -51,8 +53,7 @@ def list( ~azure.mgmt.msi.models.OperationPaged[~azure.mgmt.msi.models.Operation] :raises: :class:`CloudError` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] @@ -77,6 +78,11 @@ def internal_paging(next_link=None, raw=False): # 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]: @@ -87,12 +93,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/providers/Microsoft.ManagedIdentity/operations'} diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_system_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_system_assigned_identities_operations.py new file mode 100644 index 000000000000..24f2adb6ede4 --- /dev/null +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_system_assigned_identities_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class SystemAssignedIdentitiesOperations(object): + """SystemAssignedIdentitiesOperations 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: Version of API to invoke. Constant value: "2018-11-30". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-11-30" + + self.config = config + + def get_by_scope( + self, scope, custom_headers=None, raw=False, **operation_config): + """Gets the systemAssignedIdentity available under the specified RP scope. + + :param scope: The resource provider scope of the resource. Parent + resource being extended by Managed Identities. + :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: SystemAssignedIdentity or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.msi.models.SystemAssignedIdentity or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_scope.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') + + # 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]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SystemAssignedIdentity', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.ManagedIdentity/identities/default'} diff --git a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/user_assigned_identities_operations.py b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_user_assigned_identities_operations.py similarity index 95% rename from sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/user_assigned_identities_operations.py rename to sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_user_assigned_identities_operations.py index 944d8cabf793..b965c63e1907 100644 --- a/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/user_assigned_identities_operations.py +++ b/sdk/resources/azure-mgmt-msi/azure/mgmt/msi/operations/_user_assigned_identities_operations.py @@ -19,6 +19,8 @@ class UserAssignedIdentitiesOperations(object): """UserAssignedIdentitiesOperations 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. @@ -52,8 +54,7 @@ def list_by_subscription( ~azure.mgmt.msi.models.IdentityPaged[~azure.mgmt.msi.models.Identity] :raises: :class:`CloudError` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] @@ -82,6 +83,11 @@ def internal_paging(next_link=None, raw=False): # 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]: @@ -92,12 +98,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.IdentityPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.IdentityPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.IdentityPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} @@ -120,8 +124,7 @@ def list_by_resource_group( ~azure.mgmt.msi.models.IdentityPaged[~azure.mgmt.msi.models.Identity] :raises: :class:`CloudError` """ - def internal_paging(next_link=None, raw=False): - + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] @@ -151,6 +154,11 @@ def internal_paging(next_link=None, raw=False): # 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]: @@ -161,12 +169,10 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.IdentityPaged(internal_paging, self._deserialize.dependencies) - + header_dict = None if raw: header_dict = {} - client_raw_response = models.IdentityPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + deserialized = models.IdentityPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities'} @@ -181,7 +187,7 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the identity resource. :type resource_name: str - :param location: The Azure region where the identity lives. + :param location: The Azure region where the resource lives. :type location: str :param tags: Resource tags :type tags: dict[str, str] @@ -234,7 +240,6 @@ def create_or_update( raise exp deserialized = None - if response.status_code == 200: deserialized = self._deserialize('Identity', response) if response.status_code == 201: @@ -256,7 +261,7 @@ def update( :type resource_group_name: str :param resource_name: The name of the identity resource. :type resource_name: str - :param location: The Azure region where the identity lives. + :param location: The Azure region where the resource lives. :type location: str :param tags: Resource tags :type tags: dict[str, str] @@ -270,7 +275,7 @@ def update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - parameters = models.Identity(location=location, tags=tags) + parameters = models.IdentityPatch(location=location, tags=tags) # Construct URL url = self.update.metadata['url'] @@ -297,7 +302,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'Identity') + body_content = self._serialize.body(parameters, 'IdentityPatch') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) @@ -309,7 +314,6 @@ def update( raise exp deserialized = None - if response.status_code == 200: deserialized = self._deserialize('Identity', response) @@ -372,7 +376,6 @@ def get( raise exp deserialized = None - if response.status_code == 200: deserialized = self._deserialize('Identity', response)