diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/__init__.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/__init__.py index 395333b4333e..92bedf358291 100644 --- a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/__init__.py +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .managed_services_client import ManagedServicesClient -from .version import VERSION +from ._configuration import ManagedServicesClientConfiguration +from ._managed_services_client import ManagedServicesClient +__all__ = ['ManagedServicesClient', 'ManagedServicesClientConfiguration'] -__all__ = ['ManagedServicesClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_configuration.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_configuration.py new file mode 100644 index 000000000000..308e6a180e30 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_configuration.py @@ -0,0 +1,43 @@ +# 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 ManagedServicesClientConfiguration(AzureConfiguration): + """Configuration for ManagedServicesClient + 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 str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ManagedServicesClientConfiguration, 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-managedservices/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_managed_services_client.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_managed_services_client.py new file mode 100644 index 000000000000..6036de1c58c3 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_managed_services_client.py @@ -0,0 +1,62 @@ +# 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 ManagedServicesClientConfiguration +from .operations import RegistrationDefinitionsOperations +from .operations import RegistrationAssignmentsOperations +from .operations import MarketplaceRegistrationDefinitionsOperations +from .operations import Operations +from . import models + + +class ManagedServicesClient(SDKClient): + """Specification for ManagedServices. + + :ivar config: Configuration for client. + :vartype config: ManagedServicesClientConfiguration + + :ivar registration_definitions: RegistrationDefinitions operations + :vartype registration_definitions: azure.mgmt.managedservices.operations.RegistrationDefinitionsOperations + :ivar registration_assignments: RegistrationAssignments operations + :vartype registration_assignments: azure.mgmt.managedservices.operations.RegistrationAssignmentsOperations + :ivar marketplace_registration_definitions: MarketplaceRegistrationDefinitions operations + :vartype marketplace_registration_definitions: azure.mgmt.managedservices.operations.MarketplaceRegistrationDefinitionsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.managedservices.operations.Operations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = ManagedServicesClientConfiguration(credentials, base_url) + super(ManagedServicesClient, 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 = '2020-02-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.registration_definitions = RegistrationDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.registration_assignments = RegistrationAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.marketplace_registration_definitions = MarketplaceRegistrationDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/__init__.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/__init__.py index e5f57b0313ff..2085f4014d85 100644 --- a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/__init__.py +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/__init__.py @@ -10,54 +10,70 @@ # -------------------------------------------------------------------------- try: - from .authorization_py3 import Authorization - from .registration_definition_properties_py3 import RegistrationDefinitionProperties - from .plan_py3 import Plan - from .registration_definition_py3 import RegistrationDefinition - from .registration_assignment_properties_registration_definition_properties_py3 import RegistrationAssignmentPropertiesRegistrationDefinitionProperties - from .registration_assignment_properties_registration_definition_py3 import RegistrationAssignmentPropertiesRegistrationDefinition - from .registration_assignment_properties_py3 import RegistrationAssignmentProperties - from .registration_assignment_py3 import RegistrationAssignment - from .operation_display_py3 import OperationDisplay - from .operation_py3 import Operation - from .operation_list_py3 import OperationList - from .error_response_error_py3 import ErrorResponseError - from .error_response_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import Authorization + from ._models_py3 import EligibleAuthorization + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import JustInTimeAccessPolicy + from ._models_py3 import MarketplaceRegistrationDefinition + from ._models_py3 import MarketplaceRegistrationDefinitionProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import Plan + from ._models_py3 import RegistrationAssignment + from ._models_py3 import RegistrationAssignmentProperties + from ._models_py3 import RegistrationAssignmentPropertiesRegistrationDefinition + from ._models_py3 import RegistrationAssignmentPropertiesRegistrationDefinitionProperties + from ._models_py3 import RegistrationDefinition + from ._models_py3 import RegistrationDefinitionProperties except (SyntaxError, ImportError): - from .authorization import Authorization - from .registration_definition_properties import RegistrationDefinitionProperties - from .plan import Plan - from .registration_definition import RegistrationDefinition - from .registration_assignment_properties_registration_definition_properties import RegistrationAssignmentPropertiesRegistrationDefinitionProperties - from .registration_assignment_properties_registration_definition import RegistrationAssignmentPropertiesRegistrationDefinition - from .registration_assignment_properties import RegistrationAssignmentProperties - from .registration_assignment import RegistrationAssignment - from .operation_display import OperationDisplay - from .operation import Operation - from .operation_list import OperationList - from .error_response_error import ErrorResponseError - from .error_response import ErrorResponse, ErrorResponseException -from .registration_definition_paged import RegistrationDefinitionPaged -from .registration_assignment_paged import RegistrationAssignmentPaged -from .managed_services_client_enums import ( + from ._models import Authorization + from ._models import EligibleAuthorization + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException + from ._models import JustInTimeAccessPolicy + from ._models import MarketplaceRegistrationDefinition + from ._models import MarketplaceRegistrationDefinitionProperties + from ._models import Operation + from ._models import OperationDisplay + from ._models import OperationList + from ._models import Plan + from ._models import RegistrationAssignment + from ._models import RegistrationAssignmentProperties + from ._models import RegistrationAssignmentPropertiesRegistrationDefinition + from ._models import RegistrationAssignmentPropertiesRegistrationDefinitionProperties + from ._models import RegistrationDefinition + from ._models import RegistrationDefinitionProperties +from ._paged_models import MarketplaceRegistrationDefinitionPaged +from ._paged_models import RegistrationAssignmentPaged +from ._paged_models import RegistrationDefinitionPaged +from ._managed_services_client_enums import ( + MultiFactorAuthProvider, ProvisioningState, ) __all__ = [ 'Authorization', - 'RegistrationDefinitionProperties', - 'Plan', - 'RegistrationDefinition', - 'RegistrationAssignmentPropertiesRegistrationDefinitionProperties', - 'RegistrationAssignmentPropertiesRegistrationDefinition', - 'RegistrationAssignmentProperties', - 'RegistrationAssignment', - 'OperationDisplay', + 'EligibleAuthorization', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', + 'JustInTimeAccessPolicy', + 'MarketplaceRegistrationDefinition', + 'MarketplaceRegistrationDefinitionProperties', 'Operation', + 'OperationDisplay', 'OperationList', - 'ErrorResponseError', - 'ErrorResponse', 'ErrorResponseException', + 'Plan', + 'RegistrationAssignment', + 'RegistrationAssignmentProperties', + 'RegistrationAssignmentPropertiesRegistrationDefinition', + 'RegistrationAssignmentPropertiesRegistrationDefinitionProperties', + 'RegistrationDefinition', + 'RegistrationDefinitionProperties', 'RegistrationDefinitionPaged', 'RegistrationAssignmentPaged', + 'MarketplaceRegistrationDefinitionPaged', + 'MultiFactorAuthProvider', 'ProvisioningState', ] diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_managed_services_client_enums.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_managed_services_client_enums.py new file mode 100644 index 000000000000..f90d45a217ca --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_managed_services_client_enums.py @@ -0,0 +1,34 @@ +# 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 MultiFactorAuthProvider(str, Enum): + + azure = "Azure" + none = "None" + + +class ProvisioningState(str, Enum): + + not_specified = "NotSpecified" + accepted = "Accepted" + running = "Running" + ready = "Ready" + creating = "Creating" + created = "Created" + deleting = "Deleting" + deleted = "Deleted" + canceled = "Canceled" + failed = "Failed" + succeeded = "Succeeded" + updating = "Updating" diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models.py new file mode 100644 index 000000000000..7813555bd626 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models.py @@ -0,0 +1,692 @@ +# 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 Authorization(Model): + """Authorization tuple containing principal Id (of user/service + principal/security group) and role definition id. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. Principal Id of the security group/service + principal/user that would be assigned permissions to the projected + subscription + :type principal_id: str + :param principal_id_display_name: Display name of the principal Id. + :type principal_id_display_name: str + :param role_definition_id: Required. The role definition identifier. This + role will define all the permissions that the security group/service + principal/user must have on the projected subscription. This role cannot + be an owner role. + :type role_definition_id: str + :param delegated_role_definition_ids: The delegatedRoleDefinitionIds field + is required when the roleDefinitionId refers to the User Access + Administrator Role. It is the list of role definition ids which define all + the permissions that the user in the authorization can assign to other + security groups/service principals/users. + :type delegated_role_definition_ids: list[str] + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_id_display_name': {'key': 'principalIdDisplayName', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'delegated_role_definition_ids': {'key': 'delegatedRoleDefinitionIds', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Authorization, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.principal_id_display_name = kwargs.get('principal_id_display_name', None) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.delegated_role_definition_ids = kwargs.get('delegated_role_definition_ids', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EligibleAuthorization(Model): + """Eligible authorization tuple containing principle Id (of user/service + principal/security group), role definition id, and the just-in-time access + setting. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. Principal Id of the security group/service + principal/user that would be delegated permissions to the projected + subscription + :type principal_id: str + :param principal_id_display_name: Display name of the principal Id. + :type principal_id_display_name: str + :param role_definition_id: Required. The role definition identifier. This + role will delegate all the permissions that the security group/service + principal/user must have on the projected subscription. This role cannot + be an owner role. + :type role_definition_id: str + :param just_in_time_access_policy: Just-in-time access policy setting. + :type just_in_time_access_policy: + ~azure.mgmt.managedservices.models.JustInTimeAccessPolicy + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_id_display_name': {'key': 'principalIdDisplayName', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'just_in_time_access_policy': {'key': 'justInTimeAccessPolicy', 'type': 'JustInTimeAccessPolicy'}, + } + + def __init__(self, **kwargs): + super(EligibleAuthorization, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.principal_id_display_name = kwargs.get('principal_id_display_name', None) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.just_in_time_access_policy = kwargs.get('just_in_time_access_policy', None) + + +class ErrorDefinition(Model): + """Error response indicates Azure Resource Manager is not able to process the + incoming request. The reason is provided in the error message. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. + :type code: str + :param message: Required. Error message indicating why the operation + failed. + :type message: str + :param details: Internal error details. + :type details: list[~azure.mgmt.managedservices.models.ErrorDefinition] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.managedservices.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', 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 JustInTimeAccessPolicy(Model): + """Just-in-time access policy setting. + + All required parameters must be populated in order to send to Azure. + + :param multi_factor_auth_provider: Required. MFA provider. Possible values + include: 'Azure', 'None' + :type multi_factor_auth_provider: str or + ~azure.mgmt.managedservices.models.MultiFactorAuthProvider + :param maximum_activation_duration: Maximum access duration in ISO 8601 + format. The default value is "PT8H". + :type maximum_activation_duration: timedelta + """ + + _validation = { + 'multi_factor_auth_provider': {'required': True}, + } + + _attribute_map = { + 'multi_factor_auth_provider': {'key': 'multiFactorAuthProvider', 'type': 'str'}, + 'maximum_activation_duration': {'key': 'maximumActivationDuration', 'type': 'duration'}, + } + + def __init__(self, **kwargs): + super(JustInTimeAccessPolicy, self).__init__(**kwargs) + self.multi_factor_auth_provider = kwargs.get('multi_factor_auth_provider', None) + self.maximum_activation_duration = kwargs.get('maximum_activation_duration', None) + + +class MarketplaceRegistrationDefinition(Model): + """MarketplaceRegistrationDefinition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a marketplace registration definition. + :type properties: + ~azure.mgmt.managedservices.models.MarketplaceRegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the marketplace registration definition. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the marketplace registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MarketplaceRegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MarketplaceRegistrationDefinition, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.plan = kwargs.get('plan', None) + self.id = None + self.type = None + self.name = None + + +class MarketplaceRegistrationDefinitionProperties(Model): + """Properties of a marketplace registration definition. + + All required parameters must be populated in order to send to Azure. + + :param managed_by_tenant_id: Required. Id of the managedBy tenant. + :type managed_by_tenant_id: str + :param authorizations: Required. Authorization tuple containing principal + id of the user/security group or service principal and id of the build-in + role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param offer_display_name: The marketplace offer display name. + :type offer_display_name: str + :param publisher_display_name: The marketplace publisher display name. + :type publisher_display_name: str + :param plan_display_name: The marketplace plan display name. + :type plan_display_name: str + """ + + _validation = { + 'managed_by_tenant_id': {'required': True}, + 'authorizations': {'required': True}, + } + + _attribute_map = { + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'offer_display_name': {'key': 'offerDisplayName', 'type': 'str'}, + 'publisher_display_name': {'key': 'publisherDisplayName', 'type': 'str'}, + 'plan_display_name': {'key': 'planDisplayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MarketplaceRegistrationDefinitionProperties, self).__init__(**kwargs) + self.managed_by_tenant_id = kwargs.get('managed_by_tenant_id', None) + self.authorizations = kwargs.get('authorizations', None) + self.eligible_authorizations = kwargs.get('eligible_authorizations', None) + self.offer_display_name = kwargs.get('offer_display_name', None) + self.publisher_display_name = kwargs.get('publisher_display_name', None) + self.plan_display_name = kwargs.get('plan_display_name', None) + + +class Operation(Model): + """Object that describes a single Microsoft.ManagedServices operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation} + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.managedservices.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ManagedServices + :type provider: str + :param resource: Resource on which the operation is performed: + Registration definition, registration assignment etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', '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) + self.description = kwargs.get('description', None) + + +class OperationList(Model): + """List of the operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of Microsoft.ManagedServices operations. + :vartype value: list[~azure.mgmt.managedservices.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__(self, **kwargs): + super(OperationList, self).__init__(**kwargs) + self.value = None + + +class Plan(Model): + """Plan details for the managed services. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The plan name. + :type name: str + :param publisher: Required. The publisher ID. + :type publisher: str + :param product: Required. The product code. + :type product: str + :param version: Required. The plan's version. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + 'version': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.version = kwargs.get('version', None) + + +class RegistrationAssignment(Model): + """Registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a registration assignment. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationAssignmentProperties + :ivar id: The fully qualified path of the registration assignment. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the registration assignment. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationAssignmentProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegistrationAssignment, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.type = None + self.name = None + + +class RegistrationAssignmentProperties(Model): + """Properties of a registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param registration_definition_id: Required. Fully qualified path of the + registration definition. + :type registration_definition_id: str + :ivar provisioning_state: Current state of the registration assignment. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :ivar registration_definition: Registration definition inside registration + assignment. + :vartype registration_definition: + ~azure.mgmt.managedservices.models.RegistrationAssignmentPropertiesRegistrationDefinition + """ + + _validation = { + 'registration_definition_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'registration_definition': {'readonly': True}, + } + + _attribute_map = { + 'registration_definition_id': {'key': 'registrationDefinitionId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'registration_definition': {'key': 'registrationDefinition', 'type': 'RegistrationAssignmentPropertiesRegistrationDefinition'}, + } + + def __init__(self, **kwargs): + super(RegistrationAssignmentProperties, self).__init__(**kwargs) + self.registration_definition_id = kwargs.get('registration_definition_id', None) + self.provisioning_state = None + self.registration_definition = None + + +class RegistrationAssignmentPropertiesRegistrationDefinition(Model): + """Registration definition inside registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of registration definition inside + registration assignment. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationAssignmentPropertiesRegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the registration definition. + :vartype id: str + :ivar type: Type of the resource + (Microsoft.ManagedServices/registrationDefinitions). + :vartype type: str + :ivar name: Name of the registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationAssignmentPropertiesRegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegistrationAssignmentPropertiesRegistrationDefinition, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.plan = kwargs.get('plan', None) + self.id = None + self.type = None + self.name = None + + +class RegistrationAssignmentPropertiesRegistrationDefinitionProperties(Model): + """Properties of registration definition inside registration assignment. + + :param description: Description of the registration definition. + :type description: str + :param authorizations: Authorization tuple containing principal id of the + user/security group or service principal and id of the build-in role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param registration_definition_name: Name of the registration definition. + :type registration_definition_name: str + :param provisioning_state: Current state of the registration definition. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :type provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :param managee_tenant_id: Id of the home tenant. + :type managee_tenant_id: str + :param managee_tenant_name: Name of the home tenant. + :type managee_tenant_name: str + :param managed_by_tenant_id: Id of the managedBy tenant. + :type managed_by_tenant_id: str + :param managed_by_tenant_name: Name of the managedBy tenant. + :type managed_by_tenant_name: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'registration_definition_name': {'key': 'registrationDefinitionName', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'managee_tenant_id': {'key': 'manageeTenantId', 'type': 'str'}, + 'managee_tenant_name': {'key': 'manageeTenantName', 'type': 'str'}, + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'managed_by_tenant_name': {'key': 'managedByTenantName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegistrationAssignmentPropertiesRegistrationDefinitionProperties, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.authorizations = kwargs.get('authorizations', None) + self.eligible_authorizations = kwargs.get('eligible_authorizations', None) + self.registration_definition_name = kwargs.get('registration_definition_name', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.managee_tenant_id = kwargs.get('managee_tenant_id', None) + self.managee_tenant_name = kwargs.get('managee_tenant_name', None) + self.managed_by_tenant_id = kwargs.get('managed_by_tenant_id', None) + self.managed_by_tenant_name = kwargs.get('managed_by_tenant_name', None) + + +class RegistrationDefinition(Model): + """Registration definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a registration definition. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the registration definition. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegistrationDefinition, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.plan = kwargs.get('plan', None) + self.id = None + self.type = None + self.name = None + + +class RegistrationDefinitionProperties(Model): + """Properties of a registration definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the registration definition. + :type description: str + :param authorizations: Required. Authorization tuple containing principal + id of the user/security group or service principal and id of the build-in + role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param registration_definition_name: Name of the registration definition. + :type registration_definition_name: str + :param managed_by_tenant_id: Required. Id of the managedBy tenant. + :type managed_by_tenant_id: str + :ivar provisioning_state: Current state of the registration definition. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :ivar managed_by_tenant_name: Name of the managedBy tenant. + :vartype managed_by_tenant_name: str + """ + + _validation = { + 'authorizations': {'required': True}, + 'managed_by_tenant_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'managed_by_tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'registration_definition_name': {'key': 'registrationDefinitionName', 'type': 'str'}, + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'managed_by_tenant_name': {'key': 'managedByTenantName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegistrationDefinitionProperties, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.authorizations = kwargs.get('authorizations', None) + self.eligible_authorizations = kwargs.get('eligible_authorizations', None) + self.registration_definition_name = kwargs.get('registration_definition_name', None) + self.managed_by_tenant_id = kwargs.get('managed_by_tenant_id', None) + self.provisioning_state = None + self.managed_by_tenant_name = None diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models_py3.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models_py3.py new file mode 100644 index 000000000000..a2d1da0ad705 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_models_py3.py @@ -0,0 +1,692 @@ +# 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 Authorization(Model): + """Authorization tuple containing principal Id (of user/service + principal/security group) and role definition id. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. Principal Id of the security group/service + principal/user that would be assigned permissions to the projected + subscription + :type principal_id: str + :param principal_id_display_name: Display name of the principal Id. + :type principal_id_display_name: str + :param role_definition_id: Required. The role definition identifier. This + role will define all the permissions that the security group/service + principal/user must have on the projected subscription. This role cannot + be an owner role. + :type role_definition_id: str + :param delegated_role_definition_ids: The delegatedRoleDefinitionIds field + is required when the roleDefinitionId refers to the User Access + Administrator Role. It is the list of role definition ids which define all + the permissions that the user in the authorization can assign to other + security groups/service principals/users. + :type delegated_role_definition_ids: list[str] + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_id_display_name': {'key': 'principalIdDisplayName', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'delegated_role_definition_ids': {'key': 'delegatedRoleDefinitionIds', 'type': '[str]'}, + } + + def __init__(self, *, principal_id: str, role_definition_id: str, principal_id_display_name: str=None, delegated_role_definition_ids=None, **kwargs) -> None: + super(Authorization, self).__init__(**kwargs) + self.principal_id = principal_id + self.principal_id_display_name = principal_id_display_name + self.role_definition_id = role_definition_id + self.delegated_role_definition_ids = delegated_role_definition_ids + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class EligibleAuthorization(Model): + """Eligible authorization tuple containing principle Id (of user/service + principal/security group), role definition id, and the just-in-time access + setting. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. Principal Id of the security group/service + principal/user that would be delegated permissions to the projected + subscription + :type principal_id: str + :param principal_id_display_name: Display name of the principal Id. + :type principal_id_display_name: str + :param role_definition_id: Required. The role definition identifier. This + role will delegate all the permissions that the security group/service + principal/user must have on the projected subscription. This role cannot + be an owner role. + :type role_definition_id: str + :param just_in_time_access_policy: Just-in-time access policy setting. + :type just_in_time_access_policy: + ~azure.mgmt.managedservices.models.JustInTimeAccessPolicy + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_id_display_name': {'key': 'principalIdDisplayName', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'just_in_time_access_policy': {'key': 'justInTimeAccessPolicy', 'type': 'JustInTimeAccessPolicy'}, + } + + def __init__(self, *, principal_id: str, role_definition_id: str, principal_id_display_name: str=None, just_in_time_access_policy=None, **kwargs) -> None: + super(EligibleAuthorization, self).__init__(**kwargs) + self.principal_id = principal_id + self.principal_id_display_name = principal_id_display_name + self.role_definition_id = role_definition_id + self.just_in_time_access_policy = just_in_time_access_policy + + +class ErrorDefinition(Model): + """Error response indicates Azure Resource Manager is not able to process the + incoming request. The reason is provided in the error message. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Error code. + :type code: str + :param message: Required. Error message indicating why the operation + failed. + :type message: str + :param details: Internal error details. + :type details: list[~azure.mgmt.managedservices.models.ErrorDefinition] + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDefinition]'}, + } + + def __init__(self, *, code: str, message: str, details=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: ~azure.mgmt.managedservices.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +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 JustInTimeAccessPolicy(Model): + """Just-in-time access policy setting. + + All required parameters must be populated in order to send to Azure. + + :param multi_factor_auth_provider: Required. MFA provider. Possible values + include: 'Azure', 'None' + :type multi_factor_auth_provider: str or + ~azure.mgmt.managedservices.models.MultiFactorAuthProvider + :param maximum_activation_duration: Maximum access duration in ISO 8601 + format. The default value is "PT8H". + :type maximum_activation_duration: timedelta + """ + + _validation = { + 'multi_factor_auth_provider': {'required': True}, + } + + _attribute_map = { + 'multi_factor_auth_provider': {'key': 'multiFactorAuthProvider', 'type': 'str'}, + 'maximum_activation_duration': {'key': 'maximumActivationDuration', 'type': 'duration'}, + } + + def __init__(self, *, multi_factor_auth_provider, maximum_activation_duration=None, **kwargs) -> None: + super(JustInTimeAccessPolicy, self).__init__(**kwargs) + self.multi_factor_auth_provider = multi_factor_auth_provider + self.maximum_activation_duration = maximum_activation_duration + + +class MarketplaceRegistrationDefinition(Model): + """MarketplaceRegistrationDefinition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a marketplace registration definition. + :type properties: + ~azure.mgmt.managedservices.models.MarketplaceRegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the marketplace registration definition. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the marketplace registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'MarketplaceRegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, properties=None, plan=None, **kwargs) -> None: + super(MarketplaceRegistrationDefinition, self).__init__(**kwargs) + self.properties = properties + self.plan = plan + self.id = None + self.type = None + self.name = None + + +class MarketplaceRegistrationDefinitionProperties(Model): + """Properties of a marketplace registration definition. + + All required parameters must be populated in order to send to Azure. + + :param managed_by_tenant_id: Required. Id of the managedBy tenant. + :type managed_by_tenant_id: str + :param authorizations: Required. Authorization tuple containing principal + id of the user/security group or service principal and id of the build-in + role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param offer_display_name: The marketplace offer display name. + :type offer_display_name: str + :param publisher_display_name: The marketplace publisher display name. + :type publisher_display_name: str + :param plan_display_name: The marketplace plan display name. + :type plan_display_name: str + """ + + _validation = { + 'managed_by_tenant_id': {'required': True}, + 'authorizations': {'required': True}, + } + + _attribute_map = { + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'offer_display_name': {'key': 'offerDisplayName', 'type': 'str'}, + 'publisher_display_name': {'key': 'publisherDisplayName', 'type': 'str'}, + 'plan_display_name': {'key': 'planDisplayName', 'type': 'str'}, + } + + def __init__(self, *, managed_by_tenant_id: str, authorizations, eligible_authorizations=None, offer_display_name: str=None, publisher_display_name: str=None, plan_display_name: str=None, **kwargs) -> None: + super(MarketplaceRegistrationDefinitionProperties, self).__init__(**kwargs) + self.managed_by_tenant_id = managed_by_tenant_id + self.authorizations = authorizations + self.eligible_authorizations = eligible_authorizations + self.offer_display_name = offer_display_name + self.publisher_display_name = publisher_display_name + self.plan_display_name = plan_display_name + + +class Operation(Model): + """Object that describes a single Microsoft.ManagedServices operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation} + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.managedservices.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + 'display': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = None + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.ManagedServices + :type provider: str + :param resource: Resource on which the operation is performed: + Registration definition, registration assignment etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(Model): + """List of the operations. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of Microsoft.ManagedServices operations. + :vartype value: list[~azure.mgmt.managedservices.models.Operation] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationList, self).__init__(**kwargs) + self.value = None + + +class Plan(Model): + """Plan details for the managed services. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The plan name. + :type name: str + :param publisher: Required. The publisher ID. + :type publisher: str + :param product: Required. The product code. + :type product: str + :param version: Required. The plan's version. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + 'version': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, *, name: str, publisher: str, product: str, version: str, **kwargs) -> None: + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.version = version + + +class RegistrationAssignment(Model): + """Registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a registration assignment. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationAssignmentProperties + :ivar id: The fully qualified path of the registration assignment. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the registration assignment. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationAssignmentProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(RegistrationAssignment, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.type = None + self.name = None + + +class RegistrationAssignmentProperties(Model): + """Properties of a registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param registration_definition_id: Required. Fully qualified path of the + registration definition. + :type registration_definition_id: str + :ivar provisioning_state: Current state of the registration assignment. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :ivar registration_definition: Registration definition inside registration + assignment. + :vartype registration_definition: + ~azure.mgmt.managedservices.models.RegistrationAssignmentPropertiesRegistrationDefinition + """ + + _validation = { + 'registration_definition_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'registration_definition': {'readonly': True}, + } + + _attribute_map = { + 'registration_definition_id': {'key': 'registrationDefinitionId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'registration_definition': {'key': 'registrationDefinition', 'type': 'RegistrationAssignmentPropertiesRegistrationDefinition'}, + } + + def __init__(self, *, registration_definition_id: str, **kwargs) -> None: + super(RegistrationAssignmentProperties, self).__init__(**kwargs) + self.registration_definition_id = registration_definition_id + self.provisioning_state = None + self.registration_definition = None + + +class RegistrationAssignmentPropertiesRegistrationDefinition(Model): + """Registration definition inside registration assignment. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of registration definition inside + registration assignment. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationAssignmentPropertiesRegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the registration definition. + :vartype id: str + :ivar type: Type of the resource + (Microsoft.ManagedServices/registrationDefinitions). + :vartype type: str + :ivar name: Name of the registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationAssignmentPropertiesRegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, properties=None, plan=None, **kwargs) -> None: + super(RegistrationAssignmentPropertiesRegistrationDefinition, self).__init__(**kwargs) + self.properties = properties + self.plan = plan + self.id = None + self.type = None + self.name = None + + +class RegistrationAssignmentPropertiesRegistrationDefinitionProperties(Model): + """Properties of registration definition inside registration assignment. + + :param description: Description of the registration definition. + :type description: str + :param authorizations: Authorization tuple containing principal id of the + user/security group or service principal and id of the build-in role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param registration_definition_name: Name of the registration definition. + :type registration_definition_name: str + :param provisioning_state: Current state of the registration definition. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :type provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :param managee_tenant_id: Id of the home tenant. + :type managee_tenant_id: str + :param managee_tenant_name: Name of the home tenant. + :type managee_tenant_name: str + :param managed_by_tenant_id: Id of the managedBy tenant. + :type managed_by_tenant_id: str + :param managed_by_tenant_name: Name of the managedBy tenant. + :type managed_by_tenant_name: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'registration_definition_name': {'key': 'registrationDefinitionName', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'managee_tenant_id': {'key': 'manageeTenantId', 'type': 'str'}, + 'managee_tenant_name': {'key': 'manageeTenantName', 'type': 'str'}, + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'managed_by_tenant_name': {'key': 'managedByTenantName', 'type': 'str'}, + } + + def __init__(self, *, description: str=None, authorizations=None, eligible_authorizations=None, registration_definition_name: str=None, provisioning_state=None, managee_tenant_id: str=None, managee_tenant_name: str=None, managed_by_tenant_id: str=None, managed_by_tenant_name: str=None, **kwargs) -> None: + super(RegistrationAssignmentPropertiesRegistrationDefinitionProperties, self).__init__(**kwargs) + self.description = description + self.authorizations = authorizations + self.eligible_authorizations = eligible_authorizations + self.registration_definition_name = registration_definition_name + self.provisioning_state = provisioning_state + self.managee_tenant_id = managee_tenant_id + self.managee_tenant_name = managee_tenant_name + self.managed_by_tenant_id = managed_by_tenant_id + self.managed_by_tenant_name = managed_by_tenant_name + + +class RegistrationDefinition(Model): + """Registration definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param properties: Properties of a registration definition. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :ivar id: Fully qualified path of the registration definition. + :vartype id: str + :ivar type: Type of the resource. + :vartype type: str + :ivar name: Name of the registration definition. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RegistrationDefinitionProperties'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, properties=None, plan=None, **kwargs) -> None: + super(RegistrationDefinition, self).__init__(**kwargs) + self.properties = properties + self.plan = plan + self.id = None + self.type = None + self.name = None + + +class RegistrationDefinitionProperties(Model): + """Properties of a registration definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: Description of the registration definition. + :type description: str + :param authorizations: Required. Authorization tuple containing principal + id of the user/security group or service principal and id of the build-in + role. + :type authorizations: + list[~azure.mgmt.managedservices.models.Authorization] + :param eligible_authorizations: Eligible PIM authorization tuple + containing principal id of the user/security group or service principal, + id of the built-in role, and just-in-time access policy setting + :type eligible_authorizations: + list[~azure.mgmt.managedservices.models.EligibleAuthorization] + :param registration_definition_name: Name of the registration definition. + :type registration_definition_name: str + :param managed_by_tenant_id: Required. Id of the managedBy tenant. + :type managed_by_tenant_id: str + :ivar provisioning_state: Current state of the registration definition. + Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', + 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', + 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.managedservices.models.ProvisioningState + :ivar managed_by_tenant_name: Name of the managedBy tenant. + :vartype managed_by_tenant_name: str + """ + + _validation = { + 'authorizations': {'required': True}, + 'managed_by_tenant_id': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'managed_by_tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'authorizations': {'key': 'authorizations', 'type': '[Authorization]'}, + 'eligible_authorizations': {'key': 'eligibleAuthorizations', 'type': '[EligibleAuthorization]'}, + 'registration_definition_name': {'key': 'registrationDefinitionName', 'type': 'str'}, + 'managed_by_tenant_id': {'key': 'managedByTenantId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'managed_by_tenant_name': {'key': 'managedByTenantName', 'type': 'str'}, + } + + def __init__(self, *, authorizations, managed_by_tenant_id: str, description: str=None, eligible_authorizations=None, registration_definition_name: str=None, **kwargs) -> None: + super(RegistrationDefinitionProperties, self).__init__(**kwargs) + self.description = description + self.authorizations = authorizations + self.eligible_authorizations = eligible_authorizations + self.registration_definition_name = registration_definition_name + self.managed_by_tenant_id = managed_by_tenant_id + self.provisioning_state = None + self.managed_by_tenant_name = None diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_paged_models.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_paged_models.py new file mode 100644 index 000000000000..3722f441740a --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/models/_paged_models.py @@ -0,0 +1,53 @@ +# 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 RegistrationDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`RegistrationDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RegistrationDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(RegistrationDefinitionPaged, self).__init__(*args, **kwargs) +class RegistrationAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`RegistrationAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RegistrationAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(RegistrationAssignmentPaged, self).__init__(*args, **kwargs) +class MarketplaceRegistrationDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`MarketplaceRegistrationDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MarketplaceRegistrationDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(MarketplaceRegistrationDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/__init__.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/__init__.py index f51ba517d417..3b2b2e67052b 100644 --- a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/__init__.py +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/__init__.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from .registration_definitions_operations import RegistrationDefinitionsOperations -from .registration_assignments_operations import RegistrationAssignmentsOperations -from .operations import Operations +from ._registration_definitions_operations import RegistrationDefinitionsOperations +from ._registration_assignments_operations import RegistrationAssignmentsOperations +from ._marketplace_registration_definitions_operations import MarketplaceRegistrationDefinitionsOperations +from ._operations import Operations __all__ = [ 'RegistrationDefinitionsOperations', 'RegistrationAssignmentsOperations', + 'MarketplaceRegistrationDefinitionsOperations', 'Operations', ] diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_marketplace_registration_definitions_operations.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_marketplace_registration_definitions_operations.py new file mode 100644 index 000000000000..f319f63b7549 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_marketplace_registration_definitions_operations.py @@ -0,0 +1,179 @@ +# 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 MarketplaceRegistrationDefinitionsOperations(object): + """MarketplaceRegistrationDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-02-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-02-01-preview" + + self.config = config + + def list( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets a list of the marketplace registration definitions for the + marketplace identifier. + + :param scope: Scope of the resource. + :type scope: str + :param filter: The filter query parameter. Might be used to filter + marketplace registration definition by plan identifier, publisher, + version etc. + :type filter: 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 + MarketplaceRegistrationDefinition + :rtype: + ~azure.mgmt.managedservices.models.MarketplaceRegistrationDefinitionPaged[~azure.mgmt.managedservices.models.MarketplaceRegistrationDefinition] + :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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.MarketplaceRegistrationDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions'} + + def get( + self, scope, marketplace_identifier, custom_headers=None, raw=False, **operation_config): + """Get the marketplace registration definition for the marketplace + identifier. + + :param scope: Scope of the resource. + :type scope: str + :param marketplace_identifier: Market place identifer. Expected + Formats - {publisher}.{product[-preview]}.{planName}.{version} or + {publisher}.{product[-preview]}.{planName} or + {publisher}.{product[-preview]} or {publisher}). + :type marketplace_identifier: 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: MarketplaceRegistrationDefinition or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.managedservices.models.MarketplaceRegistrationDefinition + 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), + 'marketplaceIdentifier': self._serialize.url("marketplace_identifier", marketplace_identifier, '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('MarketplaceRegistrationDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}'} diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_operations.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_operations.py new file mode 100644 index 000000000000..ba8f564284a3 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_operations.py @@ -0,0 +1,89 @@ +# 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: The API version to use for this operation. Constant value: "2020-02-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-02-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of the 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: OperationList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managedservices.models.OperationList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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') + + # 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('OperationList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ManagedServices/operations'} diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_assignments_operations.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_assignments_operations.py new file mode 100644 index 000000000000..6a4a1a7843d2 --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_assignments_operations.py @@ -0,0 +1,362 @@ +# 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 RegistrationAssignmentsOperations(object): + """RegistrationAssignmentsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-02-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-02-01-preview" + + self.config = config + + def get( + self, scope, registration_assignment_id, expand_registration_definition=None, custom_headers=None, raw=False, **operation_config): + """Gets the details of specified registration assignment. + + :param scope: Scope of the resource. + :type scope: str + :param registration_assignment_id: Guid of the registration + assignment. + :type registration_assignment_id: str + :param expand_registration_definition: Tells whether to return + registration definition details also along with registration + assignment details. + :type expand_registration_definition: bool + :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: RegistrationAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managedservices.models.RegistrationAssignment 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), + 'registrationAssignmentId': self._serialize.url("registration_assignment_id", registration_assignment_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand_registration_definition is not None: + query_parameters['$expandRegistrationDefinition'] = self._serialize.query("expand_registration_definition", expand_registration_definition, 'bool') + 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('RegistrationAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}'} + + + def _delete_initial( + self, scope, registration_assignment_id, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'registrationAssignmentId': self._serialize.url("registration_assignment_id", registration_assignment_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, scope, registration_assignment_id, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the specified registration assignment. + + :param scope: Scope of the resource. + :type scope: str + :param registration_assignment_id: Guid of the registration + assignment. + :type registration_assignment_id: 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( + scope=scope, + registration_assignment_id=registration_assignment_id, + 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': '/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}'} + + + def _create_or_update_initial( + self, scope, registration_assignment_id, properties=None, custom_headers=None, raw=False, **operation_config): + request_body = models.RegistrationAssignment(properties=properties) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'registrationAssignmentId': self._serialize.url("registration_assignment_id", registration_assignment_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(request_body, 'RegistrationAssignment') + + # 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('RegistrationAssignment', response) + if response.status_code == 201: + deserialized = self._deserialize('RegistrationAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, scope, registration_assignment_id, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a registration assignment. + + :param scope: Scope of the resource. + :type scope: str + :param registration_assignment_id: Guid of the registration + assignment. + :type registration_assignment_id: str + :param properties: Properties of a registration assignment. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationAssignmentProperties + :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 RegistrationAssignment + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.managedservices.models.RegistrationAssignment] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.managedservices.models.RegistrationAssignment]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + scope=scope, + registration_assignment_id=registration_assignment_id, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('RegistrationAssignment', 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': '/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}'} + + def list( + self, scope, expand_registration_definition=None, custom_headers=None, raw=False, **operation_config): + """Gets a list of the registration assignments. + + :param scope: Scope of the resource. + :type scope: str + :param expand_registration_definition: Tells whether to return + registration definition details also along with registration + assignment details. + :type expand_registration_definition: bool + :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 RegistrationAssignment + :rtype: + ~azure.mgmt.managedservices.models.RegistrationAssignmentPaged[~azure.mgmt.managedservices.models.RegistrationAssignment] + :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 = {} + if expand_registration_definition is not None: + query_parameters['$expandRegistrationDefinition'] = self._serialize.query("expand_registration_definition", expand_registration_definition, 'bool') + 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.RegistrationAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/registrationAssignments'} diff --git a/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_definitions_operations.py b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_definitions_operations.py new file mode 100644 index 000000000000..a0e82a126a9c --- /dev/null +++ b/sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/operations/_registration_definitions_operations.py @@ -0,0 +1,327 @@ +# 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 RegistrationDefinitionsOperations(object): + """RegistrationDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-02-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-02-01-preview" + + self.config = config + + def get( + self, scope, registration_definition_id, custom_headers=None, raw=False, **operation_config): + """Gets the registration definition details. + + :param scope: Scope of the resource. + :type scope: str + :param registration_definition_id: Guid of the registration + definition. + :type registration_definition_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RegistrationDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managedservices.models.RegistrationDefinition 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), + 'registrationDefinitionId': self._serialize.url("registration_definition_id", registration_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RegistrationDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}'} + + def delete( + self, registration_definition_id, scope, custom_headers=None, raw=False, **operation_config): + """Deletes the registration definition. + + :param registration_definition_id: Guid of the registration + definition. + :type registration_definition_id: str + :param scope: Scope of the resource. + :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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'registrationDefinitionId': self._serialize.url("registration_definition_id", registration_definition_id, 'str'), + '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 = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}'} + + + def _create_or_update_initial( + self, registration_definition_id, scope, properties=None, plan=None, custom_headers=None, raw=False, **operation_config): + request_body = models.RegistrationDefinition(properties=properties, plan=plan) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'registrationDefinitionId': self._serialize.url("registration_definition_id", registration_definition_id, 'str'), + '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' + 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(request_body, 'RegistrationDefinition') + + # 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('RegistrationDefinition', response) + if response.status_code == 201: + deserialized = self._deserialize('RegistrationDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, registration_definition_id, scope, properties=None, plan=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a registration definition. + + :param registration_definition_id: Guid of the registration + definition. + :type registration_definition_id: str + :param scope: Scope of the resource. + :type scope: str + :param properties: Properties of a registration definition. + :type properties: + ~azure.mgmt.managedservices.models.RegistrationDefinitionProperties + :param plan: Plan details for the managed services. + :type plan: ~azure.mgmt.managedservices.models.Plan + :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 RegistrationDefinition + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.managedservices.models.RegistrationDefinition] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.managedservices.models.RegistrationDefinition]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + registration_definition_id=registration_definition_id, + scope=scope, + properties=properties, + plan=plan, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('RegistrationDefinition', 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': '/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}'} + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """Gets a list of the registration definitions. + + :param scope: Scope of the resource. + :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 RegistrationDefinition + :rtype: + ~azure.mgmt.managedservices.models.RegistrationDefinitionPaged[~azure.mgmt.managedservices.models.RegistrationDefinition] + :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.RegistrationDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions'}