diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/__init__.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/__init__.py index 1c163d514465..7d52f13aa196 100644 --- a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/__init__.py +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .management_groups_api import ManagementGroupsAPI -from .version import VERSION +from ._configuration import ManagementGroupsAPIConfiguration +from ._management_groups_api import ManagementGroupsAPI +__all__ = ['ManagementGroupsAPI', 'ManagementGroupsAPIConfiguration'] -__all__ = ['ManagementGroupsAPI'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_configuration.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_configuration.py new file mode 100644 index 000000000000..680f6c78b0e1 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_configuration.py @@ -0,0 +1,64 @@ +# 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 ManagementGroupsAPIConfiguration(AzureConfiguration): + """Configuration for ManagementGroupsAPI + 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 operation_result_id: The id of the operation result. Possible + values include: 'create', 'delete' + :type operation_result_id: str + :param skip: Number of entities to skip over when retrieving results. + Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing + this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous + operation returned a partial result. + If a previous response contains a nextLink element, the value of the + nextLink element will include a token parameter that specifies a starting + point to use for subsequent calls. + :type skiptoken: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, operation_result_id, skip=None, top=None, skiptoken=None, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if operation_result_id is None: + raise ValueError("Parameter 'operation_result_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ManagementGroupsAPIConfiguration, 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-managementgroups/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.operation_result_id = operation_result_id + self.skip = skip + self.top = top + self.skiptoken = skiptoken diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_management_groups_api.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_management_groups_api.py new file mode 100644 index 000000000000..fd365c5908c2 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/_management_groups_api.py @@ -0,0 +1,85 @@ +# 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 ManagementGroupsAPIConfiguration +from .operations import ManagementGroupsAPIOperationsMixin +from .operations import ManagementGroupsOperations +from .operations import ManagementGroupSubscriptionsOperations +from .operations import HierarchySettingsOperations +from .operations import Operations +from .operations import EntitiesOperations +from . import models + + +class ManagementGroupsAPI(ManagementGroupsAPIOperationsMixin, SDKClient): + """The Azure Management Groups API enables consolidation of multiple + subscriptions/resources into an organizational hierarchy and centrally + manage access control, policies, alerting and reporting for those resources. + + :ivar config: Configuration for client. + :vartype config: ManagementGroupsAPIConfiguration + + :ivar management_groups: ManagementGroups operations + :vartype management_groups: azure.mgmt.managementgroups.operations.ManagementGroupsOperations + :ivar management_group_subscriptions: ManagementGroupSubscriptions operations + :vartype management_group_subscriptions: azure.mgmt.managementgroups.operations.ManagementGroupSubscriptionsOperations + :ivar hierarchy_settings: HierarchySettings operations + :vartype hierarchy_settings: azure.mgmt.managementgroups.operations.HierarchySettingsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.managementgroups.operations.Operations + :ivar entities: Entities operations + :vartype entities: azure.mgmt.managementgroups.operations.EntitiesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param operation_result_id: The id of the operation result. Possible + values include: 'create', 'delete' + :type operation_result_id: str + :param skip: Number of entities to skip over when retrieving results. + Passing this in will override $skipToken. + :type skip: int + :param top: Number of elements to return when retrieving results. Passing + this in will override $skipToken. + :type top: int + :param skiptoken: Page continuation token is only used if a previous + operation returned a partial result. + If a previous response contains a nextLink element, the value of the + nextLink element will include a token parameter that specifies a starting + point to use for subsequent calls. + :type skiptoken: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, operation_result_id, skip=None, top=None, skiptoken=None, base_url=None): + + self.config = ManagementGroupsAPIConfiguration(credentials, operation_result_id, skip, top, skiptoken, base_url) + super(ManagementGroupsAPI, 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-05-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.management_groups = ManagementGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.management_group_subscriptions = ManagementGroupSubscriptionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.hierarchy_settings = HierarchySettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.entities = EntitiesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/__init__.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/__init__.py index 72c19c0a5a09..2d5402d781f1 100644 --- a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/__init__.py +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/__init__.py @@ -10,81 +10,112 @@ # -------------------------------------------------------------------------- try: - from .error_details_py3 import ErrorDetails - from .error_response_py3 import ErrorResponse, ErrorResponseException - from .operation_display_properties_py3 import OperationDisplayProperties - from .operation_py3 import Operation - from .check_name_availability_result_py3 import CheckNameAvailabilityResult - from .tenant_backfill_status_result_py3 import TenantBackfillStatusResult - from .management_group_info_py3 import ManagementGroupInfo - from .parent_group_info_py3 import ParentGroupInfo - from .management_group_details_py3 import ManagementGroupDetails - from .management_group_child_info_py3 import ManagementGroupChildInfo - from .management_group_py3 import ManagementGroup - from .operation_results_py3 import OperationResults - from .entity_parent_group_info_py3 import EntityParentGroupInfo - from .entity_info_py3 import EntityInfo - from .entity_hierarchy_item_py3 import EntityHierarchyItem - from .patch_management_group_request_py3 import PatchManagementGroupRequest - from .create_parent_group_info_py3 import CreateParentGroupInfo - from .create_management_group_details_py3 import CreateManagementGroupDetails - from .create_management_group_child_info_py3 import CreateManagementGroupChildInfo - from .create_management_group_request_py3 import CreateManagementGroupRequest - from .check_name_availability_request_py3 import CheckNameAvailabilityRequest + from ._models_py3 import AzureAsyncOperationResults + from ._models_py3 import CheckNameAvailabilityRequest + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CreateManagementGroupChildInfo + from ._models_py3 import CreateManagementGroupDetails + from ._models_py3 import CreateManagementGroupRequest + from ._models_py3 import CreateOrUpdateSettingsRequest + from ._models_py3 import CreateParentGroupInfo + from ._models_py3 import DescendantInfo + from ._models_py3 import DescendantParentGroupInfo + from ._models_py3 import EntityHierarchyItem + from ._models_py3 import EntityInfo + from ._models_py3 import EntityParentGroupInfo + from ._models_py3 import ErrorDetails + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import HierarchySettings + from ._models_py3 import HierarchySettingsInfo + from ._models_py3 import HierarchySettingsList + from ._models_py3 import ManagementGroup + from ._models_py3 import ManagementGroupChildInfo + from ._models_py3 import ManagementGroupDetails + from ._models_py3 import ManagementGroupInfo + from ._models_py3 import ManagementGroupPathElement + from ._models_py3 import Operation + from ._models_py3 import OperationDisplayProperties + from ._models_py3 import OperationResults + from ._models_py3 import ParentGroupInfo + from ._models_py3 import PatchManagementGroupRequest + from ._models_py3 import SubscriptionUnderManagementGroup + from ._models_py3 import TenantBackfillStatusResult except (SyntaxError, ImportError): - from .error_details import ErrorDetails - from .error_response import ErrorResponse, ErrorResponseException - from .operation_display_properties import OperationDisplayProperties - from .operation import Operation - from .check_name_availability_result import CheckNameAvailabilityResult - from .tenant_backfill_status_result import TenantBackfillStatusResult - from .management_group_info import ManagementGroupInfo - from .parent_group_info import ParentGroupInfo - from .management_group_details import ManagementGroupDetails - from .management_group_child_info import ManagementGroupChildInfo - from .management_group import ManagementGroup - from .operation_results import OperationResults - from .entity_parent_group_info import EntityParentGroupInfo - from .entity_info import EntityInfo - from .entity_hierarchy_item import EntityHierarchyItem - from .patch_management_group_request import PatchManagementGroupRequest - from .create_parent_group_info import CreateParentGroupInfo - from .create_management_group_details import CreateManagementGroupDetails - from .create_management_group_child_info import CreateManagementGroupChildInfo - from .create_management_group_request import CreateManagementGroupRequest - from .check_name_availability_request import CheckNameAvailabilityRequest -from .management_group_info_paged import ManagementGroupInfoPaged -from .operation_paged import OperationPaged -from .entity_info_paged import EntityInfoPaged -from .management_groups_api_enums import ( + from ._models import AzureAsyncOperationResults + from ._models import CheckNameAvailabilityRequest + from ._models import CheckNameAvailabilityResult + from ._models import CreateManagementGroupChildInfo + from ._models import CreateManagementGroupDetails + from ._models import CreateManagementGroupRequest + from ._models import CreateOrUpdateSettingsRequest + from ._models import CreateParentGroupInfo + from ._models import DescendantInfo + from ._models import DescendantParentGroupInfo + from ._models import EntityHierarchyItem + from ._models import EntityInfo + from ._models import EntityParentGroupInfo + from ._models import ErrorDetails + from ._models import ErrorResponse, ErrorResponseException + from ._models import HierarchySettings + from ._models import HierarchySettingsInfo + from ._models import HierarchySettingsList + from ._models import ManagementGroup + from ._models import ManagementGroupChildInfo + from ._models import ManagementGroupDetails + from ._models import ManagementGroupInfo + from ._models import ManagementGroupPathElement + from ._models import Operation + from ._models import OperationDisplayProperties + from ._models import OperationResults + from ._models import ParentGroupInfo + from ._models import PatchManagementGroupRequest + from ._models import SubscriptionUnderManagementGroup + from ._models import TenantBackfillStatusResult +from ._paged_models import DescendantInfoPaged +from ._paged_models import EntityInfoPaged +from ._paged_models import ManagementGroupInfoPaged +from ._paged_models import OperationPaged +from ._paged_models import SubscriptionUnderManagementGroupPaged +from ._management_groups_api_enums import ( Reason, Status, Type, ) __all__ = [ + 'AzureAsyncOperationResults', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResult', + 'CreateManagementGroupChildInfo', + 'CreateManagementGroupDetails', + 'CreateManagementGroupRequest', + 'CreateOrUpdateSettingsRequest', + 'CreateParentGroupInfo', + 'DescendantInfo', + 'DescendantParentGroupInfo', + 'EntityHierarchyItem', + 'EntityInfo', + 'EntityParentGroupInfo', 'ErrorDetails', 'ErrorResponse', 'ErrorResponseException', - 'OperationDisplayProperties', - 'Operation', - 'CheckNameAvailabilityResult', - 'TenantBackfillStatusResult', - 'ManagementGroupInfo', - 'ParentGroupInfo', - 'ManagementGroupDetails', - 'ManagementGroupChildInfo', + 'HierarchySettings', + 'HierarchySettingsInfo', + 'HierarchySettingsList', 'ManagementGroup', + 'ManagementGroupChildInfo', + 'ManagementGroupDetails', + 'ManagementGroupInfo', + 'ManagementGroupPathElement', + 'Operation', + 'OperationDisplayProperties', 'OperationResults', - 'EntityParentGroupInfo', - 'EntityInfo', - 'EntityHierarchyItem', + 'ParentGroupInfo', 'PatchManagementGroupRequest', - 'CreateParentGroupInfo', - 'CreateManagementGroupDetails', - 'CreateManagementGroupChildInfo', - 'CreateManagementGroupRequest', - 'CheckNameAvailabilityRequest', + 'SubscriptionUnderManagementGroup', + 'TenantBackfillStatusResult', 'ManagementGroupInfoPaged', + 'DescendantInfoPaged', + 'SubscriptionUnderManagementGroupPaged', 'OperationPaged', 'EntityInfoPaged', 'Reason', diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_management_groups_api_enums.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_management_groups_api_enums.py new file mode 100644 index 000000000000..759d9633738f --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_management_groups_api_enums.py @@ -0,0 +1,33 @@ +# 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 Reason(str, Enum): + + invalid = "Invalid" + already_exists = "AlreadyExists" + + +class Status(str, Enum): + + not_started = "NotStarted" + not_started_but_groups_exist = "NotStartedButGroupsExist" + started = "Started" + failed = "Failed" + cancelled = "Cancelled" + completed = "Completed" + + +class Type(str, Enum): + + microsoft_managementmanagement_groups = "Microsoft.Management/managementGroups" diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models.py new file mode 100644 index 000000000000..5e67607bf43c --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models.py @@ -0,0 +1,1185 @@ +# 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 AzureAsyncOperationResults(Model): + """The results of Azure-AsyncOperation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :ivar status: The current status of the asynchronous operation performed . + For example, Running, Succeeded, Failed + :vartype status: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureAsyncOperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.status = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class CheckNameAvailabilityRequest(Model): + """Management group name availability check parameters. + + :param name: the name to check for availability + :type name: str + :param type: fully qualified resource type which includes provider + namespace. Possible values include: + 'Microsoft.Management/managementGroups' + :type type: str or ~azure.mgmt.managementgroups.models.Type + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'Type'}, + } + + def __init__(self, **kwargs): + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class CheckNameAvailabilityResult(Model): + """Describes the result of the request to check management group name + availability. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: Required. True indicates name is valid and + available. False indicates the name is invalid, unavailable, or both. + :vartype name_available: bool + :ivar reason: Required if nameAvailable == false. Invalid indicates the + name provided does not match the resource provider's naming requirements + (incorrect length, unsupported characters, etc.) AlreadyExists indicates + that the name is already in use and is therefore unavailable. Possible + values include: 'Invalid', 'AlreadyExists' + :vartype reason: str or ~azure.mgmt.managementgroups.models.Reason + :ivar message: Required if nameAvailable == false. Localized. If reason == + invalid, provide the user with the reason why the given name is invalid, + and provide the resource naming requirements so that the user can select a + valid name. If reason == AlreadyExists, explain that is already in use, + and direct them to select a different name. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'Reason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CreateManagementGroupChildInfo(Model): + """The child information of a management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The type of child resource. The fully qualified resource type + which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + 'Microsoft.Management/managementGroups', '/subscriptions' + :vartype type: str or ~azure.mgmt.managementgroups.models.enum + :ivar id: The fully qualified ID for the child resource (management group + or subscription). For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar name: The name of the child entity. + :vartype name: str + :ivar display_name: The friendly name of the child resource. + :vartype display_name: str + :ivar children: The list of children. + :vartype children: + list[~azure.mgmt.managementgroups.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__(self, **kwargs): + super(CreateManagementGroupChildInfo, self).__init__(**kwargs) + self.type = None + self.id = None + self.name = None + self.display_name = None + self.children = None + + +class CreateManagementGroupDetails(Model): + """The details of a management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar version: The version number of the object. + :vartype version: float + :ivar updated_time: The date and time when this object was last updated. + :vartype updated_time: datetime + :ivar updated_by: The identity of the principal or process that updated + the object. + :vartype updated_by: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.CreateParentGroupInfo + """ + + _validation = { + 'version': {'readonly': True}, + 'updated_time': {'readonly': True}, + 'updated_by': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'float'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'CreateParentGroupInfo'}, + } + + def __init__(self, **kwargs): + super(CreateManagementGroupDetails, self).__init__(**kwargs) + self.version = None + self.updated_time = None + self.updated_by = None + self.parent = kwargs.get('parent', None) + + +class CreateManagementGroupRequest(Model): + """Management group creation parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :type name: str + :ivar tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :vartype tenant_id: str + :param display_name: The friendly name of the management group. If no + value is passed then this field will be set to the groupId. + :type display_name: str + :param details: Details. + :type details: + ~azure.mgmt.managementgroups.models.CreateManagementGroupDetails + :ivar children: The list of children. + :vartype children: + list[~azure.mgmt.managementgroups.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'CreateManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__(self, **kwargs): + super(CreateManagementGroupRequest, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = kwargs.get('name', None) + self.tenant_id = None + self.display_name = kwargs.get('display_name', None) + self.details = kwargs.get('details', None) + self.children = None + + +class CreateOrUpdateSettingsRequest(Model): + """Parameters for creating or updating Management Group settings. + + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _attribute_map = { + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CreateOrUpdateSettingsRequest, self).__init__(**kwargs) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class CreateParentGroupInfo(Model): + """(Optional) The ID of the parent management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :ivar name: The name of the parent management group + :vartype name: str + :ivar display_name: The friendly name of the parent management group. + :vartype display_name: str + """ + + _validation = { + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CreateParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = None + self.display_name = None + + +class DescendantInfo(Model): + """The descendant. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the descendant. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + or /subscriptions/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups or /subscriptions + :vartype type: str + :ivar name: The name of the descendant. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: Parent. + :type parent: + ~azure.mgmt.managementgroups.models.DescendantParentGroupInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + } + + def __init__(self, **kwargs): + super(DescendantInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + + +class DescendantParentGroupInfo(Model): + """The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DescendantParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class EntityHierarchyItem(Model): + """The management group details for the hierarchy view. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param permissions: Permissions. Possible values include: 'noaccess', + 'view', 'edit', 'delete' + :type permissions: str or ~azure.mgmt.managementgroups.models.enum + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.EntityHierarchyItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[EntityHierarchyItem]'}, + } + + def __init__(self, **kwargs): + super(EntityHierarchyItem, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = kwargs.get('display_name', None) + self.permissions = kwargs.get('permissions', None) + self.children = kwargs.get('children', None) + + +class EntityInfo(Model): + """The entity. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the entity. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the entity. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the entity. For + example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.EntityParentGroupInfo + :param permissions: Permissions. Possible values include: 'noaccess', + 'view', 'edit', 'delete' + :type permissions: str or ~azure.mgmt.managementgroups.models.enum + :param inherited_permissions: Inherited Permissions. Possible values + include: 'noaccess', 'view', 'edit', 'delete' + :type inherited_permissions: str or + ~azure.mgmt.managementgroups.models.enum + :param number_of_descendants: Number of Descendants. + :type number_of_descendants: int + :param number_of_children: Number of Children. Number of children is the + number of Groups and Subscriptions that are exactly one level underneath + the current Group. + :type number_of_children: int + :param number_of_child_groups: Number of Child Groups. Number of children + is the number of Groups that are exactly one level underneath the current + Group. + :type number_of_child_groups: int + :param parent_display_name_chain: The parent display name chain from the + root group to the immediate parent + :type parent_display_name_chain: list[str] + :param parent_name_chain: The parent name chain from the root group to the + immediate parent + :type parent_name_chain: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'EntityParentGroupInfo'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'inherited_permissions': {'key': 'properties.inheritedPermissions', 'type': 'str'}, + 'number_of_descendants': {'key': 'properties.numberOfDescendants', 'type': 'int'}, + 'number_of_children': {'key': 'properties.numberOfChildren', 'type': 'int'}, + 'number_of_child_groups': {'key': 'properties.numberOfChildGroups', 'type': 'int'}, + 'parent_display_name_chain': {'key': 'properties.parentDisplayNameChain', 'type': '[str]'}, + 'parent_name_chain': {'key': 'properties.parentNameChain', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(EntityInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + self.permissions = kwargs.get('permissions', None) + self.inherited_permissions = kwargs.get('inherited_permissions', None) + self.number_of_descendants = kwargs.get('number_of_descendants', None) + self.number_of_children = kwargs.get('number_of_children', None) + self.number_of_child_groups = kwargs.get('number_of_child_groups', None) + self.parent_display_name_chain = kwargs.get('parent_display_name_chain', None) + self.parent_name_chain = kwargs.get('parent_name_chain', None) + + +class EntityParentGroupInfo(Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EntityParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class ErrorDetails(Model): + """The details of the error. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDetails, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class ErrorResponse(Model): + """The error object. + + :param error: Error. + :type error: ~azure.mgmt.managementgroups.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + 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 HierarchySettings(Model): + """Settings defined at the Management Group scope. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy + settings. For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HierarchySettings, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class HierarchySettingsInfo(Model): + """The hierarchy settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy + settings. For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HierarchySettingsInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.require_authorization_for_group_creation = kwargs.get('require_authorization_for_group_creation', None) + self.default_management_group = kwargs.get('default_management_group', None) + + +class HierarchySettingsList(Model): + """Lists all hierarchy settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param value: The list of hierarchy settings. + :type value: + list[~azure.mgmt.managementgroups.models.HierarchySettingsInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HierarchySettingsInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(HierarchySettingsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ManagementGroup(Model): + """The management group details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param details: Details. + :type details: ~azure.mgmt.managementgroups.models.ManagementGroupDetails + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.ManagementGroupChildInfo] + :param path: The path from the root to the current group. + :type path: + list[~azure.mgmt.managementgroups.models.ManagementGroupPathElement] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'ManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[ManagementGroupChildInfo]'}, + 'path': {'key': 'properties.path', 'type': '[ManagementGroupPathElement]'}, + } + + def __init__(self, **kwargs): + super(ManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + self.details = kwargs.get('details', None) + self.children = kwargs.get('children', None) + self.path = kwargs.get('path', None) + + +class ManagementGroupChildInfo(Model): + """The child information of a management group. + + :param type: The type of child resource. The fully qualified resource type + which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + 'Microsoft.Management/managementGroups', '/subscriptions' + :type type: str or ~azure.mgmt.managementgroups.models.enum + :param id: The fully qualified ID for the child resource (management group + or subscription). For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :param name: The name of the child entity. + :type name: str + :param display_name: The friendly name of the child resource. + :type display_name: str + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.ManagementGroupChildInfo] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ManagementGroupChildInfo]'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupChildInfo, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.children = kwargs.get('children', None) + + +class ManagementGroupDetails(Model): + """The details of a management group. + + :param version: The version number of the object. + :type version: float + :param updated_time: The date and time when this object was last updated. + :type updated_time: datetime + :param updated_by: The identity of the principal or process that updated + the object. + :type updated_by: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.ParentGroupInfo + """ + + _attribute_map = { + 'version': {'key': 'version', 'type': 'float'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'ParentGroupInfo'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupDetails, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + self.updated_time = kwargs.get('updated_time', None) + self.updated_by = kwargs.get('updated_by', None) + self.parent = kwargs.get('parent', None) + + +class ManagementGroupInfo(Model): + """The management group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class ManagementGroupPathElement(Model): + """A path element of a management group ancestors. + + :param name: The name of the group. + :type name: str + :param display_name: The friendly name of the group. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagementGroupPathElement, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class Operation(Model): + """Operation supported by the Microsoft.Management resource provider. + + 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 + :param display: Display. + :type display: + ~azure.mgmt.managementgroups.models.OperationDisplayProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayProperties'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplayProperties(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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(OperationDisplayProperties, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationResults(Model): + """The results of an asynchronous operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = kwargs.get('tenant_id', None) + self.display_name = kwargs.get('display_name', None) + + +class ParentGroupInfo(Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :param name: The name of the parent management group + :type name: str + :param display_name: The friendly name of the parent management group. + :type display_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ParentGroupInfo, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class PatchManagementGroupRequest(Model): + """Management group patch parameters. + + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent + management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type parent_group_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'parent_group_id': {'key': 'parentGroupId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PatchManagementGroupRequest, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.parent_group_id = kwargs.get('parent_group_id', None) + + +class SubscriptionUnderManagementGroup(Model): + """The details of subscription under management group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the subscription. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/subscriptions + :vartype type: str + :ivar name: The stringified id of the subscription. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant: The AAD Tenant ID associated with the subscription. For + example, 00000000-0000-0000-0000-000000000000 + :type tenant: str + :param display_name: The friendly name of the subscription. + :type display_name: str + :param parent: Parent. + :type parent: + ~azure.mgmt.managementgroups.models.DescendantParentGroupInfo + :param state: The state of the subscription. + :type state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant': {'key': 'properties.tenant', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant = kwargs.get('tenant', None) + self.display_name = kwargs.get('display_name', None) + self.parent = kwargs.get('parent', None) + self.state = kwargs.get('state', None) + + +class TenantBackfillStatusResult(Model): + """The tenant backfill status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :vartype tenant_id: str + :ivar status: The status of the Tenant Backfill. Possible values include: + 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', + 'Cancelled', 'Completed' + :vartype status: str or ~azure.mgmt.managementgroups.models.Status + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'Status'}, + } + + def __init__(self, **kwargs): + super(TenantBackfillStatusResult, self).__init__(**kwargs) + self.tenant_id = None + self.status = None diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models_py3.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models_py3.py new file mode 100644 index 000000000000..4ef88f0b6ace --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_models_py3.py @@ -0,0 +1,1185 @@ +# 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 AzureAsyncOperationResults(Model): + """The results of Azure-AsyncOperation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :ivar status: The current status of the asynchronous operation performed . + For example, Running, Succeeded, Failed + :vartype status: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, display_name: str=None, **kwargs) -> None: + super(AzureAsyncOperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.status = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class CheckNameAvailabilityRequest(Model): + """Management group name availability check parameters. + + :param name: the name to check for availability + :type name: str + :param type: fully qualified resource type which includes provider + namespace. Possible values include: + 'Microsoft.Management/managementGroups' + :type type: str or ~azure.mgmt.managementgroups.models.Type + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'Type'}, + } + + def __init__(self, *, name: str=None, type=None, **kwargs) -> None: + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CheckNameAvailabilityResult(Model): + """Describes the result of the request to check management group name + availability. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: Required. True indicates name is valid and + available. False indicates the name is invalid, unavailable, or both. + :vartype name_available: bool + :ivar reason: Required if nameAvailable == false. Invalid indicates the + name provided does not match the resource provider's naming requirements + (incorrect length, unsupported characters, etc.) AlreadyExists indicates + that the name is already in use and is therefore unavailable. Possible + values include: 'Invalid', 'AlreadyExists' + :vartype reason: str or ~azure.mgmt.managementgroups.models.Reason + :ivar message: Required if nameAvailable == false. Localized. If reason == + invalid, provide the user with the reason why the given name is invalid, + and provide the resource naming requirements so that the user can select a + valid name. If reason == AlreadyExists, explain that is already in use, + and direct them to select a different name. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'Reason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class CreateManagementGroupChildInfo(Model): + """The child information of a management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The type of child resource. The fully qualified resource type + which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + 'Microsoft.Management/managementGroups', '/subscriptions' + :vartype type: str or ~azure.mgmt.managementgroups.models.enum + :ivar id: The fully qualified ID for the child resource (management group + or subscription). For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar name: The name of the child entity. + :vartype name: str + :ivar display_name: The friendly name of the child resource. + :vartype display_name: str + :ivar children: The list of children. + :vartype children: + list[~azure.mgmt.managementgroups.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(CreateManagementGroupChildInfo, self).__init__(**kwargs) + self.type = None + self.id = None + self.name = None + self.display_name = None + self.children = None + + +class CreateManagementGroupDetails(Model): + """The details of a management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar version: The version number of the object. + :vartype version: float + :ivar updated_time: The date and time when this object was last updated. + :vartype updated_time: datetime + :ivar updated_by: The identity of the principal or process that updated + the object. + :vartype updated_by: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.CreateParentGroupInfo + """ + + _validation = { + 'version': {'readonly': True}, + 'updated_time': {'readonly': True}, + 'updated_by': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'float'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'CreateParentGroupInfo'}, + } + + def __init__(self, *, parent=None, **kwargs) -> None: + super(CreateManagementGroupDetails, self).__init__(**kwargs) + self.version = None + self.updated_time = None + self.updated_by = None + self.parent = parent + + +class CreateManagementGroupRequest(Model): + """Management group creation parameters. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :param name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :type name: str + :ivar tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :vartype tenant_id: str + :param display_name: The friendly name of the management group. If no + value is passed then this field will be set to the groupId. + :type display_name: str + :param details: Details. + :type details: + ~azure.mgmt.managementgroups.models.CreateManagementGroupDetails + :ivar children: The list of children. + :vartype children: + list[~azure.mgmt.managementgroups.models.CreateManagementGroupChildInfo] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'children': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'CreateManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[CreateManagementGroupChildInfo]'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, details=None, **kwargs) -> None: + super(CreateManagementGroupRequest, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = name + self.tenant_id = None + self.display_name = display_name + self.details = details + self.children = None + + +class CreateOrUpdateSettingsRequest(Model): + """Parameters for creating or updating Management Group settings. + + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _attribute_map = { + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, *, require_authorization_for_group_creation: bool=None, default_management_group: str=None, **kwargs) -> None: + super(CreateOrUpdateSettingsRequest, self).__init__(**kwargs) + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class CreateParentGroupInfo(Model): + """(Optional) The ID of the parent management group used during creation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :ivar name: The name of the parent management group + :vartype name: str + :ivar display_name: The friendly name of the parent management group. + :vartype display_name: str + """ + + _validation = { + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(CreateParentGroupInfo, self).__init__(**kwargs) + self.id = id + self.name = None + self.display_name = None + + +class DescendantInfo(Model): + """The descendant. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the descendant. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + or /subscriptions/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups or /subscriptions + :vartype type: str + :ivar name: The name of the descendant. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: Parent. + :type parent: + ~azure.mgmt.managementgroups.models.DescendantParentGroupInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + } + + def __init__(self, *, display_name: str=None, parent=None, **kwargs) -> None: + super(DescendantInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = display_name + self.parent = parent + + +class DescendantParentGroupInfo(Model): + """The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(DescendantParentGroupInfo, self).__init__(**kwargs) + self.id = id + + +class EntityHierarchyItem(Model): + """The management group details for the hierarchy view. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param permissions: Permissions. Possible values include: 'noaccess', + 'view', 'edit', 'delete' + :type permissions: str or ~azure.mgmt.managementgroups.models.enum + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.EntityHierarchyItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'children': {'key': 'properties.children', 'type': '[EntityHierarchyItem]'}, + } + + def __init__(self, *, display_name: str=None, permissions=None, children=None, **kwargs) -> None: + super(EntityHierarchyItem, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.display_name = display_name + self.permissions = permissions + self.children = children + + +class EntityInfo(Model): + """The entity. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the entity. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the entity. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the entity. For + example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.EntityParentGroupInfo + :param permissions: Permissions. Possible values include: 'noaccess', + 'view', 'edit', 'delete' + :type permissions: str or ~azure.mgmt.managementgroups.models.enum + :param inherited_permissions: Inherited Permissions. Possible values + include: 'noaccess', 'view', 'edit', 'delete' + :type inherited_permissions: str or + ~azure.mgmt.managementgroups.models.enum + :param number_of_descendants: Number of Descendants. + :type number_of_descendants: int + :param number_of_children: Number of Children. Number of children is the + number of Groups and Subscriptions that are exactly one level underneath + the current Group. + :type number_of_children: int + :param number_of_child_groups: Number of Child Groups. Number of children + is the number of Groups that are exactly one level underneath the current + Group. + :type number_of_child_groups: int + :param parent_display_name_chain: The parent display name chain from the + root group to the immediate parent + :type parent_display_name_chain: list[str] + :param parent_name_chain: The parent name chain from the root group to the + immediate parent + :type parent_name_chain: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'EntityParentGroupInfo'}, + 'permissions': {'key': 'properties.permissions', 'type': 'str'}, + 'inherited_permissions': {'key': 'properties.inheritedPermissions', 'type': 'str'}, + 'number_of_descendants': {'key': 'properties.numberOfDescendants', 'type': 'int'}, + 'number_of_children': {'key': 'properties.numberOfChildren', 'type': 'int'}, + 'number_of_child_groups': {'key': 'properties.numberOfChildGroups', 'type': 'int'}, + 'parent_display_name_chain': {'key': 'properties.parentDisplayNameChain', 'type': '[str]'}, + 'parent_name_chain': {'key': 'properties.parentNameChain', 'type': '[str]'}, + } + + def __init__(self, *, tenant_id: str=None, display_name: str=None, parent=None, permissions=None, inherited_permissions=None, number_of_descendants: int=None, number_of_children: int=None, number_of_child_groups: int=None, parent_display_name_chain=None, parent_name_chain=None, **kwargs) -> None: + super(EntityInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + self.parent = parent + self.permissions = permissions + self.inherited_permissions = inherited_permissions + self.number_of_descendants = number_of_descendants + self.number_of_children = number_of_children + self.number_of_child_groups = number_of_child_groups + self.parent_display_name_chain = parent_display_name_chain + self.parent_name_chain = parent_name_chain + + +class EntityParentGroupInfo(Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(EntityParentGroupInfo, self).__init__(**kwargs) + self.id = id + + +class ErrorDetails(Model): + """The details of the error. + + :param code: One of a server-defined set of error codes. + :type code: str + :param message: A human-readable representation of the error. + :type message: str + :param details: A human-readable representation of the error's details. + :type details: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, details: str=None, **kwargs) -> None: + super(ErrorDetails, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class ErrorResponse(Model): + """The error object. + + :param error: Error. + :type error: ~azure.mgmt.managementgroups.models.ErrorDetails + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetails'}, + } + + 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 HierarchySettings(Model): + """Settings defined at the Management Group scope. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy + settings. For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, require_authorization_for_group_creation: bool=None, default_management_group: str=None, **kwargs) -> None: + super(HierarchySettings, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class HierarchySettingsInfo(Model): + """The hierarchy settings resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the settings object. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/settings. + :vartype type: str + :ivar name: The name of the object. In this case, default. + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the hierarchy + settings. For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param require_authorization_for_group_creation: Indicates whether RBAC + access is required upon group creation under the root Management Group. If + set to true, user will require Microsoft.Management/managementGroups/write + action on the root Management Group scope in order to create new Groups + directly under the root. This will prevent new users from creating new + Management Groups, unless they are given access. + :type require_authorization_for_group_creation: bool + :param default_management_group: Settings that sets the default Management + Group under which new subscriptions get added in this tenant. For example, + /providers/Microsoft.Management/managementGroups/defaultGroup + :type default_management_group: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'require_authorization_for_group_creation': {'key': 'properties.requireAuthorizationForGroupCreation', 'type': 'bool'}, + 'default_management_group': {'key': 'properties.defaultManagementGroup', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, require_authorization_for_group_creation: bool=None, default_management_group: str=None, **kwargs) -> None: + super(HierarchySettingsInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.require_authorization_for_group_creation = require_authorization_for_group_creation + self.default_management_group = default_management_group + + +class HierarchySettingsList(Model): + """Lists all hierarchy settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param value: The list of hierarchy settings. + :type value: + list[~azure.mgmt.managementgroups.models.HierarchySettingsInfo] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HierarchySettingsInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(HierarchySettingsList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagementGroup(Model): + """The management group details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + :param details: Details. + :type details: ~azure.mgmt.managementgroups.models.ManagementGroupDetails + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.ManagementGroupChildInfo] + :param path: The path from the root to the current group. + :type path: + list[~azure.mgmt.managementgroups.models.ManagementGroupPathElement] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'details': {'key': 'properties.details', 'type': 'ManagementGroupDetails'}, + 'children': {'key': 'properties.children', 'type': '[ManagementGroupChildInfo]'}, + 'path': {'key': 'properties.path', 'type': '[ManagementGroupPathElement]'}, + } + + def __init__(self, *, tenant_id: str=None, display_name: str=None, details=None, children=None, path=None, **kwargs) -> None: + super(ManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + self.details = details + self.children = children + self.path = path + + +class ManagementGroupChildInfo(Model): + """The child information of a management group. + + :param type: The type of child resource. The fully qualified resource type + which includes provider namespace (e.g. + Microsoft.Management/managementGroups). Possible values include: + 'Microsoft.Management/managementGroups', '/subscriptions' + :type type: str or ~azure.mgmt.managementgroups.models.enum + :param id: The fully qualified ID for the child resource (management group + or subscription). For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :param name: The name of the child entity. + :type name: str + :param display_name: The friendly name of the child resource. + :type display_name: str + :param children: The list of children. + :type children: + list[~azure.mgmt.managementgroups.models.ManagementGroupChildInfo] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[ManagementGroupChildInfo]'}, + } + + def __init__(self, *, type=None, id: str=None, name: str=None, display_name: str=None, children=None, **kwargs) -> None: + super(ManagementGroupChildInfo, self).__init__(**kwargs) + self.type = type + self.id = id + self.name = name + self.display_name = display_name + self.children = children + + +class ManagementGroupDetails(Model): + """The details of a management group. + + :param version: The version number of the object. + :type version: float + :param updated_time: The date and time when this object was last updated. + :type updated_time: datetime + :param updated_by: The identity of the principal or process that updated + the object. + :type updated_by: str + :param parent: Parent. + :type parent: ~azure.mgmt.managementgroups.models.ParentGroupInfo + """ + + _attribute_map = { + 'version': {'key': 'version', 'type': 'float'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + 'updated_by': {'key': 'updatedBy', 'type': 'str'}, + 'parent': {'key': 'parent', 'type': 'ParentGroupInfo'}, + } + + def __init__(self, *, version: float=None, updated_time=None, updated_by: str=None, parent=None, **kwargs) -> None: + super(ManagementGroupDetails, self).__init__(**kwargs) + self.version = version + self.updated_time = updated_time + self.updated_by = updated_by + self.parent = parent + + +class ManagementGroupInfo(Model): + """The management group resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, display_name: str=None, **kwargs) -> None: + super(ManagementGroupInfo, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class ManagementGroupPathElement(Model): + """A path element of a management group ancestors. + + :param name: The name of the group. + :type name: str + :param display_name: The friendly name of the group. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: + super(ManagementGroupPathElement, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class Operation(Model): + """Operation supported by the Microsoft.Management resource provider. + + 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 + :param display: Display. + :type display: + ~azure.mgmt.managementgroups.models.OperationDisplayProperties + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayProperties'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplayProperties(Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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) -> None: + super(OperationDisplayProperties, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationResults(Model): + """The results of an asynchronous operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups + :vartype type: str + :ivar name: The name of the management group. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :type tenant_id: str + :param display_name: The friendly name of the management group. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, display_name: str=None, **kwargs) -> None: + super(OperationResults, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant_id = tenant_id + self.display_name = display_name + + +class ParentGroupInfo(Model): + """(Optional) The ID of the parent management group. + + :param id: The fully qualified ID for the parent management group. For + example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type id: str + :param name: The name of the parent management group + :type name: str + :param display_name: The friendly name of the parent management group. + :type display_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, name: str=None, display_name: str=None, **kwargs) -> None: + super(ParentGroupInfo, self).__init__(**kwargs) + self.id = id + self.name = name + self.display_name = display_name + + +class PatchManagementGroupRequest(Model): + """Management group patch parameters. + + :param display_name: The friendly name of the management group. + :type display_name: str + :param parent_group_id: (Optional) The fully qualified ID for the parent + management group. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + :type parent_group_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'parent_group_id': {'key': 'parentGroupId', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, parent_group_id: str=None, **kwargs) -> None: + super(PatchManagementGroupRequest, self).__init__(**kwargs) + self.display_name = display_name + self.parent_group_id = parent_group_id + + +class SubscriptionUnderManagementGroup(Model): + """The details of subscription under management group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the subscription. For example, + /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 + :vartype id: str + :ivar type: The type of the resource. For example, + Microsoft.Management/managementGroups/subscriptions + :vartype type: str + :ivar name: The stringified id of the subscription. For example, + 00000000-0000-0000-0000-000000000000 + :vartype name: str + :param tenant: The AAD Tenant ID associated with the subscription. For + example, 00000000-0000-0000-0000-000000000000 + :type tenant: str + :param display_name: The friendly name of the subscription. + :type display_name: str + :param parent: Parent. + :type parent: + ~azure.mgmt.managementgroups.models.DescendantParentGroupInfo + :param state: The state of the subscription. + :type state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tenant': {'key': 'properties.tenant', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'parent': {'key': 'properties.parent', 'type': 'DescendantParentGroupInfo'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + } + + def __init__(self, *, tenant: str=None, display_name: str=None, parent=None, state: str=None, **kwargs) -> None: + super(SubscriptionUnderManagementGroup, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.tenant = tenant + self.display_name = display_name + self.parent = parent + self.state = state + + +class TenantBackfillStatusResult(Model): + """The tenant backfill status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar tenant_id: The AAD Tenant ID associated with the management group. + For example, 00000000-0000-0000-0000-000000000000 + :vartype tenant_id: str + :ivar status: The status of the Tenant Backfill. Possible values include: + 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', + 'Cancelled', 'Completed' + :vartype status: str or ~azure.mgmt.managementgroups.models.Status + """ + + _validation = { + 'tenant_id': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'Status'}, + } + + def __init__(self, **kwargs) -> None: + super(TenantBackfillStatusResult, self).__init__(**kwargs) + self.tenant_id = None + self.status = None diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_paged_models.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_paged_models.py new file mode 100644 index 000000000000..cde2c93cbf32 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/models/_paged_models.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagementGroupInfoPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagementGroupInfo ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagementGroupInfo]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagementGroupInfoPaged, self).__init__(*args, **kwargs) +class DescendantInfoPaged(Paged): + """ + A paging container for iterating over a list of :class:`DescendantInfo ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DescendantInfo]'} + } + + def __init__(self, *args, **kwargs): + + super(DescendantInfoPaged, self).__init__(*args, **kwargs) +class SubscriptionUnderManagementGroupPaged(Paged): + """ + A paging container for iterating over a list of :class:`SubscriptionUnderManagementGroup ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SubscriptionUnderManagementGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(SubscriptionUnderManagementGroupPaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class EntityInfoPaged(Paged): + """ + A paging container for iterating over a list of :class:`EntityInfo ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[EntityInfo]'} + } + + def __init__(self, *args, **kwargs): + + super(EntityInfoPaged, self).__init__(*args, **kwargs) diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/__init__.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/__init__.py index 3baf43e0f0a7..d1a633aab8e0 100644 --- a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/__init__.py +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/__init__.py @@ -9,14 +9,18 @@ # regenerated. # -------------------------------------------------------------------------- -from .management_groups_operations import ManagementGroupsOperations -from .management_group_subscriptions_operations import ManagementGroupSubscriptionsOperations -from .operations import Operations -from .entities_operations import EntitiesOperations +from ._management_groups_operations import ManagementGroupsOperations +from ._management_group_subscriptions_operations import ManagementGroupSubscriptionsOperations +from ._hierarchy_settings_operations import HierarchySettingsOperations +from ._operations import Operations +from ._entities_operations import EntitiesOperations +from ._management_groups_api_operations import ManagementGroupsAPIOperationsMixin __all__ = [ 'ManagementGroupsOperations', 'ManagementGroupSubscriptionsOperations', + 'HierarchySettingsOperations', 'Operations', 'EntitiesOperations', + 'ManagementGroupsAPIOperationsMixin', ] diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_entities_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_entities_operations.py new file mode 100644 index 000000000000..c63dae14350d --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_entities_operations.py @@ -0,0 +1,165 @@ +# 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 EntitiesOperations(object): + """EntitiesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-01-preview. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list( + self, select=None, search=None, filter=None, view=None, group_name=None, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """List all entities (Management Groups, Subscriptions, etc.) for the + authenticated user. + . + + :param select: This parameter specifies the fields to include in the + response. Can include any combination of + Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. + When specified the $select parameter can override select in + $skipToken. + :type select: str + :param search: The $search parameter is used in conjunction with the + $filter parameter to return three different outputs depending on the + parameter passed in. + With $search=AllowedParents the API will return the entity info of all + groups that the requested entity will be able to reparent to as + determined by the user's permissions. + With $search=AllowedChildren the API will return the entity info of + all entities that can be added as children of the requested entity. + With $search=ParentAndFirstLevelChildren the API will return the + parent and first level of children that the user has either direct + access to or indirect access via one of their descendants. + With $search=ParentOnly the API will return only the group if the user + has access to at least one of the descendants of the group. + With $search=ChildrenOnly the API will return only the first level of + children of the group entity info specified in $filter. The user must + have direct access to the children entities or one of it's descendants + for it to show up in the results. Possible values include: + 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + 'ParentOnly', 'ChildrenOnly' + :type search: str + :param filter: The filter parameter allows you to filter on the the + name or display name fields. You can check for equality on the name + field (e.g. name eq '{entityName}') and you can check for substrings + on either the name or display name fields(e.g. contains(name, + '{substringToSearch}'), contains(displayName, '{substringToSearch')). + Note that the '{entityName}' and '{substringToSearch}' fields are + checked case insensitively. + :type filter: str + :param view: The view parameter allows clients to filter the type of + data that is returned by the getEntities call. Possible values + include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + :type view: str + :param group_name: A filter which allows the get entities call to + focus on a particular group (i.e. "$filter=name eq 'groupName'") + :type group_name: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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 EntityInfo + :rtype: + ~azure.mgmt.managementgroups.models.EntityInfoPaged[~azure.mgmt.managementgroups.models.EntityInfo] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if self.config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self.config.skiptoken", self.config.skiptoken, 'str') + if self.config.skip is not None: + query_parameters['$skip'] = self._serialize.query("self.config.skip", self.config.skip, 'int') + if self.config.top is not None: + query_parameters['$top'] = self._serialize.query("self.config.top", self.config.top, 'int') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + if search is not None: + query_parameters['$search'] = self._serialize.query("search", search, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if view is not None: + query_parameters['$view'] = self._serialize.query("view", view, 'str') + if group_name is not None: + query_parameters['groupName'] = self._serialize.query("group_name", group_name, '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 cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + 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.EntityInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/getEntities'} diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_hierarchy_settings_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_hierarchy_settings_operations.py new file mode 100644 index 000000000000..3fcf7dbe65ed --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_hierarchy_settings_operations.py @@ -0,0 +1,335 @@ +# 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 HierarchySettingsOperations(object): + """HierarchySettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-01-preview. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list( + self, group_id, custom_headers=None, raw=False, **operation_config): + """Gets all the hierarchy settings defined at the Management Group level. + Settings can only be set on the root Management Group of the hierarchy. + . + + :param group_id: Management Group ID. + :type group_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: HierarchySettingsList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.HierarchySettingsList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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('HierarchySettingsList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings'} + + def get( + self, group_id, custom_headers=None, raw=False, **operation_config): + """Gets the hierarchy settings defined at the Management Group level. + Settings can only be set on the root Management Group of the hierarchy. + . + + :param group_id: Management Group ID. + :type group_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: HierarchySettings or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.HierarchySettings or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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('HierarchySettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} + + def create_or_update( + self, group_id, create_tenant_settings_request, custom_headers=None, raw=False, **operation_config): + """Creates or updates the hierarchy settings defined at the Management + Group level. + . + + :param group_id: Management Group ID. + :type group_id: str + :param create_tenant_settings_request: Tenant level settings request + parameter. + :type create_tenant_settings_request: + ~azure.mgmt.managementgroups.models.CreateOrUpdateSettingsRequest + :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: HierarchySettings or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.HierarchySettings or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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(create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HierarchySettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} + + def update( + self, group_id, create_tenant_settings_request, custom_headers=None, raw=False, **operation_config): + """Updates the hierarchy settings defined at the Management Group level. + . + + :param group_id: Management Group ID. + :type group_id: str + :param create_tenant_settings_request: Tenant level settings request + parameter. + :type create_tenant_settings_request: + ~azure.mgmt.managementgroups.models.CreateOrUpdateSettingsRequest + :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: HierarchySettings or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.HierarchySettings or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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(create_tenant_settings_request, 'CreateOrUpdateSettingsRequest') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HierarchySettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} + + def delete( + self, group_id, custom_headers=None, raw=False, **operation_config): + """Deletes the hierarchy settings defined at the Management Group level. + . + + :param group_id: Management Group ID. + :type group_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: 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 = { + 'groupId': self._serialize.url("group_id", group_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/settings/default'} diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_group_subscriptions_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_group_subscriptions_operations.py new file mode 100644 index 000000000000..37e33e3b3a05 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_group_subscriptions_operations.py @@ -0,0 +1,302 @@ +# 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 ManagementGroupSubscriptionsOperations(object): + """ManagementGroupSubscriptionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-01-preview. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def create( + self, group_id, subscription_id, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """Associates existing subscription with the management group. + . + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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: SubscriptionUnderManagementGroup or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.managementgroups.models.SubscriptionUnderManagementGroup + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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.put(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('SubscriptionUnderManagementGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} + + def delete( + self, group_id, subscription_id, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """De-associates subscription from the management group. + . + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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 = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} + + def get_subscription( + self, group_id, subscription_id, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """Retrieves details about given subscription which is associated with the + management group. + . + + :param group_id: Management Group ID. + :type group_id: str + :param subscription_id: Subscription ID. + :type subscription_id: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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: SubscriptionUnderManagementGroup or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.managementgroups.models.SubscriptionUnderManagementGroup + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_subscription.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str'), + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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('SubscriptionUnderManagementGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_subscription.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}'} + + def get_subscriptions_under_management_group( + self, group_id, custom_headers=None, raw=False, **operation_config): + """Retrieves details about all subscriptions which are associated with the + management group. + . + + :param group_id: Management Group ID. + :type group_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: An iterator like instance of SubscriptionUnderManagementGroup + :rtype: + ~azure.mgmt.managementgroups.models.SubscriptionUnderManagementGroupPaged[~azure.mgmt.managementgroups.models.SubscriptionUnderManagementGroup] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_subscriptions_under_management_group.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if self.config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self.config.skiptoken", self.config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SubscriptionUnderManagementGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + get_subscriptions_under_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/subscriptions'} diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_api_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_api_operations.py new file mode 100644 index 000000000000..22aee480be81 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_api_operations.py @@ -0,0 +1,178 @@ +# 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.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling +from .. import models +import uuid + + +class ManagementGroupsAPIOperationsMixin(object): + + def check_name_availability( + self, check_name_availability_request, custom_headers=None, raw=False, **operation_config): + """Checks if the specified management group name is valid and unique. + + :param check_name_availability_request: Management group name + availability check parameters. + :type check_name_availability_request: + ~azure.mgmt.managementgroups.models.CheckNameAvailabilityRequest + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.managementgroups.models.CheckNameAvailabilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.check_name_availability.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' + 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(check_name_availability_request, 'CheckNameAvailabilityRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/providers/Microsoft.Management/checkNameAvailability'} + + def start_tenant_backfill( + self, custom_headers=None, raw=False, **operation_config): + """Starts backfilling subscriptions for the Tenant. + + :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: TenantBackfillStatusResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.TenantBackfillStatusResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.start_tenant_backfill.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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TenantBackfillStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + start_tenant_backfill.metadata = {'url': '/providers/Microsoft.Management/startTenantBackfill'} + + def tenant_backfill_status( + self, custom_headers=None, raw=False, **operation_config): + """Gets tenant backfill status. + + :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: TenantBackfillStatusResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.TenantBackfillStatusResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.tenant_backfill_status.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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TenantBackfillStatusResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + tenant_backfill_status.metadata = {'url': '/providers/Microsoft.Management/tenantBackfillStatus'} diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_operations.py new file mode 100644 index 000000000000..3e932ece0577 --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_management_groups_operations.py @@ -0,0 +1,560 @@ +# 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 ManagementGroupsOperations(object): + """ManagementGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-01-preview. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list( + self, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """List management groups for the authenticated user. + . + + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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 ManagementGroupInfo + :rtype: + ~azure.mgmt.managementgroups.models.ManagementGroupInfoPaged[~azure.mgmt.managementgroups.models.ManagementGroupInfo] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if self.config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self.config.skiptoken", self.config.skiptoken, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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.ManagementGroupInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/managementGroups'} + + def get( + self, group_id, expand=None, recurse=None, filter=None, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """Get the details of the management group. + . + + :param group_id: Management Group ID. + :type group_id: str + :param expand: The $expand=children query string parameter allows + clients to request inclusion of children in the response payload. + $expand=path includes the path from the root group to the current + group. Possible values include: 'children', 'path' + :type expand: str + :param recurse: The $recurse=true query string parameter allows + clients to request inclusion of entire hierarchy in the response + payload. Note that $expand=children must be passed up if $recurse is + set to true. + :type recurse: bool + :param filter: A filter which allows the exclusion of subscriptions + from results (i.e. '$filter=children.childType ne Subscription') + :type filter: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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: ManagementGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.ManagementGroup or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if recurse is not None: + query_parameters['$recurse'] = self._serialize.query("recurse", recurse, 'bool') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, '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 cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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('ManagementGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} + + + def _create_or_update_initial( + self, group_id, create_management_group_request, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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 cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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(create_management_group_request, 'CreateManagementGroupRequest') + + # 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, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroup', response) + header_dict = { + 'Location': 'str', + 'Azure-AsyncOperation': 'str', + } + if response.status_code == 202: + deserialized = self._deserialize('AzureAsyncOperationResults', response) + header_dict = { + 'Location': 'str', + 'Azure-AsyncOperation': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def create_or_update( + self, group_id, create_management_group_request, cache_control="no-cache", custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update a management group. + If a management group is already created and a subsequent create + request is issued with different properties, the management group + properties will be updated. + . + + :param group_id: Management Group ID. + :type group_id: str + :param create_management_group_request: Management group creation + parameters. + :type create_management_group_request: + ~azure.mgmt.managementgroups.models.CreateManagementGroupRequest + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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 object or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._create_or_update_initial( + group_id=group_id, + create_management_group_request=create_management_group_request, + cache_control=cache_control, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Azure-AsyncOperation': 'str', + } + deserialized = self._deserialize('object', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + 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': '/providers/Microsoft.Management/managementGroups/{groupId}'} + + def update( + self, group_id, patch_group_request, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + """Update a management group. + . + + :param group_id: Management Group ID. + :type group_id: str + :param patch_group_request: Management group patch parameters. + :type patch_group_request: + ~azure.mgmt.managementgroups.models.PatchManagementGroupRequest + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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: ManagementGroup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.managementgroups.models.ManagementGroup or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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 cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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(patch_group_request, 'PatchManagementGroupRequest') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagementGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} + + + def _delete_initial( + self, group_id, cache_control="no-cache", custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_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 cache_control is not None: + header_parameters['Cache-Control'] = self._serialize.header("cache_control", cache_control, 'str') + 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 [202, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + header_dict = {} + + if response.status_code == 202: + deserialized = self._deserialize('AzureAsyncOperationResults', response) + header_dict = { + 'Location': 'str', + 'Azure-AsyncOperation': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def delete( + self, group_id, cache_control="no-cache", custom_headers=None, raw=False, polling=True, **operation_config): + """Delete management group. + If a management group contains child resources, the request will fail. + . + + :param group_id: Management Group ID. + :type group_id: str + :param cache_control: Indicates that the request shouldn't utilize any + caches. + :type cache_control: 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 + AzureAsyncOperationResults or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.managementgroups.models.AzureAsyncOperationResults] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.managementgroups.models.AzureAsyncOperationResults]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + group_id=group_id, + cache_control=cache_control, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Azure-AsyncOperation': 'str', + } + deserialized = self._deserialize('AzureAsyncOperationResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + 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) + delete.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}'} + + def get_descendants( + self, group_id, custom_headers=None, raw=False, **operation_config): + """List all entities that descend from a management group. + . + + :param group_id: Management Group ID. + :type group_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: An iterator like instance of DescendantInfo + :rtype: + ~azure.mgmt.managementgroups.models.DescendantInfoPaged[~azure.mgmt.managementgroups.models.DescendantInfo] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.get_descendants.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if self.config.skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("self.config.skiptoken", self.config.skiptoken, 'str') + if self.config.top is not None: + query_parameters['$top'] = self._serialize.query("self.config.top", self.config.top, 'int') + + 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.DescendantInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + get_descendants.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/descendants'} diff --git a/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_operations.py b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_operations.py new file mode 100644 index 000000000000..dd28d470e76e --- /dev/null +++ b/sdk/managementgroups/azure-mgmt-managementgroups/azure/mgmt/managementgroups/operations/_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-01-preview. Constant value: "2020-05-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-05-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Management REST API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.managementgroups.models.OperationPaged[~azure.mgmt.managementgroups.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Management/operations'}