Skip to content

Commit

Permalink
[AutoPR resources/resource-manager] Add deployment APIs at tenant sco…
Browse files Browse the repository at this point in the history
…pe (#6568)

* Generated from b42728c4632b9fbebd36431201aec7fbb71ede85

try #4.

* Generated from 51e50f12d99c49b499fcdc1c226d7bc749acf101

fix relative path.

* Generated from 520b56ac4a4e19581bd822b24a47a9cb5c37bc79

Fix resource group export result.

* Generated from b943cc534e5e853daa7e26704832b645ea02ef02

fix.
  • Loading branch information
AutorestCI authored Aug 7, 2019
1 parent c2163ae commit 424d682
Show file tree
Hide file tree
Showing 20 changed files with 10,003 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, SDKClient):
:type profile: azure.profiles.KnownProfiles
"""

DEFAULT_API_VERSION = '2019-05-10'
DEFAULT_API_VERSION = '2019-07-01'
_PROFILE_TAG = "azure.mgmt.resource.resources.ResourceManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
Expand Down Expand Up @@ -79,6 +79,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2018-05-01: :mod:`v2018_05_01.models<azure.mgmt.resource.resources.v2018_05_01.models>`
* 2019-05-01: :mod:`v2019_05_01.models<azure.mgmt.resource.resources.v2019_05_01.models>`
* 2019-05-10: :mod:`v2019_05_10.models<azure.mgmt.resource.resources.v2019_05_10.models>`
* 2019-07-01: :mod:`v2019_07_01.models<azure.mgmt.resource.resources.v2019_07_01.models>`
"""
if api_version == '2016-02-01':
from .v2016_02_01 import models
Expand All @@ -101,6 +102,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2019-05-10':
from .v2019_05_10 import models
return models
elif api_version == '2019-07-01':
from .v2019_07_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
Expand All @@ -114,6 +118,7 @@ def deployment_operations(self):
* 2018-05-01: :class:`DeploymentOperations<azure.mgmt.resource.resources.v2018_05_01.operations.DeploymentOperations>`
* 2019-05-01: :class:`DeploymentOperations<azure.mgmt.resource.resources.v2019_05_01.operations.DeploymentOperations>`
* 2019-05-10: :class:`DeploymentOperations<azure.mgmt.resource.resources.v2019_05_10.operations.DeploymentOperations>`
* 2019-07-01: :class:`DeploymentOperations<azure.mgmt.resource.resources.v2019_07_01.operations.DeploymentOperations>`
"""
api_version = self._get_api_version('deployment_operations')
if api_version == '2016-02-01':
Expand All @@ -130,6 +135,8 @@ def deployment_operations(self):
from .v2019_05_01.operations import DeploymentOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import DeploymentOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import DeploymentOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -145,6 +152,7 @@ def deployments(self):
* 2018-05-01: :class:`DeploymentsOperations<azure.mgmt.resource.resources.v2018_05_01.operations.DeploymentsOperations>`
* 2019-05-01: :class:`DeploymentsOperations<azure.mgmt.resource.resources.v2019_05_01.operations.DeploymentsOperations>`
* 2019-05-10: :class:`DeploymentsOperations<azure.mgmt.resource.resources.v2019_05_10.operations.DeploymentsOperations>`
* 2019-07-01: :class:`DeploymentsOperations<azure.mgmt.resource.resources.v2019_07_01.operations.DeploymentsOperations>`
"""
api_version = self._get_api_version('deployments')
if api_version == '2016-02-01':
Expand All @@ -161,6 +169,8 @@ def deployments(self):
from .v2019_05_01.operations import DeploymentsOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import DeploymentsOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import DeploymentsOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -172,6 +182,7 @@ def operations(self):
* 2018-05-01: :class:`Operations<azure.mgmt.resource.resources.v2018_05_01.operations.Operations>`
* 2019-05-01: :class:`Operations<azure.mgmt.resource.resources.v2019_05_01.operations.Operations>`
* 2019-05-10: :class:`Operations<azure.mgmt.resource.resources.v2019_05_10.operations.Operations>`
* 2019-07-01: :class:`Operations<azure.mgmt.resource.resources.v2019_07_01.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2018-05-01':
Expand All @@ -180,6 +191,8 @@ def operations(self):
from .v2019_05_01.operations import Operations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import Operations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import Operations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -195,6 +208,7 @@ def providers(self):
* 2018-05-01: :class:`ProvidersOperations<azure.mgmt.resource.resources.v2018_05_01.operations.ProvidersOperations>`
* 2019-05-01: :class:`ProvidersOperations<azure.mgmt.resource.resources.v2019_05_01.operations.ProvidersOperations>`
* 2019-05-10: :class:`ProvidersOperations<azure.mgmt.resource.resources.v2019_05_10.operations.ProvidersOperations>`
* 2019-07-01: :class:`ProvidersOperations<azure.mgmt.resource.resources.v2019_07_01.operations.ProvidersOperations>`
"""
api_version = self._get_api_version('providers')
if api_version == '2016-02-01':
Expand All @@ -211,6 +225,8 @@ def providers(self):
from .v2019_05_01.operations import ProvidersOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import ProvidersOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import ProvidersOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -226,6 +242,7 @@ def resource_groups(self):
* 2018-05-01: :class:`ResourceGroupsOperations<azure.mgmt.resource.resources.v2018_05_01.operations.ResourceGroupsOperations>`
* 2019-05-01: :class:`ResourceGroupsOperations<azure.mgmt.resource.resources.v2019_05_01.operations.ResourceGroupsOperations>`
* 2019-05-10: :class:`ResourceGroupsOperations<azure.mgmt.resource.resources.v2019_05_10.operations.ResourceGroupsOperations>`
* 2019-07-01: :class:`ResourceGroupsOperations<azure.mgmt.resource.resources.v2019_07_01.operations.ResourceGroupsOperations>`
"""
api_version = self._get_api_version('resource_groups')
if api_version == '2016-02-01':
Expand All @@ -242,6 +259,8 @@ def resource_groups(self):
from .v2019_05_01.operations import ResourceGroupsOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import ResourceGroupsOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import ResourceGroupsOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -257,6 +276,7 @@ def resources(self):
* 2018-05-01: :class:`ResourcesOperations<azure.mgmt.resource.resources.v2018_05_01.operations.ResourcesOperations>`
* 2019-05-01: :class:`ResourcesOperations<azure.mgmt.resource.resources.v2019_05_01.operations.ResourcesOperations>`
* 2019-05-10: :class:`ResourcesOperations<azure.mgmt.resource.resources.v2019_05_10.operations.ResourcesOperations>`
* 2019-07-01: :class:`ResourcesOperations<azure.mgmt.resource.resources.v2019_07_01.operations.ResourcesOperations>`
"""
api_version = self._get_api_version('resources')
if api_version == '2016-02-01':
Expand All @@ -273,6 +293,8 @@ def resources(self):
from .v2019_05_01.operations import ResourcesOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import ResourcesOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import ResourcesOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -288,6 +310,7 @@ def tags(self):
* 2018-05-01: :class:`TagsOperations<azure.mgmt.resource.resources.v2018_05_01.operations.TagsOperations>`
* 2019-05-01: :class:`TagsOperations<azure.mgmt.resource.resources.v2019_05_01.operations.TagsOperations>`
* 2019-05-10: :class:`TagsOperations<azure.mgmt.resource.resources.v2019_05_10.operations.TagsOperations>`
* 2019-07-01: :class:`TagsOperations<azure.mgmt.resource.resources.v2019_07_01.operations.TagsOperations>`
"""
api_version = self._get_api_version('tags')
if api_version == '2016-02-01':
Expand All @@ -304,6 +327,8 @@ def tags(self):
from .v2019_05_01.operations import TagsOperations as OperationClass
elif api_version == '2019-05-10':
from .v2019_05_10.operations import TagsOperations as OperationClass
elif api_version == '2019-07-01':
from .v2019_07_01.operations import TagsOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from .v2019_05_10.models import *
from .v2019_07_01.models import *
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,80 @@ def internal_paging(next_link=None):
return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'}

def list_at_tenant_scope(
self, top=None, expand=None, custom_headers=None, raw=False, **operation_config):
"""Gets all resource providers for the tenant.
:param top: The number of results to return. If null is passed returns
all providers.
:type top: int
:param expand: The properties to include in the results. For example,
use &$expand=metadata in the query string to retrieve resource
provider metadata. To include property aliases in response, use
$expand=resourceTypes/aliases.
:type expand: 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<msrest:optionsforoperations>`.
:return: An iterator like instance of Provider
:rtype:
~azure.mgmt.resource.resources.v2019_05_10.models.ProviderPaged[~azure.mgmt.resource.resources.v2019_05_10.models.Provider]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_at_tenant_scope.metadata['url']

# Construct parameters
query_parameters = {}
if top is not None:
query_parameters['$top'] = self._serialize.query("top", top, 'int')
if expand is not None:
query_parameters['$expand'] = self._serialize.query("expand", expand, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

def internal_paging(next_link=None):
request = prepare_request(next_link)

response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

return response

# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.ProviderPaged(internal_paging, self._deserialize.dependencies, header_dict)

return deserialized
list_at_tenant_scope.metadata = {'url': '/providers'}

def get(
self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config):
"""Gets the specified resource provider.
Expand Down Expand Up @@ -298,3 +372,66 @@ def get(

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'}

def get_at_tenant_scope(
self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config):
"""Gets the specified resource provider at the tenant level.
:param resource_provider_namespace: The namespace of the resource
provider.
:type resource_provider_namespace: str
:param expand: The $expand query parameter. For example, to include
property aliases in response, use $expand=resourceTypes/aliases.
:type expand: 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<msrest:optionsforoperations>`.
:return: Provider or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_at_tenant_scope.metadata['url']
path_format_arguments = {
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
if expand is not None:
query_parameters['$expand'] = self._serialize.query("expand", expand, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Provider', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 ._configuration import ResourceManagementClientConfiguration
from ._resource_management_client import ResourceManagementClient
__all__ = ['ResourceManagementClient', 'ResourceManagementClientConfiguration']

from .version import VERSION

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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 ResourceManagementClientConfiguration(AzureConfiguration):
"""Configuration for ResourceManagementClient
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<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(ResourceManagementClientConfiguration, 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-resource/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id
Loading

0 comments on commit 424d682

Please sign in to comment.