From 5707ce03172b0735254c3dd6216495bd8304fe4b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 22 Feb 2018 17:26:09 -0800 Subject: [PATCH 1/4] Generated from bd24c6b3cba8ae74a6ea020cf5cda7562c86903a (#2047) locationbasedservices py conf --- .../mgmt/locationbasedservices/__init__.py | 18 + .../mgmt/locationbasedservices/client.py | 85 +++ .../locationbasedservices/models/__init__.py | 46 ++ .../models/client_enums.py | 18 + .../locationbasedservices/models/error.py | 65 ++ .../models/error_details_item.py | 45 ++ .../models/location_based_services_account.py | 64 ++ ...ased_services_account_create_parameters.py | 45 ++ .../location_based_services_account_keys.py | 49 ++ .../location_based_services_account_paged.py | 27 + ...ased_services_account_update_parameters.py | 36 + ...on_based_services_accounts_move_request.py | 38 + ...cation_based_services_key_specification.py | 33 + ...on_based_services_operations_value_item.py | 45 ++ ..._services_operations_value_item_display.py | 51 ++ ...ed_services_operations_value_item_paged.py | 27 + .../locationbasedservices/models/resource.py | 47 ++ .../mgmt/locationbasedservices/models/sku.py | 40 + .../operations/__init__.py | 16 + .../operations/accounts_operations.py | 701 ++++++++++++++++++ .../mgmt/locationbasedservices/version.py | 13 + 21 files changed, 1509 insertions(+) create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error_details_item.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_create_parameters.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_keys.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_paged.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_update_parameters.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_accounts_move_request.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_key_specification.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_display.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_paged.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/resource.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/sku.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/__init__.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/accounts_operations.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/version.py diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py new file mode 100644 index 000000000000..59c8ad3d6bce --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py @@ -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 .client import Client +from .version import VERSION + +__all__ = ['Client'] + +__version__ = VERSION + diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py new file mode 100644 index 000000000000..5096c5164041 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py @@ -0,0 +1,85 @@ +# 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.service_client import ServiceClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.accounts_operations import AccountsOperations +from . import models + + +class ClientConfiguration(AzureConfiguration): + """Configuration for Client + 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` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :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(ClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-locationbasedservices/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class Client(object): + """Resource Provider + + :ivar config: Configuration for client. + :vartype config: ClientConfiguration + + :ivar accounts: Accounts operations + :vartype accounts: azure.mgmt.locationbasedservices.operations.AccountsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ClientConfiguration(credentials, subscription_id, base_url) + self._client = ServiceClient(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-01-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.accounts = AccountsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py new file mode 100644 index 000000000000..30f680f4ef64 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.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 .error_details_item import ErrorDetailsItem +from .error import Error, ErrorException +from .resource import Resource +from .sku import Sku +from .location_based_services_account import LocationBasedServicesAccount +from .location_based_services_account_create_parameters import LocationBasedServicesAccountCreateParameters +from .location_based_services_account_update_parameters import LocationBasedServicesAccountUpdateParameters +from .location_based_services_accounts_move_request import LocationBasedServicesAccountsMoveRequest +from .location_based_services_key_specification import LocationBasedServicesKeySpecification +from .location_based_services_account_keys import LocationBasedServicesAccountKeys +from .location_based_services_operations_value_item_display import LocationBasedServicesOperationsValueItemDisplay +from .location_based_services_operations_value_item import LocationBasedServicesOperationsValueItem +from .location_based_services_account_paged import LocationBasedServicesAccountPaged +from .location_based_services_operations_value_item_paged import LocationBasedServicesOperationsValueItemPaged +from .client_enums import ( + KeyType, +) + +__all__ = [ + 'ErrorDetailsItem', + 'Error', 'ErrorException', + 'Resource', + 'Sku', + 'LocationBasedServicesAccount', + 'LocationBasedServicesAccountCreateParameters', + 'LocationBasedServicesAccountUpdateParameters', + 'LocationBasedServicesAccountsMoveRequest', + 'LocationBasedServicesKeySpecification', + 'LocationBasedServicesAccountKeys', + 'LocationBasedServicesOperationsValueItemDisplay', + 'LocationBasedServicesOperationsValueItem', + 'LocationBasedServicesAccountPaged', + 'LocationBasedServicesOperationsValueItemPaged', + 'KeyType', +] diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py new file mode 100644 index 000000000000..44f109853efd --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py @@ -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 enum import Enum + + +class KeyType(Enum): + + primary = "primary" + secondary = "secondary" diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error.py new file mode 100644 index 000000000000..0c26ae0a5e64 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error.py @@ -0,0 +1,65 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class Error(Model): + """This object is returned when an error occurs in the Location Based Service + API. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: If available, a human readable description of the error. + :vartype message: str + :ivar target: If available, the component generating the error. + :vartype target: str + :ivar details: If available, a list of additional details about the error. + :vartype details: + list[~azure.mgmt.locationbasedservices.models.ErrorDetailsItem] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetailsItem]'}, + } + + def __init__(self): + super(Error, self).__init__() + self.code = None + self.message = None + self.target = None + self.details = None + + +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error_details_item.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error_details_item.py new file mode 100644 index 000000000000..42124e681fba --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/error_details_item.py @@ -0,0 +1,45 @@ +# 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 ErrorDetailsItem(Model): + """ErrorDetailsItem. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: If available, a human readable description of the error. + :vartype message: str + :ivar target: If available, the component generating the error. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__(self): + super(ErrorDetailsItem, self).__init__() + self.code = None + self.message = None + self.target = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account.py new file mode 100644 index 000000000000..a5a73ad9fe87 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account.py @@ -0,0 +1,64 @@ +# 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 .resource import Resource + + +class LocationBasedServicesAccount(Resource): + """An Azure resource which represents access to a suite of Location Based + Services REST APIs. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified Location Based Services Account resource + identifier. + :vartype id: str + :ivar name: The name of the Location Based Services Account, which is + unique within a Resource Group. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: The location of the resource. + :vartype location: str + :ivar tags: Gets a list of key value pairs that describe the resource. + These tags can be used in viewing and grouping this resource (across + resource groups). A maximum of 15 tags can be provided for a resource. + Each tag must have a key no greater than 128 characters and value no + greater than 256 characters. + :vartype tags: dict[str, str] + :ivar sku: The SKU of this account. + :vartype sku: ~azure.mgmt.locationbasedservices.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'sku': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self): + super(LocationBasedServicesAccount, self).__init__() + self.location = None + self.tags = None + self.sku = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_create_parameters.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_create_parameters.py new file mode 100644 index 000000000000..773d73daec9f --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_create_parameters.py @@ -0,0 +1,45 @@ +# 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 LocationBasedServicesAccountCreateParameters(Model): + """Parameters used to create a new Location Based Services Account. + + :param location: The location of the resource. + :type location: str + :param tags: Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource + (across resource groups). A maximum of 15 tags can be provided for a + resource. Each tag must have a key no greater than 128 characters and + value no greater than 256 characters. + :type tags: dict[str, str] + :param sku: The SKU of this account. + :type sku: ~azure.mgmt.locationbasedservices.models.Sku + """ + + _validation = { + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, location, sku, tags=None): + super(LocationBasedServicesAccountCreateParameters, self).__init__() + self.location = location + self.tags = tags + self.sku = sku diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_keys.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_keys.py new file mode 100644 index 000000000000..5a059e0ec87f --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_keys.py @@ -0,0 +1,49 @@ +# 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 LocationBasedServicesAccountKeys(Model): + """The set of keys which can be used to access the Location Based Services + REST APIs. Two keys are provided for key rotation without interruption. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The full Azure resource identifier of the Location Based + Services Account. + :vartype id: str + :ivar primary_key: The primary key for accessing the Location Based + Services REST APIs. + :vartype primary_key: str + :ivar secondary_key: The secondary key for accessing the Location Based + Services REST APIs. + :vartype secondary_key: str + """ + + _validation = { + 'id': {'readonly': True}, + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__(self): + super(LocationBasedServicesAccountKeys, self).__init__() + self.id = None + self.primary_key = None + self.secondary_key = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_paged.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_paged.py new file mode 100644 index 000000000000..e89fa7e671c7 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_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 LocationBasedServicesAccountPaged(Paged): + """ + A paging container for iterating over a list of :class:`LocationBasedServicesAccount ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LocationBasedServicesAccount]'} + } + + def __init__(self, *args, **kwargs): + + super(LocationBasedServicesAccountPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_update_parameters.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_update_parameters.py new file mode 100644 index 000000000000..0197419d7467 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_account_update_parameters.py @@ -0,0 +1,36 @@ +# 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 LocationBasedServicesAccountUpdateParameters(Model): + """Parameters used to update an existing Location Based Services Account. + + :param tags: Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource + (across resource groups). A maximum of 15 tags can be provided for a + resource. Each tag must have a key no greater than 128 characters and + value no greater than 256 characters. + :type tags: dict[str, str] + :param sku: The SKU of this account. + :type sku: ~azure.mgmt.locationbasedservices.models.Sku + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__(self, tags=None, sku=None): + super(LocationBasedServicesAccountUpdateParameters, self).__init__() + self.tags = tags + self.sku = sku diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_accounts_move_request.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_accounts_move_request.py new file mode 100644 index 000000000000..853ff78ced48 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_accounts_move_request.py @@ -0,0 +1,38 @@ +# 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 LocationBasedServicesAccountsMoveRequest(Model): + """The description of what resources to move between resource groups. + + :param target_resource_group: The name of the destination resource group. + :type target_resource_group: str + :param resource_ids: A list of resource names to move from the source + resource group. + :type resource_ids: list[str] + """ + + _validation = { + 'target_resource_group': {'required': True}, + 'resource_ids': {'required': True}, + } + + _attribute_map = { + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + 'resource_ids': {'key': 'resourceIds', 'type': '[str]'}, + } + + def __init__(self, target_resource_group, resource_ids): + super(LocationBasedServicesAccountsMoveRequest, self).__init__() + self.target_resource_group = target_resource_group + self.resource_ids = resource_ids diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_key_specification.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_key_specification.py new file mode 100644 index 000000000000..9e1fce87d194 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_key_specification.py @@ -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 LocationBasedServicesKeySpecification(Model): + """Whether the operation refers to the primary or secondary key. + + :param key_type: Whether the operation refers to the primary or secondary + key. Possible values include: 'primary', 'secondary' + :type key_type: str or ~azure.mgmt.locationbasedservices.models.KeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__(self, key_type): + super(LocationBasedServicesKeySpecification, self).__init__() + self.key_type = key_type diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item.py new file mode 100644 index 000000000000..a5e05706d5ee --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item.py @@ -0,0 +1,45 @@ +# 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 LocationBasedServicesOperationsValueItem(Model): + """LocationBasedServicesOperationsValueItem. + + 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 human-readable description of the operation. + :type display: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesOperationsValueItemDisplay + :ivar origin: The origin of the operation. + :vartype origin: str + """ + + _validation = { + 'name': {'readonly': True}, + 'origin': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'LocationBasedServicesOperationsValueItemDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, display=None): + super(LocationBasedServicesOperationsValueItem, self).__init__() + self.name = None + self.display = display + self.origin = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_display.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_display.py new file mode 100644 index 000000000000..3473647d200d --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_display.py @@ -0,0 +1,51 @@ +# 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 LocationBasedServicesOperationsValueItemDisplay(Model): + """The human-readable description of the operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: Service provider: Microsoft Location Based Services. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: The action that users can perform, based on their + permission level. + :vartype operation: str + :ivar description: The description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self): + super(LocationBasedServicesOperationsValueItemDisplay, self).__init__() + self.provider = None + self.resource = None + self.operation = None + self.description = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_paged.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_paged.py new file mode 100644 index 000000000000..ab4852e643a9 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_operations_value_item_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 LocationBasedServicesOperationsValueItemPaged(Paged): + """ + A paging container for iterating over a list of :class:`LocationBasedServicesOperationsValueItem ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[LocationBasedServicesOperationsValueItem]'} + } + + def __init__(self, *args, **kwargs): + + super(LocationBasedServicesOperationsValueItemPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/resource.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/resource.py new file mode 100644 index 000000000000..34a15d75a448 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/resource.py @@ -0,0 +1,47 @@ +# 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 Resource(Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified Location Based Services Account resource + identifier. + :vartype id: str + :ivar name: The name of the Location Based Services Account, which is + unique within a Resource Group. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self): + super(Resource, self).__init__() + self.id = None + self.name = None + self.type = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/sku.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/sku.py new file mode 100644 index 000000000000..908e3f11493d --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/sku.py @@ -0,0 +1,40 @@ +# 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 Sku(Model): + """The SKU of the Location Based Services Account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The name of the SKU, in standard format (such as S0). + :type name: str + :ivar tier: Gets the sku tier. This is based on the SKU name. + :vartype tier: str + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__(self, name): + super(Sku, self).__init__() + self.name = name + self.tier = None diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/__init__.py new file mode 100644 index 000000000000..4de259788320 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/__init__.py @@ -0,0 +1,16 @@ +# 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 .accounts_operations import AccountsOperations + +__all__ = [ + 'AccountsOperations', +] diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/accounts_operations.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/accounts_operations.py new file mode 100644 index 000000000000..f70fe64266ac --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/operations/accounts_operations.py @@ -0,0 +1,701 @@ +# 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 AccountsOperations(object): + """AccountsOperations 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: Client Api Version. Constant value: "2017-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-01-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, account_name, location_based_services_account_create_parameters, custom_headers=None, raw=False, **operation_config): + """Create or update a Location Based Services Account. A Location Based + Services Account holds the keys which allow access to the Location + Based Services REST APIs. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: str + :param location_based_services_account_create_parameters: The new or + updated parameters for the Location Based Services Account. + :type location_based_services_account_create_parameters: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccountCreateParameters + :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: LocationBasedServicesAccount or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccount + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(location_based_services_account_create_parameters, 'LocationBasedServicesAccountCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationBasedServicesAccount', response) + if response.status_code == 201: + deserialized = self._deserialize('LocationBasedServicesAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}'} + + def update( + self, resource_group_name, account_name, tags=None, sku=None, custom_headers=None, raw=False, **operation_config): + """Updates a Location Based Services Account. Only a subset of the + parameters may be updated after creation, such as Sku and Tags. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: str + :param tags: Gets or sets a list of key value pairs that describe the + resource. These tags can be used in viewing and grouping this resource + (across resource groups). A maximum of 15 tags can be provided for a + resource. Each tag must have a key no greater than 128 characters and + value no greater than 256 characters. + :type tags: dict[str, str] + :param sku: The SKU of this account. + :type sku: ~azure.mgmt.locationbasedservices.models.Sku + :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: LocationBasedServicesAccount or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccount + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + location_based_services_account_update_parameters = models.LocationBasedServicesAccountUpdateParameters(tags=tags, sku=sku) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(location_based_services_account_update_parameters, 'LocationBasedServicesAccountUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationBasedServicesAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}'} + + def delete( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Delete a Location Based Services Account. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: 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`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}'} + + def get( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Get a Location Based Services Account. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: 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`. + :return: LocationBasedServicesAccount or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccount + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationBasedServicesAccount', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Get all Location Based Services Accounts in a Resource Group. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: 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`. + :return: An iterator like instance of LocationBasedServicesAccount + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccountPaged[~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccount] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.LocationBasedServicesAccountPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LocationBasedServicesAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Get all Location Based Services Accounts in a Subscription. + + :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 LocationBasedServicesAccount + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccountPaged[~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccount] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.LocationBasedServicesAccountPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LocationBasedServicesAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.LocationBasedServices/accounts'} + + def move( + self, resource_group_name, target_resource_group, resource_ids, custom_headers=None, raw=False, **operation_config): + """Moves Location Based Services Accounts from one ResourceGroup (or + Subscription) to another. + + :param resource_group_name: The name of the resource group that + contains Location Based Services Account to move. + :type resource_group_name: str + :param target_resource_group: The name of the destination resource + group. + :type target_resource_group: str + :param resource_ids: A list of resource names to move from the source + resource group. + :type resource_ids: list[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`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + move_request = models.LocationBasedServicesAccountsMoveRequest(target_resource_group=target_resource_group, resource_ids=resource_ids) + + # Construct URL + url = self.move.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(move_request, 'LocationBasedServicesAccountsMoveRequest') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources'} + + def list_keys( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Get the keys to use with the Location Based Services APIs. A key is + used to authenticate and authorize access to the Location Based + Services REST APIs. Only one key is needed at a time; two are given to + provide seamless key regeneration. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: 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`. + :return: LocationBasedServicesAccountKeys or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccountKeys + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationBasedServicesAccountKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}/listKeys'} + + def regenerate_keys( + self, resource_group_name, account_name, key_type, custom_headers=None, raw=False, **operation_config): + """Regenerate either the primary or secondary key for use with the + Location Based Services APIs. The old key will stop working + immediately. + + :param resource_group_name: The name of the Azure Resource Group. + :type resource_group_name: str + :param account_name: The name of the Location Based Services Account. + :type account_name: str + :param key_type: Whether the operation refers to the primary or + secondary key. Possible values include: 'primary', 'secondary' + :type key_type: str or + ~azure.mgmt.locationbasedservices.models.KeyType + :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: LocationBasedServicesAccountKeys or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesAccountKeys + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + key_specification = models.LocationBasedServicesKeySpecification(key_type=key_type) + + # Construct URL + url = self.regenerate_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(key_specification, 'LocationBasedServicesKeySpecification') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationBasedServicesAccountKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LocationBasedServices/accounts/{accountName}/regenerateKey'} + + def list_operations( + self, custom_headers=None, raw=False, **operation_config): + """List operations available for the Location Based Services Resource + Provider. + + :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 + LocationBasedServicesOperationsValueItem + :rtype: + ~azure.mgmt.locationbasedservices.models.LocationBasedServicesOperationsValueItemPaged[~azure.mgmt.locationbasedservices.models.LocationBasedServicesOperationsValueItem] + :raises: + :class:`ErrorException` + """ + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.LocationBasedServicesOperationsValueItemPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LocationBasedServicesOperationsValueItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_operations.metadata = {'url': '/providers/Microsoft.LocationBasedServices/operations'} diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/version.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + From 98bd0c7cb360743f3f02a6c138296809e1bcb1b6 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Fri, 23 Feb 2018 08:44:26 -0800 Subject: [PATCH 2/4] azure-mgmt-locationbasedservices packaging --- .github/CODEOWNERS | 1 + azure-mgmt-locationbasedservices/HISTORY.rst | 9 + azure-mgmt-locationbasedservices/MANIFEST.in | 2 + azure-mgmt-locationbasedservices/README.rst | 49 ++ .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure_bdist_wheel.py | 533 ++++++++++++++++++ azure-mgmt-locationbasedservices/setup.cfg | 3 + azure-mgmt-locationbasedservices/setup.py | 84 +++ 9 files changed, 683 insertions(+) create mode 100644 azure-mgmt-locationbasedservices/HISTORY.rst create mode 100644 azure-mgmt-locationbasedservices/MANIFEST.in create mode 100644 azure-mgmt-locationbasedservices/README.rst create mode 100644 azure-mgmt-locationbasedservices/azure/__init__.py create mode 100644 azure-mgmt-locationbasedservices/azure/mgmt/__init__.py create mode 100644 azure-mgmt-locationbasedservices/azure_bdist_wheel.py create mode 100644 azure-mgmt-locationbasedservices/setup.cfg create mode 100644 azure-mgmt-locationbasedservices/setup.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 62ca1becb1c4..3dba799e3176 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,6 +16,7 @@ /azure-mgmt-datalake-store/ @ro-joowan /azure-mgmt-eventgrid/ @kalyanaj /azure-mgmt-keyvault/ @schaabs +/azure-mgmt-locationbasedservices/ @jp94 /azure-mgmt-machinelearningcompute/ @shutchings /azure-mgmt-recoveryservicesbackup/ @dragonfly91 /azure-mgmt-servicefabric/ @QingChenmsft diff --git a/azure-mgmt-locationbasedservices/HISTORY.rst b/azure-mgmt-locationbasedservices/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/azure-mgmt-locationbasedservices/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-locationbasedservices/MANIFEST.in b/azure-mgmt-locationbasedservices/MANIFEST.in new file mode 100644 index 000000000000..9ecaeb15de50 --- /dev/null +++ b/azure-mgmt-locationbasedservices/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst +include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-locationbasedservices/README.rst b/azure-mgmt-locationbasedservices/README.rst new file mode 100644 index 000000000000..c1b281f526fe --- /dev/null +++ b/azure-mgmt-locationbasedservices/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure Location Based Services 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. + +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 `Location Based Services +`__ +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-locationbasedservices/azure/__init__.py b/azure-mgmt-locationbasedservices/azure/__init__.py new file mode 100644 index 000000000000..849489fca33c --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/__init__.py new file mode 100644 index 000000000000..849489fca33c --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-locationbasedservices/azure_bdist_wheel.py b/azure-mgmt-locationbasedservices/azure_bdist_wheel.py new file mode 100644 index 000000000000..61ec571a9743 --- /dev/null +++ b/azure-mgmt-locationbasedservices/azure_bdist_wheel.py @@ -0,0 +1,533 @@ +""" +"wheel" copyright (c) 2012-2017 Daniel Holth and +contributors. + +The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Create a Azure wheel (.whl) distribution (a wheel is a built archive format). + +This file is a copy of the official bdist_wheel file from wheel 0.30.0a0, enhanced +of the bottom with some Microsoft extension for Azure SDK for Python + +""" + +import csv +import hashlib +import os +import subprocess +import warnings +import shutil +import json +import sys + +try: + import sysconfig +except ImportError: # pragma nocover + # Python < 2.7 + import distutils.sysconfig as sysconfig + +import pkg_resources + +safe_name = pkg_resources.safe_name +safe_version = pkg_resources.safe_version + +from shutil import rmtree +from email.generator import Generator + +from distutils.core import Command +from distutils.sysconfig import get_python_version + +from distutils import log as logger + +from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag, get_platform +from wheel.util import native, open_for_csv +from wheel.archive import archive_wheelfile +from wheel.pkginfo import read_pkg_info, write_pkg_info +from wheel.metadata import pkginfo_to_dict +from wheel import pep425tags, metadata +from wheel import __version__ as wheel_version + +def safer_name(name): + return safe_name(name).replace('-', '_') + +def safer_version(version): + return safe_version(version).replace('-', '_') + +class bdist_wheel(Command): + + description = 'create a wheel distribution' + + user_options = [('bdist-dir=', 'b', + "temporary directory for creating the distribution"), + ('plat-name=', 'p', + "platform name to embed in generated filenames " + "(default: %s)" % get_platform()), + ('keep-temp', 'k', + "keep the pseudo-installation tree around after " + + "creating the distribution archive"), + ('dist-dir=', 'd', + "directory to put final built distributions in"), + ('skip-build', None, + "skip rebuilding everything (for testing/debugging)"), + ('relative', None, + "build the archive using relative paths" + "(default: false)"), + ('owner=', 'u', + "Owner name used when creating a tar file" + " [default: current user]"), + ('group=', 'g', + "Group name used when creating a tar file" + " [default: current group]"), + ('universal', None, + "make a universal wheel" + " (default: false)"), + ('python-tag=', None, + "Python implementation compatibility tag" + " (default: py%s)" % get_impl_ver()[0]), + ] + + boolean_options = ['keep-temp', 'skip-build', 'relative', 'universal'] + + def initialize_options(self): + self.bdist_dir = None + self.data_dir = None + self.plat_name = None + self.plat_tag = None + self.format = 'zip' + self.keep_temp = False + self.dist_dir = None + self.distinfo_dir = None + self.egginfo_dir = None + self.root_is_pure = None + self.skip_build = None + self.relative = False + self.owner = None + self.group = None + self.universal = False + self.python_tag = 'py' + get_impl_ver()[0] + self.plat_name_supplied = False + + def finalize_options(self): + if self.bdist_dir is None: + bdist_base = self.get_finalized_command('bdist').bdist_base + self.bdist_dir = os.path.join(bdist_base, 'wheel') + + self.data_dir = self.wheel_dist_name + '.data' + self.plat_name_supplied = self.plat_name is not None + + need_options = ('dist_dir', 'plat_name', 'skip_build') + + self.set_undefined_options('bdist', + *zip(need_options, need_options)) + + self.root_is_pure = not (self.distribution.has_ext_modules() + or self.distribution.has_c_libraries()) + + # Support legacy [wheel] section for setting universal + wheel = self.distribution.get_option_dict('wheel') + if 'universal' in wheel: + # please don't define this in your global configs + val = wheel['universal'][1].strip() + if val.lower() in ('1', 'true', 'yes'): + self.universal = True + + @property + def wheel_dist_name(self): + """Return distribution full name with - replaced with _""" + return '-'.join((safer_name(self.distribution.get_name()), + safer_version(self.distribution.get_version()))) + + def get_tag(self): + # bdist sets self.plat_name if unset, we should only use it for purepy + # wheels if the user supplied it. + if self.plat_name_supplied: + plat_name = self.plat_name + elif self.root_is_pure: + plat_name = 'any' + else: + plat_name = self.plat_name or get_platform() + if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647: + plat_name = 'linux_i686' + plat_name = plat_name.replace('-', '_').replace('.', '_') + + + if self.root_is_pure: + if self.universal: + impl = 'py2.py3' + else: + impl = self.python_tag + tag = (impl, 'none', plat_name) + else: + impl_name = get_abbr_impl() + impl_ver = get_impl_ver() + # PEP 3149 + abi_tag = str(get_abi_tag()).lower() + tag = (impl_name + impl_ver, abi_tag, plat_name) + supported_tags = pep425tags.get_supported( + supplied_platform=plat_name if self.plat_name_supplied else None) + # XXX switch to this alternate implementation for non-pure: + assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0]) + return tag + + def get_archive_basename(self): + """Return archive name without extension""" + + impl_tag, abi_tag, plat_tag = self.get_tag() + + archive_basename = "%s-%s-%s-%s" % ( + self.wheel_dist_name, + impl_tag, + abi_tag, + plat_tag) + return archive_basename + + def run(self): + build_scripts = self.reinitialize_command('build_scripts') + build_scripts.executable = 'python' + + if not self.skip_build: + self.run_command('build') + + install = self.reinitialize_command('install', + reinit_subcommands=True) + install.root = self.bdist_dir + install.compile = False + install.skip_build = self.skip_build + install.warn_dir = False + + # A wheel without setuptools scripts is more cross-platform. + # Use the (undocumented) `no_ep` option to setuptools' + # install_scripts command to avoid creating entry point scripts. + install_scripts = self.reinitialize_command('install_scripts') + install_scripts.no_ep = True + + # Use a custom scheme for the archive, because we have to decide + # at installation time which scheme to use. + for key in ('headers', 'scripts', 'data', 'purelib', 'platlib'): + setattr(install, + 'install_' + key, + os.path.join(self.data_dir, key)) + + basedir_observed = '' + + if os.name == 'nt': + # win32 barfs if any of these are ''; could be '.'? + # (distutils.command.install:change_roots bug) + basedir_observed = os.path.normpath(os.path.join(self.data_dir, '..')) + self.install_libbase = self.install_lib = basedir_observed + + setattr(install, + 'install_purelib' if self.root_is_pure else 'install_platlib', + basedir_observed) + + logger.info("installing to %s", self.bdist_dir) + + self.run_command('install') + + archive_basename = self.get_archive_basename() + + pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) + if not self.relative: + archive_root = self.bdist_dir + else: + archive_root = os.path.join( + self.bdist_dir, + self._ensure_relative(install.install_base)) + + self.set_undefined_options( + 'install_egg_info', ('target', 'egginfo_dir')) + self.distinfo_dir = os.path.join(self.bdist_dir, + '%s.dist-info' % self.wheel_dist_name) + self.egg2dist(self.egginfo_dir, + self.distinfo_dir) + + self.write_wheelfile(self.distinfo_dir) + + self.write_record(self.bdist_dir, self.distinfo_dir) + + # Make the archive + if not os.path.exists(self.dist_dir): + os.makedirs(self.dist_dir) + wheel_name = archive_wheelfile(pseudoinstall_root, archive_root) + + # Sign the archive + if 'WHEEL_TOOL' in os.environ: + subprocess.call([os.environ['WHEEL_TOOL'], 'sign', wheel_name]) + + # Add to 'Distribution.dist_files' so that the "upload" command works + getattr(self.distribution, 'dist_files', []).append( + ('bdist_wheel', get_python_version(), wheel_name)) + + if not self.keep_temp: + if self.dry_run: + logger.info('removing %s', self.bdist_dir) + else: + rmtree(self.bdist_dir) + + def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): + from email.message import Message + msg = Message() + msg['Wheel-Version'] = '1.0' # of the spec + msg['Generator'] = generator + msg['Root-Is-Purelib'] = str(self.root_is_pure).lower() + + # Doesn't work for bdist_wininst + impl_tag, abi_tag, plat_tag = self.get_tag() + for impl in impl_tag.split('.'): + for abi in abi_tag.split('.'): + for plat in plat_tag.split('.'): + msg['Tag'] = '-'.join((impl, abi, plat)) + + wheelfile_path = os.path.join(wheelfile_base, 'WHEEL') + logger.info('creating %s', wheelfile_path) + with open(wheelfile_path, 'w') as f: + Generator(f, maxheaderlen=0).flatten(msg) + + def _ensure_relative(self, path): + # copied from dir_util, deleted + drive, path = os.path.splitdrive(path) + if path[0:1] == os.sep: + path = drive + path[1:] + return path + + def _pkginfo_to_metadata(self, egg_info_path, pkginfo_path): + return metadata.pkginfo_to_metadata(egg_info_path, pkginfo_path) + + def license_file(self): + """Return license filename from a license-file key in setup.cfg, or None.""" + metadata = self.distribution.get_option_dict('metadata') + if not 'license_file' in metadata: + return None + return metadata['license_file'][1] + + def setupcfg_requirements(self): + """Generate requirements from setup.cfg as + ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata + section in setup.cfg: + + [metadata] + provides-extra = extra1 + extra2 + requires-dist = requirement; qualifier + another; qualifier2 + unqualified + + Yields + + ('Provides-Extra', 'extra1'), + ('Provides-Extra', 'extra2'), + ('Requires-Dist', 'requirement; qualifier'), + ('Requires-Dist', 'another; qualifier2'), + ('Requires-Dist', 'unqualified') + """ + metadata = self.distribution.get_option_dict('metadata') + + # our .ini parser folds - to _ in key names: + for key, title in (('provides_extra', 'Provides-Extra'), + ('requires_dist', 'Requires-Dist')): + if not key in metadata: + continue + field = metadata[key] + for line in field[1].splitlines(): + line = line.strip() + if not line: + continue + yield (title, line) + + def add_requirements(self, metadata_path): + """Add additional requirements from setup.cfg to file metadata_path""" + additional = list(self.setupcfg_requirements()) + if not additional: return + pkg_info = read_pkg_info(metadata_path) + if 'Provides-Extra' in pkg_info or 'Requires-Dist' in pkg_info: + warnings.warn('setup.cfg requirements overwrite values from setup.py') + del pkg_info['Provides-Extra'] + del pkg_info['Requires-Dist'] + for k, v in additional: + pkg_info[k] = v + write_pkg_info(metadata_path, pkg_info) + + def egg2dist(self, egginfo_path, distinfo_path): + """Convert an .egg-info directory into a .dist-info directory""" + def adios(p): + """Appropriately delete directory, file or link.""" + if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p): + shutil.rmtree(p) + elif os.path.exists(p): + os.unlink(p) + + adios(distinfo_path) + + if not os.path.exists(egginfo_path): + # There is no egg-info. This is probably because the egg-info + # file/directory is not named matching the distribution name used + # to name the archive file. Check for this case and report + # accordingly. + import glob + pat = os.path.join(os.path.dirname(egginfo_path), '*.egg-info') + possible = glob.glob(pat) + err = "Egg metadata expected at %s but not found" % (egginfo_path,) + if possible: + alt = os.path.basename(possible[0]) + err += " (%s found - possible misnamed archive file?)" % (alt,) + + raise ValueError(err) + + if os.path.isfile(egginfo_path): + # .egg-info is a single file + pkginfo_path = egginfo_path + pkg_info = self._pkginfo_to_metadata(egginfo_path, egginfo_path) + os.mkdir(distinfo_path) + else: + # .egg-info is a directory + pkginfo_path = os.path.join(egginfo_path, 'PKG-INFO') + pkg_info = self._pkginfo_to_metadata(egginfo_path, pkginfo_path) + + # ignore common egg metadata that is useless to wheel + shutil.copytree(egginfo_path, distinfo_path, + ignore=lambda x, y: set(('PKG-INFO', + 'requires.txt', + 'SOURCES.txt', + 'not-zip-safe',))) + + # delete dependency_links if it is only whitespace + dependency_links_path = os.path.join(distinfo_path, 'dependency_links.txt') + with open(dependency_links_path, 'r') as dependency_links_file: + dependency_links = dependency_links_file.read().strip() + if not dependency_links: + adios(dependency_links_path) + + write_pkg_info(os.path.join(distinfo_path, 'METADATA'), pkg_info) + + # XXX deprecated. Still useful for current distribute/setuptools. + metadata_path = os.path.join(distinfo_path, 'METADATA') + self.add_requirements(metadata_path) + + # XXX intentionally a different path than the PEP. + metadata_json_path = os.path.join(distinfo_path, 'metadata.json') + pymeta = pkginfo_to_dict(metadata_path, + distribution=self.distribution) + + if 'description' in pymeta: + description_filename = 'DESCRIPTION.rst' + description_text = pymeta.pop('description') + description_path = os.path.join(distinfo_path, + description_filename) + with open(description_path, "wb") as description_file: + description_file.write(description_text.encode('utf-8')) + pymeta['extensions']['python.details']['document_names']['description'] = description_filename + + # XXX heuristically copy any LICENSE/LICENSE.txt? + license = self.license_file() + if license: + license_filename = 'LICENSE.txt' + shutil.copy(license, os.path.join(self.distinfo_dir, license_filename)) + pymeta['extensions']['python.details']['document_names']['license'] = license_filename + + with open(metadata_json_path, "w") as metadata_json: + json.dump(pymeta, metadata_json, sort_keys=True) + + adios(egginfo_path) + + def write_record(self, bdist_dir, distinfo_dir): + from wheel.util import urlsafe_b64encode + + record_path = os.path.join(distinfo_dir, 'RECORD') + record_relpath = os.path.relpath(record_path, bdist_dir) + + def walk(): + for dir, dirs, files in os.walk(bdist_dir): + dirs.sort() + for f in sorted(files): + yield os.path.join(dir, f) + + def skip(path): + """Wheel hashes every possible file.""" + return (path == record_relpath) + + with open_for_csv(record_path, 'w+') as record_file: + writer = csv.writer(record_file) + for path in walk(): + relpath = os.path.relpath(path, bdist_dir) + if skip(relpath): + hash = '' + size = '' + else: + with open(path, 'rb') as f: + data = f.read() + digest = hashlib.sha256(data).digest() + hash = 'sha256=' + native(urlsafe_b64encode(digest)) + size = len(data) + record_path = os.path.relpath( + path, bdist_dir).replace(os.path.sep, '/') + writer.writerow((record_path, hash, size)) + + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +#from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/azure-mgmt-locationbasedservices/setup.cfg b/azure-mgmt-locationbasedservices/setup.cfg new file mode 100644 index 000000000000..856f4164982c --- /dev/null +++ b/azure-mgmt-locationbasedservices/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-locationbasedservices/setup.py b/azure-mgmt-locationbasedservices/setup.py new file mode 100644 index 000000000000..be3b63ea22ee --- /dev/null +++ b/azure-mgmt-locationbasedservices/setup.py @@ -0,0 +1,84 @@ +#!/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 +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-locationbasedservices" +PACKAGE_PPRINT_NAME = "Location Based Services" + +# 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', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=["tests"]), + install_requires=[ + 'msrestazure>=0.4.20,<2.0.0', + 'azure-common~=1.1', + ], + cmdclass=cmdclass +) From 0bd1804ab2fd3ef119b70d5cbdab7f312388fbd0 Mon Sep 17 00:00:00 2001 From: James Park Date: Fri, 23 Feb 2018 14:38:30 -0800 Subject: [PATCH 3/4] Update HISTORY.rst --- azure-mgmt-locationbasedservices/HISTORY.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-locationbasedservices/HISTORY.rst b/azure-mgmt-locationbasedservices/HISTORY.rst index 8924d5d6c445..696f92b62cba 100644 --- a/azure-mgmt-locationbasedservices/HISTORY.rst +++ b/azure-mgmt-locationbasedservices/HISTORY.rst @@ -3,7 +3,7 @@ Release History =============== -0.1.0 (1970-01-01) +0.1.0 (2018-02-23) ++++++++++++++++++ -* Initial Release +* Initial Release (ApiVersion 2017-01-01-preview) From c8ee54717aae7ccb5aa2f10b16d2c24f3a867e3f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 6 Mar 2018 10:09:41 -0800 Subject: [PATCH 4/4] Generated from 398e69a74c8c4dc27b3a68b36525e36de171e336 (#2106) [Refactor] Client name should be more specific As per request: https://github.com/Azure/azure-sdk-for-python/pull/2048#pullrequestreview-100626413 --- .../azure/mgmt/locationbasedservices/__init__.py | 4 ++-- ... => location_based_services_management_client.py} | 12 ++++++------ .../mgmt/locationbasedservices/models/__init__.py | 2 +- ...cation_based_services_management_client_enums.py} | 0 4 files changed, 9 insertions(+), 9 deletions(-) rename azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/{client.py => location_based_services_management_client.py} (86%) rename azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/{client_enums.py => location_based_services_management_client_enums.py} (100%) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py index 59c8ad3d6bce..fe35520b791e 100644 --- a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/__init__.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .client import Client +from .location_based_services_management_client import LocationBasedServicesManagementClient from .version import VERSION -__all__ = ['Client'] +__all__ = ['LocationBasedServicesManagementClient'] __version__ = VERSION diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/location_based_services_management_client.py similarity index 86% rename from azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py rename to azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/location_based_services_management_client.py index 5096c5164041..8d09c6c80823 100644 --- a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/client.py +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/location_based_services_management_client.py @@ -17,8 +17,8 @@ from . import models -class ClientConfiguration(AzureConfiguration): - """Configuration for Client +class LocationBasedServicesManagementClientConfiguration(AzureConfiguration): + """Configuration for LocationBasedServicesManagementClient Note that all parameters used to create this instance are saved as instance attributes. @@ -42,7 +42,7 @@ def __init__( if not base_url: base_url = 'https://management.azure.com' - super(ClientConfiguration, self).__init__(base_url) + super(LocationBasedServicesManagementClientConfiguration, self).__init__(base_url) self.add_user_agent('azure-mgmt-locationbasedservices/{}'.format(VERSION)) self.add_user_agent('Azure-SDK-For-Python') @@ -51,11 +51,11 @@ def __init__( self.subscription_id = subscription_id -class Client(object): +class LocationBasedServicesManagementClient(object): """Resource Provider :ivar config: Configuration for client. - :vartype config: ClientConfiguration + :vartype config: LocationBasedServicesManagementClientConfiguration :ivar accounts: Accounts operations :vartype accounts: azure.mgmt.locationbasedservices.operations.AccountsOperations @@ -73,7 +73,7 @@ class Client(object): def __init__( self, credentials, subscription_id, base_url=None): - self.config = ClientConfiguration(credentials, subscription_id, base_url) + self.config = LocationBasedServicesManagementClientConfiguration(credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py index 30f680f4ef64..56e3d28685c4 100644 --- a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py +++ b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/__init__.py @@ -23,7 +23,7 @@ from .location_based_services_operations_value_item import LocationBasedServicesOperationsValueItem from .location_based_services_account_paged import LocationBasedServicesAccountPaged from .location_based_services_operations_value_item_paged import LocationBasedServicesOperationsValueItemPaged -from .client_enums import ( +from .location_based_services_management_client_enums import ( KeyType, ) diff --git a/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py b/azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_management_client_enums.py similarity index 100% rename from azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/client_enums.py rename to azure-mgmt-locationbasedservices/azure/mgmt/locationbasedservices/models/location_based_services_management_client_enums.py