Skip to content

Commit

Permalink
Generated from 0b1c989c20db1b55e669d6f9bb8554fc8e2e0547 (#2519)
Browse files Browse the repository at this point in the history
Update package version
  • Loading branch information
AutorestCI authored May 2, 2018
1 parent 420f8b5 commit 44f2316
Show file tree
Hide file tree
Showing 44 changed files with 1,630 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
import uuid
from .operations.management_groups_operations import ManagementGroupsOperations
from .operations.management_group_subscriptions_operations import ManagementGroupSubscriptionsOperations
from .operations.operations import Operations
from .operations.entities_operations import EntitiesOperations
from . import models


Expand All @@ -27,14 +32,25 @@ class ManagementGroupsAPIConfiguration(AzureConfiguration):
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param operation_result_id: The id of the operation result. Possible
values include: 'create', 'delete'
:type operation_result_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 str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):
self, credentials, operation_result_id, 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'

Expand All @@ -44,9 +60,11 @@ def __init__(
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.operation_result_id = operation_result_id
self.skiptoken = skiptoken


class ManagementGroupsAPI(object):
class ManagementGroupsAPI(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.
Expand All @@ -60,21 +78,32 @@ class ManagementGroupsAPI(object):
:vartype management_group_subscriptions: azure.mgmt.managementgroups.operations.ManagementGroupSubscriptionsOperations
: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<msrestazure.azure_active_directory>`
:param operation_result_id: The id of the operation result. Possible
values include: 'create', 'delete'
:type operation_result_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 str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):
self, credentials, operation_result_id, skiptoken=None, base_url=None):

self.config = ManagementGroupsAPIConfiguration(credentials, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
self.config = ManagementGroupsAPIConfiguration(credentials, operation_result_id, 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 = '2017-11-01-preview'
self.api_version = '2018-01-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand All @@ -84,3 +113,65 @@ def __init__(
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)

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<msrest:optionsforoperations>`.
:return: CheckNameAvailabilityResult or ClientRawResponse if raw=true
:rtype:
~azure.mgmt.managementgroups.models.CheckNameAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.managementgroups.models.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['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)
response = self._client.send(
request, header_parameters, body_content, 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'}
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,77 @@
try:
from .error_details_py3 import ErrorDetails
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .operation_display_py3 import OperationDisplay
from .operation_display_properties_py3 import OperationDisplayProperties
from .operation_py3 import Operation
from .check_name_availability_result_py3 import CheckNameAvailabilityResult
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
except (SyntaxError, ImportError):
from .error_details import ErrorDetails
from .error_response import ErrorResponse, ErrorResponseException
from .operation_display import OperationDisplay
from .operation_display_properties import OperationDisplayProperties
from .operation import Operation
from .check_name_availability_result import CheckNameAvailabilityResult
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 (
Reason,
Type,
)

__all__ = [
'ErrorDetails',
'ErrorResponse', 'ErrorResponseException',
'OperationDisplay',
'OperationDisplayProperties',
'Operation',
'CheckNameAvailabilityResult',
'ManagementGroupInfo',
'ParentGroupInfo',
'ManagementGroupDetails',
'ManagementGroupChildInfo',
'ManagementGroup',
'OperationResults',
'EntityParentGroupInfo',
'EntityInfo',
'EntityHierarchyItem',
'PatchManagementGroupRequest',
'CreateParentGroupInfo',
'CreateManagementGroupDetails',
'CreateManagementGroupChildInfo',
'CreateManagementGroupRequest',
'CheckNameAvailabilityRequest',
'ManagementGroupInfoPaged',
'OperationPaged',
'EntityInfoPaged',
'Reason',
'Type',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


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

from msrest.serialization import Model


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:
'/providers/Microsoft.Management/managementGroup'
: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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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 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
Loading

0 comments on commit 44f2316

Please sign in to comment.