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 resources/resource-manager] Change operationId of Microsoft.Authorization #3393

Merged
Merged
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
Expand Up @@ -107,6 +107,19 @@ def models(cls, api_version=DEFAULT_API_VERSION):
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def authorization_operations(self):
"""Instance depends on the API version:

* 2016-09-01: :class:`AuthorizationOperations<azure.mgmt.resource.locks.v2016_09_01.operations.AuthorizationOperations>`
"""
api_version = self._get_api_version('authorization_operations')
if api_version == '2016-09-01':
from .v2016_09_01.operations import AuthorizationOperations 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)))

@property
def management_locks(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
from .operations.authorization_operations import AuthorizationOperations
from .operations.management_locks_operations import ManagementLocksOperations
from . import models

Expand Down Expand Up @@ -58,6 +56,8 @@ class ManagementLockClient(SDKClient):
:ivar config: Configuration for client.
:vartype config: ManagementLockClientConfiguration

:ivar authorization_operations: AuthorizationOperations operations
:vartype authorization_operations: azure.mgmt.resource.locks.v2016_09_01.operations.AuthorizationOperations
:ivar management_locks: ManagementLocks operations
:vartype management_locks: azure.mgmt.resource.locks.v2016_09_01.operations.ManagementLocksOperations

Expand All @@ -80,65 +80,7 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.authorization_operations = AuthorizationOperations(
self._client, self.config, self._serialize, self._deserialize)
self.management_locks = ManagementLocksOperations(
self._client, self.config, self._serialize, self._deserialize)

def list_operations(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available Microsoft.Authorization 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<msrest:optionsforoperations>`.
:return: An iterator like instance of Operation
:rtype:
~azure.mgmt.resource.locks.v2016_09_01.models.OperationPaged[~azure.mgmt.resource.locks.v2016_09_01.models.Operation]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_operations.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)
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
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list_operations.metadata = {'url': '/providers/Microsoft.Authorization/operations'}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .authorization_operations import AuthorizationOperations
from .management_locks_operations import ManagementLocksOperations

__all__ = [
'AuthorizationOperations',
'ManagementLocksOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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 msrestazure.azure_exceptions import CloudError

from .. import models


class AuthorizationOperations(object):
"""AuthorizationOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: The API version to use for the operation. Constant value: "2016-09-01".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2016-09-01"

self.config = config

def list(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available Microsoft.Authorization 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<msrest:optionsforoperations>`.
:return: An iterator like instance of Operation
:rtype:
~azure.mgmt.resource.locks.v2016_09_01.models.OperationPaged[~azure.mgmt.resource.locks.v2016_09_01.models.Operation]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

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)
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
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list.metadata = {'url': '/providers/Microsoft.Authorization/operations'}