Skip to content
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
2 changes: 1 addition & 1 deletion azure-mgmt-resource/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is the Microsoft Azure Resource Management Client Library.
Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
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.management_locks_operations import ManagementLocksOperations
from . import models

Expand Down Expand Up @@ -79,3 +82,63 @@ def __init__(

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.Features/operations'}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
try:
from .management_lock_owner_py3 import ManagementLockOwner
from .management_lock_object_py3 import ManagementLockObject
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
except (SyntaxError, ImportError):
from .management_lock_owner import ManagementLockOwner
from .management_lock_object import ManagementLockObject
from .operation_display import OperationDisplay
from .operation import Operation
from .operation_paged import OperationPaged
from .management_lock_object_paged import ManagementLockObjectPaged
from .management_lock_client_enums import (
LockLevel,
Expand All @@ -23,6 +28,9 @@
__all__ = [
'ManagementLockOwner',
'ManagementLockObject',
'OperationDisplay',
'Operation',
'OperationPaged',
'ManagementLockObjectPaged',
'LockLevel',
]
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ class ManagementLockObject(Model):
:vartype id: str
:ivar type: The resource type of the lock - Microsoft.Authorization/locks.
:vartype type: str
:param name: The name of the lock.
:type name: str
:ivar name: The name of the lock.
:vartype name: str
"""

_validation = {
'level': {'required': True},
'id': {'readonly': True},
'type': {'readonly': True},
'name': {'readonly': True},
}

_attribute_map = {
Expand All @@ -63,4 +64,4 @@ def __init__(self, **kwargs):
self.owners = kwargs.get('owners', None)
self.id = None
self.type = None
self.name = kwargs.get('name', None)
self.name = None
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ class ManagementLockObject(Model):
:vartype id: str
:ivar type: The resource type of the lock - Microsoft.Authorization/locks.
:vartype type: str
:param name: The name of the lock.
:type name: str
:ivar name: The name of the lock.
:vartype name: str
"""

_validation = {
'level': {'required': True},
'id': {'readonly': True},
'type': {'readonly': True},
'name': {'readonly': True},
}

_attribute_map = {
Expand All @@ -56,11 +57,11 @@ class ManagementLockObject(Model):
'name': {'key': 'name', 'type': 'str'},
}

def __init__(self, *, level, notes: str=None, owners=None, name: str=None, **kwargs) -> None:
def __init__(self, *, level, notes: str=None, owners=None, **kwargs) -> None:
super(ManagementLockObject, self).__init__(**kwargs)
self.level = level
self.notes = notes
self.owners = owners
self.id = None
self.type = None
self.name = name
self.name = None
Original file line number Diff line number Diff line change
@@ -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 msrest.serialization import Model


class Operation(Model):
"""Microsoft.Authorization operation.

:param name: Operation name: {provider}/{resource}/{operation}
:type name: str
:param display: The object that represents the operation.
:type display:
~azure.mgmt.resource.locks.v2016_09_01.models.OperationDisplay
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}

def __init__(self, **kwargs):
super(Operation, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.display = kwargs.get('display', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 OperationDisplay(Model):
"""The object that represents the operation.

:param provider: Service provider: Microsoft.Authorization
:type provider: str
:param resource: Resource on which the operation is performed: Profile,
endpoint, etc.
:type resource: str
:param operation: Operation type: Read, write, delete, etc.
:type operation: str
"""

_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
}

def __init__(self, **kwargs):
super(OperationDisplay, self).__init__(**kwargs)
self.provider = kwargs.get('provider', None)
self.resource = kwargs.get('resource', None)
self.operation = kwargs.get('operation', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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 OperationDisplay(Model):
"""The object that represents the operation.

:param provider: Service provider: Microsoft.Authorization
:type provider: str
:param resource: Resource on which the operation is performed: Profile,
endpoint, etc.
:type resource: str
:param operation: Operation type: Read, write, delete, etc.
:type operation: str
"""

_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
}

def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None:
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
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 OperationPaged(Paged):
"""
A paging container for iterating over a list of :class:`Operation <azure.mgmt.resource.locks.v2016_09_01.models.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)
Original file line number Diff line number Diff line change
@@ -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 msrest.serialization import Model


class Operation(Model):
"""Microsoft.Authorization operation.

:param name: Operation name: {provider}/{resource}/{operation}
:type name: str
:param display: The object that represents the operation.
:type display:
~azure.mgmt.resource.locks.v2016_09_01.models.OperationDisplay
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}

def __init__(self, *, name: str=None, display=None, **kwargs) -> None:
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display
6 changes: 4 additions & 2 deletions azure-mgmt-resource/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
packages=find_packages(exclude=["tests"]),
install_requires=[
'msrestazure>=0.4.27,<2.0.0',
'azure-common~=1.1,>=1.1.9',
'msrest>=0.5.0',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
cmdclass=cmdclass
)