From d6eebe385957a8ac4bb3ee13e462b9150f99f8c0 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 15 Oct 2018 13:36:44 -0700 Subject: [PATCH] [AutoPR apimanagement/resource-manager] add openid connect in authentication settings (#3612) * Generated from 0d3fa76ca7abc30f7d80506e5183c45c66aef6d3 add openid connect in authentication settings * Packaging update of azure-mgmt-apimanagement --- azure-mgmt-apimanagement/HISTORY.rst | 9 ++ azure-mgmt-apimanagement/MANIFEST.in | 1 + azure-mgmt-apimanagement/README.rst | 49 +++++++++++ azure-mgmt-apimanagement/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/apimanagement/models/__init__.py | 5 ++ .../models/api_management_client_enums.py | 6 ++ .../authentication_settings_contract.py | 12 +++ .../authentication_settings_contract_py3.py | 14 ++- ...pen_id_authentication_settings_contract.py | 33 +++++++ ...id_authentication_settings_contract_py3.py | 33 +++++++ azure-mgmt-apimanagement/sdk_packaging.toml | 7 ++ azure-mgmt-apimanagement/setup.cfg | 2 + azure-mgmt-apimanagement/setup.py | 87 +++++++++++++++++++ 14 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 azure-mgmt-apimanagement/HISTORY.rst create mode 100644 azure-mgmt-apimanagement/MANIFEST.in create mode 100644 azure-mgmt-apimanagement/README.rst create mode 100644 azure-mgmt-apimanagement/azure/__init__.py create mode 100644 azure-mgmt-apimanagement/azure/mgmt/__init__.py create mode 100644 azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract.py create mode 100644 azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract_py3.py create mode 100644 azure-mgmt-apimanagement/sdk_packaging.toml create mode 100644 azure-mgmt-apimanagement/setup.cfg create mode 100644 azure-mgmt-apimanagement/setup.py diff --git a/azure-mgmt-apimanagement/HISTORY.rst b/azure-mgmt-apimanagement/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/azure-mgmt-apimanagement/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-apimanagement/MANIFEST.in b/azure-mgmt-apimanagement/MANIFEST.in new file mode 100644 index 000000000000..bb37a2723dae --- /dev/null +++ b/azure-mgmt-apimanagement/MANIFEST.in @@ -0,0 +1 @@ +include *.rst diff --git a/azure-mgmt-apimanagement/README.rst b/azure-mgmt-apimanagement/README.rst new file mode 100644 index 000000000000..45de4e6b43dd --- /dev/null +++ b/azure-mgmt-apimanagement/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure MyService Management Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Compatibility +============= + +**IMPORTANT**: If you have an earlier version of the azure package +(version < 1.0), you should uninstall it before installing this package. + +You can check the version using pip: + +.. code:: shell + + pip freeze + +If you see azure==0.11.0 (or any version below 1.0), uninstall it first: + +.. code:: shell + + pip uninstall azure + + +Usage +===== + +For code examples, see `MyService Management +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. diff --git a/azure-mgmt-apimanagement/azure/__init__.py b/azure-mgmt-apimanagement/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/azure-mgmt-apimanagement/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-apimanagement/azure/mgmt/__init__.py b/azure-mgmt-apimanagement/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/azure-mgmt-apimanagement/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py index a1fc918799ac..d35d341ff41c 100644 --- a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py @@ -27,6 +27,7 @@ from .api_create_or_update_parameter_py3 import ApiCreateOrUpdateParameter from .api_update_contract_py3 import ApiUpdateContract from .oauth2_authentication_settings_contract_py3 import OAuth2AuthenticationSettingsContract + from .open_id_authentication_settings_contract_py3 import OpenIdAuthenticationSettingsContract from .authentication_settings_contract_py3 import AuthenticationSettingsContract from .subscription_key_parameter_names_contract_py3 import SubscriptionKeyParameterNamesContract from .api_entity_base_contract_py3 import ApiEntityBaseContract @@ -172,6 +173,7 @@ from .api_create_or_update_parameter import ApiCreateOrUpdateParameter from .api_update_contract import ApiUpdateContract from .oauth2_authentication_settings_contract import OAuth2AuthenticationSettingsContract + from .open_id_authentication_settings_contract import OpenIdAuthenticationSettingsContract from .authentication_settings_contract import AuthenticationSettingsContract from .subscription_key_parameter_names_contract import SubscriptionKeyParameterNamesContract from .api_entity_base_contract import ApiEntityBaseContract @@ -336,6 +338,7 @@ Protocol, ContentFormat, SoapApiType, + BearerTokenSendingMethods, ApiType, State, LoggerType, @@ -382,6 +385,7 @@ 'ApiCreateOrUpdateParameter', 'ApiUpdateContract', 'OAuth2AuthenticationSettingsContract', + 'OpenIdAuthenticationSettingsContract', 'AuthenticationSettingsContract', 'SubscriptionKeyParameterNamesContract', 'ApiEntityBaseContract', @@ -545,6 +549,7 @@ 'Protocol', 'ContentFormat', 'SoapApiType', + 'BearerTokenSendingMethods', 'ApiType', 'State', 'LoggerType', diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/api_management_client_enums.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/api_management_client_enums.py index 3cffd1387ec5..7ce553865647 100644 --- a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/api_management_client_enums.py +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/api_management_client_enums.py @@ -42,6 +42,12 @@ class SoapApiType(str, Enum): soap_pass_through = "soap" #: Imports the Soap API having a SOAP front end. +class BearerTokenSendingMethods(str, Enum): + + authorization_header = "authorizationHeader" #: Access token will be transmitted in the Authorization header using Bearer schema + query = "query" #: Access token will be transmitted as query parameters. + + class ApiType(str, Enum): http = "http" diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract.py index 936cc1fd7dba..b4eaf5654446 100644 --- a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract.py +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract.py @@ -18,12 +18,24 @@ class AuthenticationSettingsContract(Model): :param o_auth2: OAuth2 Authentication settings :type o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :param openid: OpenID Connect Authentication Settings + :type openid: + ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :param subscription_key_required: Specifies whether subscription key is + required during call to this API, true - API is included into closed + products only, false - API is included into open products alone, null - + there is a mix of products. + :type subscription_key_required: bool """ _attribute_map = { 'o_auth2': {'key': 'oAuth2', 'type': 'OAuth2AuthenticationSettingsContract'}, + 'openid': {'key': 'openid', 'type': 'OpenIdAuthenticationSettingsContract'}, + 'subscription_key_required': {'key': 'subscriptionKeyRequired', 'type': 'bool'}, } def __init__(self, **kwargs): super(AuthenticationSettingsContract, self).__init__(**kwargs) self.o_auth2 = kwargs.get('o_auth2', None) + self.openid = kwargs.get('openid', None) + self.subscription_key_required = kwargs.get('subscription_key_required', None) diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract_py3.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract_py3.py index e255bbd523aa..725dc936e94f 100644 --- a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract_py3.py +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/authentication_settings_contract_py3.py @@ -18,12 +18,24 @@ class AuthenticationSettingsContract(Model): :param o_auth2: OAuth2 Authentication settings :type o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :param openid: OpenID Connect Authentication Settings + :type openid: + ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :param subscription_key_required: Specifies whether subscription key is + required during call to this API, true - API is included into closed + products only, false - API is included into open products alone, null - + there is a mix of products. + :type subscription_key_required: bool """ _attribute_map = { 'o_auth2': {'key': 'oAuth2', 'type': 'OAuth2AuthenticationSettingsContract'}, + 'openid': {'key': 'openid', 'type': 'OpenIdAuthenticationSettingsContract'}, + 'subscription_key_required': {'key': 'subscriptionKeyRequired', 'type': 'bool'}, } - def __init__(self, *, o_auth2=None, **kwargs) -> None: + def __init__(self, *, o_auth2=None, openid=None, subscription_key_required: bool=None, **kwargs) -> None: super(AuthenticationSettingsContract, self).__init__(**kwargs) self.o_auth2 = o_auth2 + self.openid = openid + self.subscription_key_required = subscription_key_required diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract.py new file mode 100644 index 000000000000..4e5470794460 --- /dev/null +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract.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 OpenIdAuthenticationSettingsContract(Model): + """API OAuth2 Authentication settings details. + + :param openid_provider_id: OAuth authorization server identifier. + :type openid_provider_id: str + :param bearer_token_sending_methods: How to send token to the server. + :type bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] + """ + + _attribute_map = { + 'openid_provider_id': {'key': 'openidProviderId', 'type': 'str'}, + 'bearer_token_sending_methods': {'key': 'bearerTokenSendingMethods', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(OpenIdAuthenticationSettingsContract, self).__init__(**kwargs) + self.openid_provider_id = kwargs.get('openid_provider_id', None) + self.bearer_token_sending_methods = kwargs.get('bearer_token_sending_methods', None) diff --git a/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract_py3.py b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract_py3.py new file mode 100644 index 000000000000..112a077b9833 --- /dev/null +++ b/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/open_id_authentication_settings_contract_py3.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 OpenIdAuthenticationSettingsContract(Model): + """API OAuth2 Authentication settings details. + + :param openid_provider_id: OAuth authorization server identifier. + :type openid_provider_id: str + :param bearer_token_sending_methods: How to send token to the server. + :type bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] + """ + + _attribute_map = { + 'openid_provider_id': {'key': 'openidProviderId', 'type': 'str'}, + 'bearer_token_sending_methods': {'key': 'bearerTokenSendingMethods', 'type': '[str]'}, + } + + def __init__(self, *, openid_provider_id: str=None, bearer_token_sending_methods=None, **kwargs) -> None: + super(OpenIdAuthenticationSettingsContract, self).__init__(**kwargs) + self.openid_provider_id = openid_provider_id + self.bearer_token_sending_methods = bearer_token_sending_methods diff --git a/azure-mgmt-apimanagement/sdk_packaging.toml b/azure-mgmt-apimanagement/sdk_packaging.toml new file mode 100644 index 000000000000..cec3aa8bf42c --- /dev/null +++ b/azure-mgmt-apimanagement/sdk_packaging.toml @@ -0,0 +1,7 @@ +[packaging] +package_name = "azure-mgmt-apimanagement" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true diff --git a/azure-mgmt-apimanagement/setup.cfg b/azure-mgmt-apimanagement/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/azure-mgmt-apimanagement/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/azure-mgmt-apimanagement/setup.py b/azure-mgmt-apimanagement/setup.py new file mode 100644 index 000000000000..2370a60b65e8 --- /dev/null +++ b/azure-mgmt-apimanagement/setup.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-apimanagement" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +)