From 9a6a7eaa759c1c2c021e488a6f8ec9d4b1062c0c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 2 Oct 2018 00:05:37 +0000 Subject: [PATCH 1/2] Generated from 73f83b4c51d265aca17132381382f60da78d5f7a Fixing examples and adding missed properties --- .../costmanagement/cost_management_client.py | 5 + .../mgmt/costmanagement/models/__init__.py | 8 ++ .../mgmt/costmanagement/models/operation.py | 39 ++++++++ .../models/operation_display.py | 46 +++++++++ .../models/operation_display_py3.py | 46 +++++++++ .../costmanagement/models/operation_paged.py | 27 ++++++ .../costmanagement/models/operation_py3.py | 39 ++++++++ .../costmanagement/operations/__init__.py | 2 + .../costmanagement/operations/operations.py | 96 +++++++++++++++++++ 9 files changed, 308 insertions(+) create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display_py3.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_paged.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_py3.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/operations.py diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/cost_management_client.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/cost_management_client.py index ca11633b2d39..1ac9432eb07e 100644 --- a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/cost_management_client.py +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/cost_management_client.py @@ -19,6 +19,7 @@ from .operations.billing_account_dimensions_operations import BillingAccountDimensionsOperations from .operations.subscription_dimensions_operations import SubscriptionDimensionsOperations from .operations.resource_group_dimensions_operations import ResourceGroupDimensionsOperations +from .operations.operations import Operations from . import models @@ -68,6 +69,8 @@ class CostManagementClient(SDKClient): :vartype subscription_dimensions: azure.mgmt.costmanagement.operations.SubscriptionDimensionsOperations :ivar resource_group_dimensions: ResourceGroupDimensions operations :vartype resource_group_dimensions: azure.mgmt.costmanagement.operations.ResourceGroupDimensionsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.costmanagement.operations.Operations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -96,6 +99,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.resource_group_dimensions = ResourceGroupDimensionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) def query_subscription( self, parameters, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index b78e1d4f6727..71b14053e1a6 100644 --- a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -30,6 +30,8 @@ from .dimension_py3 import Dimension from .query_column_py3 import QueryColumn from .query_py3 import Query + from .operation_display_py3 import OperationDisplay + from .operation_py3 import Operation except (SyntaxError, ImportError): from .error_details import ErrorDetails from .error_response import ErrorResponse, ErrorResponseException @@ -51,8 +53,11 @@ from .dimension import Dimension from .query_column import QueryColumn from .query import Query + from .operation_display import OperationDisplay + from .operation import Operation from .dimension_paged import DimensionPaged from .query_paged import QueryPaged +from .operation_paged import OperationPaged from .cost_management_client_enums import ( StatusType, RecurrenceType, @@ -83,8 +88,11 @@ 'Dimension', 'QueryColumn', 'Query', + 'OperationDisplay', + 'Operation', 'DimensionPaged', 'QueryPaged', + 'OperationPaged', 'StatusType', 'RecurrenceType', 'FormatType', diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation.py new file mode 100644 index 000000000000..c5965e54743a --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation.py @@ -0,0 +1,39 @@ +# 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): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display.py new file mode 100644 index 000000000000..e85e6e2a6647 --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display.py @@ -0,0 +1,46 @@ +# 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. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.CostManagement. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Dimensions, + Query. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _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 = None + self.resource = None + self.operation = None diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display_py3.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display_py3.py new file mode 100644 index 000000000000..63ff2a7e14df --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_display_py3.py @@ -0,0 +1,46 @@ +# 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. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft.CostManagement. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Dimensions, + Query. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_paged.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_paged.py new file mode 100644 index 000000000000..2127f26e1525 --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_paged.py @@ -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 ` 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) diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_py3.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_py3.py new file mode 100644 index 000000000000..c69e983617b9 --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/operation_py3.py @@ -0,0 +1,39 @@ +# 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): + """A Cost management REST API operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.costmanagement.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py index 2ccef72c986f..93ee3e3ea6df 100644 --- a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py @@ -13,10 +13,12 @@ from .billing_account_dimensions_operations import BillingAccountDimensionsOperations from .subscription_dimensions_operations import SubscriptionDimensionsOperations from .resource_group_dimensions_operations import ResourceGroupDimensionsOperations +from .operations import Operations __all__ = [ 'ReportConfigOperations', 'BillingAccountDimensionsOperations', 'SubscriptionDimensionsOperations', 'ResourceGroupDimensionsOperations', + 'Operations', ] diff --git a/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/operations.py b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/operations.py new file mode 100644 index 000000000000..aa2c9606c7ee --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/operations.py @@ -0,0 +1,96 @@ +# 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 .. import models + + +class Operations(object): + """Operations 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: Version of the API to be used with the client request. The current version is 2018-05-31. Constant value: "2018-05-31". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-31" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available consumption 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`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.costmanagement.models.OperationPaged[~azure.mgmt.costmanagement.models.Operation] + :raises: + :class:`ErrorResponseException` + """ + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + 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.CostManagement/operations'} From ef1f6b724770291f430699e29234bdfe2367adb0 Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Tue, 2 Oct 2018 00:10:49 +0000 Subject: [PATCH 2/2] Packaging update of azure-mgmt-costmanagement --- azure-mgmt-costmanagement/HISTORY.rst | 9 ++ azure-mgmt-costmanagement/MANIFEST.in | 1 + azure-mgmt-costmanagement/README.rst | 49 +++++++++++ azure-mgmt-costmanagement/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + azure-mgmt-costmanagement/sdk_packaging.toml | 7 ++ azure-mgmt-costmanagement/setup.cfg | 2 + azure-mgmt-costmanagement/setup.py | 87 +++++++++++++++++++ 8 files changed, 157 insertions(+) create mode 100644 azure-mgmt-costmanagement/HISTORY.rst create mode 100644 azure-mgmt-costmanagement/MANIFEST.in create mode 100644 azure-mgmt-costmanagement/README.rst create mode 100644 azure-mgmt-costmanagement/azure/__init__.py create mode 100644 azure-mgmt-costmanagement/azure/mgmt/__init__.py create mode 100644 azure-mgmt-costmanagement/sdk_packaging.toml create mode 100644 azure-mgmt-costmanagement/setup.cfg create mode 100644 azure-mgmt-costmanagement/setup.py diff --git a/azure-mgmt-costmanagement/HISTORY.rst b/azure-mgmt-costmanagement/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/azure-mgmt-costmanagement/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-costmanagement/MANIFEST.in b/azure-mgmt-costmanagement/MANIFEST.in new file mode 100644 index 000000000000..bb37a2723dae --- /dev/null +++ b/azure-mgmt-costmanagement/MANIFEST.in @@ -0,0 +1 @@ +include *.rst diff --git a/azure-mgmt-costmanagement/README.rst b/azure-mgmt-costmanagement/README.rst new file mode 100644 index 000000000000..45de4e6b43dd --- /dev/null +++ b/azure-mgmt-costmanagement/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure MyService 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, 3.6 and 3.7. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `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 +===== + +For code examples, see `MyService Management +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. diff --git a/azure-mgmt-costmanagement/azure/__init__.py b/azure-mgmt-costmanagement/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/azure-mgmt-costmanagement/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-costmanagement/azure/mgmt/__init__.py b/azure-mgmt-costmanagement/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/azure-mgmt-costmanagement/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-costmanagement/sdk_packaging.toml b/azure-mgmt-costmanagement/sdk_packaging.toml new file mode 100644 index 000000000000..bd14e24054ab --- /dev/null +++ b/azure-mgmt-costmanagement/sdk_packaging.toml @@ -0,0 +1,7 @@ +[packaging] +package_name = "azure-mgmt-costmanagement" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true diff --git a/azure-mgmt-costmanagement/setup.cfg b/azure-mgmt-costmanagement/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/azure-mgmt-costmanagement/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/azure-mgmt-costmanagement/setup.py b/azure-mgmt-costmanagement/setup.py new file mode 100644 index 000000000000..4161d00c6322 --- /dev/null +++ b/azure-mgmt-costmanagement/setup.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-costmanagement" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + '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', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +)