Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] managementgroups/resource-manager #5673

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from .management_group_child_info_py3 import ManagementGroupChildInfo
from .management_group_py3 import ManagementGroup
from .operation_results_py3 import OperationResults
from .descendant_parent_group_info_py3 import DescendantParentGroupInfo
from .descendant_info_py3 import DescendantInfo
from .entity_parent_group_info_py3 import EntityParentGroupInfo
from .entity_info_py3 import EntityInfo
from .entity_hierarchy_item_py3 import EntityHierarchyItem
Expand All @@ -44,6 +46,8 @@
from .management_group_child_info import ManagementGroupChildInfo
from .management_group import ManagementGroup
from .operation_results import OperationResults
from .descendant_parent_group_info import DescendantParentGroupInfo
from .descendant_info import DescendantInfo
from .entity_parent_group_info import EntityParentGroupInfo
from .entity_info import EntityInfo
from .entity_hierarchy_item import EntityHierarchyItem
Expand All @@ -54,6 +58,7 @@
from .create_management_group_request import CreateManagementGroupRequest
from .check_name_availability_request import CheckNameAvailabilityRequest
from .management_group_info_paged import ManagementGroupInfoPaged
from .descendant_info_paged import DescendantInfoPaged
from .operation_paged import OperationPaged
from .entity_info_paged import EntityInfoPaged
from .management_groups_api_enums import (
Expand All @@ -75,6 +80,8 @@
'ManagementGroupChildInfo',
'ManagementGroup',
'OperationResults',
'DescendantParentGroupInfo',
'DescendantInfo',
'EntityParentGroupInfo',
'EntityInfo',
'EntityHierarchyItem',
Expand All @@ -85,6 +92,7 @@
'CreateManagementGroupRequest',
'CheckNameAvailabilityRequest',
'ManagementGroupInfoPaged',
'DescendantInfoPaged',
'OperationPaged',
'EntityInfoPaged',
'Reason',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class 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,
/providers/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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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 DescendantInfoPaged(Paged):
"""
A paging container for iterating over a list of :class:`DescendantInfo <azure.mgmt.managementgroups.models.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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class 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,
/providers/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class 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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class 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
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,82 @@ def get_long_running_output(response):
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, skiptoken=None, top=None, 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 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 top: Number of elements to return when retrieving results.
Passing this in will override $skipToken.
:type top: int
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of DescendantInfo
:rtype:
~azure.mgmt.managementgroups.models.DescendantInfoPaged[~azure.mgmt.managementgroups.models.DescendantInfo]
:raises:
:class:`ErrorResponseException<azure.mgmt.managementgroups.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):

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 skiptoken is not None:
query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str')
if top is not None:
query_parameters['$top'] = self._serialize.query("top", 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.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)

return response

# Deserialize response
deserialized = models.DescendantInfoPaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.DescendantInfoPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
get_descendants.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/descendants'}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.2.0"
VERSION = "2018-03-01-preview"

1 change: 1 addition & 0 deletions sdk/managementgroups/azure-mgmt-managementgroups/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + history,
long_description_content_type='text/x-rst',
license='MIT License',
author='Microsoft Corporation',
author_email='[email protected]',
Expand Down