Skip to content
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
1 change: 1 addition & 0 deletions azure-mgmt-resource/MANIFEST.in
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
19 changes: 0 additions & 19 deletions azure-mgmt-resource/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see
For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell

pip uninstall azure


Usage
=====

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
from .v2015_12_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def features(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
from .v2016_09_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def operations(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
from .v2016_09_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def authorization_operations(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,78 @@ def internal_paging(next_link=None, raw=False):

return deserialized
list_at_subscription_level.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks'}

def list_by_scope(
self, scope, filter=None, custom_headers=None, raw=False, **operation_config):
"""Gets all the management locks for a scope.

:param scope: The scope for the lock. When providing a scope for the
assignment, use '/subscriptions/{subscriptionId}' for subscriptions,
'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
for resource groups, and
'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}'
for resources.
:type scope: str
:param filter: The filter to apply on the operation.
:type filter: 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 ManagementLockObject
:rtype:
~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObjectPaged[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockObject]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_scope.metadata['url']
path_format_arguments = {
'scope': self._serialize.url("scope", scope, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, '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)
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.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies)

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

return deserialized
list_by_scope.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/locks'}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
from .v2018_05_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def policy_assignments(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
from .v2018_05_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def deployment_operations(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,28 @@ def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:

* 2016-06-01: :mod:`v2016_06_01.models<azure.mgmt.resource.subscriptions.v2016_06_01.models>`
* 2016-06-01: :mod:`v2018_06_01.models<azure.mgmt.resource.subscriptions.v2018_06_01.models>`
"""
if api_version == '2016-06-01':
from .v2016_06_01 import models
return models
elif api_version == '2016-06-01':
from .v2018_06_01 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

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

* 2016-06-01: :class:`Operations<azure.mgmt.resource.subscriptions.v2016_06_01.operations.Operations>`
* 2016-06-01: :class:`Operations<azure.mgmt.resource.subscriptions.v2018_06_01.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2016-06-01':
from .v2016_06_01.operations import Operations as OperationClass
elif api_version == '2016-06-01':
from .v2018_06_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 @@ -114,10 +121,13 @@ def subscriptions(self):
"""Instance depends on the API version:

* 2016-06-01: :class:`SubscriptionsOperations<azure.mgmt.resource.subscriptions.v2016_06_01.operations.SubscriptionsOperations>`
* 2016-06-01: :class:`SubscriptionsOperations<azure.mgmt.resource.subscriptions.v2018_06_01.operations.SubscriptionsOperations>`
"""
api_version = self._get_api_version('subscriptions')
if api_version == '2016-06-01':
from .v2016_06_01.operations import SubscriptionsOperations as OperationClass
elif api_version == '2016-06-01':
from .v2018_06_01.operations import SubscriptionsOperations 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 @@ -127,10 +137,13 @@ def tenants(self):
"""Instance depends on the API version:

* 2016-06-01: :class:`TenantsOperations<azure.mgmt.resource.subscriptions.v2016_06_01.operations.TenantsOperations>`
* 2016-06-01: :class:`TenantsOperations<azure.mgmt.resource.subscriptions.v2018_06_01.operations.TenantsOperations>`
"""
api_version = self._get_api_version('tenants')
if api_version == '2016-06-01':
from .v2016_06_01.operations import TenantsOperations as OperationClass
elif api_version == '2016-06-01':
from .v2018_06_01.operations import TenantsOperations 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
@@ -0,0 +1,18 @@
# 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 .subscription_client import SubscriptionClient
from .version import VERSION

__all__ = ['SubscriptionClient']

__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.
# --------------------------------------------------------------------------

try:
from .location_py3 import Location
from .subscription_policies_py3 import SubscriptionPolicies
from .subscription_py3 import Subscription
from .tenant_id_description_py3 import TenantIdDescription
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
except (SyntaxError, ImportError):
from .location import Location
from .subscription_policies import SubscriptionPolicies
from .subscription import Subscription
from .tenant_id_description import TenantIdDescription
from .operation_display import OperationDisplay
from .operation import Operation
from .operation_paged import OperationPaged
from .location_paged import LocationPaged
from .subscription_paged import SubscriptionPaged
from .tenant_id_description_paged import TenantIdDescriptionPaged
from .subscription_client_enums import (
SubscriptionState,
SpendingLimit,
)

__all__ = [
'Location',
'SubscriptionPolicies',
'Subscription',
'TenantIdDescription',
'OperationDisplay',
'Operation',
'OperationPaged',
'LocationPaged',
'SubscriptionPaged',
'TenantIdDescriptionPaged',
'SubscriptionState',
'SpendingLimit',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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 Location(Model):
"""Location information.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar id: The fully qualified ID of the location. For example,
/subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
:vartype id: str
:ivar subscription_id: The subscription ID.
:vartype subscription_id: str
:ivar name: The location name.
:vartype name: str
:ivar display_name: The display name of the location.
:vartype display_name: str
:ivar latitude: The latitude of the location.
:vartype latitude: str
:ivar longitude: The longitude of the location.
:vartype longitude: str
"""

_validation = {
'id': {'readonly': True},
'subscription_id': {'readonly': True},
'name': {'readonly': True},
'display_name': {'readonly': True},
'latitude': {'readonly': True},
'longitude': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'subscription_id': {'key': 'subscriptionId', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'display_name': {'key': 'displayName', 'type': 'str'},
'latitude': {'key': 'latitude', 'type': 'str'},
'longitude': {'key': 'longitude', 'type': 'str'},
}

def __init__(self, **kwargs):
super(Location, self).__init__(**kwargs)
self.id = None
self.subscription_id = None
self.name = None
self.display_name = None
self.latitude = None
self.longitude = 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 LocationPaged(Paged):
"""
A paging container for iterating over a list of :class:`Location <azure.mgmt.resource.subscriptions.v2018_06_01.models.Location>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Location]'}
}

def __init__(self, *args, **kwargs):

super(LocationPaged, self).__init__(*args, **kwargs)
Loading