diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b8fb8abbcd2..fffbddb3278 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,3 +19,5 @@ /src/rdbms/ @rohit-joy /src/alias/ @chewong @troydai + +/src/managementpartner/ @jeffrey-ace \ No newline at end of file diff --git a/scripts/ci/test_static.sh b/scripts/ci/test_static.sh index 395ed5adb62..a601c4edffe 100755 --- a/scripts/ci/test_static.sh +++ b/scripts/ci/test_static.sh @@ -5,8 +5,8 @@ proc_number=`python -c 'import multiprocessing; print(multiprocessing.cpu_count( # Run pylint/flake8 on extensions # - We ignore 'models', 'operations' and files with suffix '_client.py' as they typically come from vendored Azure SDKs -pylint ./src/*/azext_*/ --ignore=models,operations,service_bus_management_client,subscription_client,managementgroups --ignore-patterns=[a-zA-Z_]+_client.py --rcfile=./pylintrc -j $proc_number -flake8 --statistics --exclude=models,operations,*_client.py,managementgroups --append-config=./.flake8 ./src/*/azext_*/ +pylint ./src/*/azext_*/ --ignore=models,operations,service_bus_management_client,subscription_client,managementgroups,managementpartner --ignore-patterns=[a-zA-Z_]+_client.py --rcfile=./pylintrc -j $proc_number +flake8 --statistics --exclude=models,operations,*_client.py,managementgroups,managementpartner --append-config=./.flake8 ./src/*/azext_*/ # Run pylint/flake8 on CI files pylint ./scripts/ci/*.py --rcfile=./pylintrc diff --git a/src/index.json b/src/index.json index 33f66034737..c3d4d5c7473 100644 --- a/src/index.json +++ b/src/index.json @@ -593,6 +593,51 @@ "version": "0.1.1" } } + ], + "managementpartner": [ + { + "filename": "managementpartner-0.1.0-py2.py3-none-any.whl", + "sha256Digest": "b7aa85e4686cd441afec7272228407eac3d7090c1e411d9990ca1d02885584ce", + "downloadUrl": "https://files.pythonhosted.org/packages/74/b0/272479338346bf69040f4d952efa6a8c88084e2ac3adc58f11308254ab18/managementpartner-0.1.0-py2.py3-none-any.whl", + "metadata": { + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "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" + ], + "extensions": { + "python.details": { + "contacts": [ + { + "email": "jefl@microsoft.com", + "name": "Jeffrey Li", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/Azure/azure-cli-extensions" + } + } + }, + "generator": "bdist_wheel (0.29.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "managementpartner", + "summary": "An Azure CLI Extension for Management Partner", + "version": "0.1.0" + } + } ] } } \ No newline at end of file diff --git a/src/managementpartner/azext_managementpartner/__init__.py b/src/managementpartner/azext_managementpartner/__init__.py new file mode 100644 index 00000000000..35d54db88ed --- /dev/null +++ b/src/managementpartner/azext_managementpartner/__init__.py @@ -0,0 +1,38 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.core import AzCommandsLoader + +from ._help import helps # pylint: disable=unused-import +from ._client_factory import managementpartner_partner_client_factory +from ._exception_handler import managementpartner_exception_handler + + +class ManagementpartnerCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + managementpartner_custom = CliCommandType( + operations_tmpl='azext_managementpartner.custom#{}', + client_factory=managementpartner_partner_client_factory, + exception_handler=managementpartner_exception_handler + ) + + super(ManagementpartnerCommandsLoader, self).__init__( + cli_ctx=cli_ctx, + custom_command_type=managementpartner_custom) + + def load_command_table(self, args): + from .commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from ._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = ManagementpartnerCommandsLoader diff --git a/src/managementpartner/azext_managementpartner/_client_factory.py b/src/managementpartner/azext_managementpartner/_client_factory.py new file mode 100644 index 00000000000..03e48ff504b --- /dev/null +++ b/src/managementpartner/azext_managementpartner/_client_factory.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def cf_managementpartner(cli_ctx, **_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_managementpartner.managementpartner.ace_provisioning_management_partner_api import ( + ACEProvisioningManagementPartnerAPI as ManagementPartnerAPI) + return get_mgmt_service_client(cli_ctx, ManagementPartnerAPI, subscription_bound=False) + + +def managementpartner_partner_client_factory(cli_ctx, kwargs): + return cf_managementpartner(cli_ctx, **kwargs).partner diff --git a/src/managementpartner/azext_managementpartner/_exception_handler.py b/src/managementpartner/azext_managementpartner/_exception_handler.py new file mode 100644 index 00000000000..bf516b27e30 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/_exception_handler.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.core.util import CLIError + + +def managementpartner_exception_handler(ex): + from azext_managementpartner.managementpartner.models import Error + if isinstance(ex, Error): + message = ex.error.error.message + raise CLIError(message) + else: + import sys + from six import reraise + reraise(*sys.exc_info()) diff --git a/src/managementpartner/azext_managementpartner/_help.py b/src/managementpartner/azext_managementpartner/_help.py new file mode 100644 index 00000000000..5b54ef91353 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/_help.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from knack.help_files import helps + +helps['managementpartner'] = """ + type: group + short-summary: Allows the partners to associate a Microsoft Partner Network(MPN) ID to a user or service principal in the customer's Azure directory. +""" + +helps['managementpartner create'] = """ + type: command + short-summary: Associates a Microsoft Partner Network(MPN) ID to the current authenticated user or service principal. +""" + +helps['managementpartner show'] = """ + type: command + short-summary: Gets the Microsoft Partner Network(MPN) ID of the current authenticated user or service principal. +""" + +helps['managementpartner update'] = """ + type: command + short-summary: Updates the Microsoft Partner Network(MPN) ID of the current authenticated user or service principal. +""" + +helps['managementpartner delete'] = """ + type: command + short-summary: Delete the Microsoft Partner Network(MPN) ID of the current authenticated user or service principal. +""" diff --git a/src/managementpartner/azext_managementpartner/_params.py b/src/managementpartner/azext_managementpartner/_params.py new file mode 100644 index 00000000000..55ed6b54886 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/_params.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def load_arguments(self, _): + with self.argument_context('managementpartner') as c: + c.argument('partner_id', help='Microsoft partner network ID') + + with self.argument_context('managementpartner show') as c: + c.argument('partner_id', required=False) diff --git a/src/managementpartner/azext_managementpartner/commands.py b/src/managementpartner/azext_managementpartner/commands.py new file mode 100644 index 00000000000..a5039817e25 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/commands.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.core.commands import CliCommandType +from ._client_factory import managementpartner_partner_client_factory +from ._exception_handler import managementpartner_exception_handler + + +def load_command_table(self, _): + def managementpartner_type(*args, **kwargs): + return CliCommandType(*args, exception_handler=managementpartner_exception_handler, **kwargs) + + managementpartner_partner_sdk = managementpartner_type( + operations_tmpl='azext_managementpartner.managementpartner.operations.partner_operations#PartnerOperations.{}', + client_factory=managementpartner_partner_client_factory + ) + + with self.command_group('managementpartner', managementpartner_partner_sdk) as g: + g.custom_command('delete', 'delete_managementpartner') + g.custom_command('create', 'create_managementpartner') + g.custom_command('update', 'update_managementpartner') + g.custom_command('show', 'get_managementpartner') diff --git a/src/managementpartner/azext_managementpartner/custom.py b/src/managementpartner/azext_managementpartner/custom.py new file mode 100644 index 00000000000..c77f6dad92a --- /dev/null +++ b/src/managementpartner/azext_managementpartner/custom.py @@ -0,0 +1,35 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def print_managementpartner(partnerresponse): + partner = {} + partner["objectId"] = partnerresponse.object_id + partner["partnerId"] = partnerresponse.partner_id + partner["tenantId"] = partnerresponse.tenant_id + partner["state"] = partnerresponse.state + return partner + + +def xstr(s): + if s is None: + return "" + return str(s) + + +def create_managementpartner(client, partner_id): + return print_managementpartner(client.create(partner_id)) + + +def get_managementpartner(client, partner_id=None): + return print_managementpartner(client.get(xstr(partner_id))) + + +def update_managementpartner(client, partner_id): + return print_managementpartner(client.update(partner_id)) + + +def delete_managementpartner(client, partner_id): + return client.delete(partner_id) diff --git a/src/managementpartner/azext_managementpartner/managementpartner/__init__.py b/src/managementpartner/azext_managementpartner/managementpartner/__init__.py new file mode 100644 index 00000000000..4e5720cc430 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .ace_provisioning_management_partner_api import ACEProvisioningManagementPartnerAPI +from .version import VERSION + +__all__ = ['ACEProvisioningManagementPartnerAPI'] + +__version__ = VERSION diff --git a/src/managementpartner/azext_managementpartner/managementpartner/ace_provisioning_management_partner_api.py b/src/managementpartner/azext_managementpartner/managementpartner/ace_provisioning_management_partner_api.py new file mode 100644 index 00000000000..c61efaaace3 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/ace_provisioning_management_partner_api.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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.partner_operations import PartnerOperations +from .operations.operation_operations import OperationOperations +from . import models + + +class ACEProvisioningManagementPartnerAPIConfiguration(AzureConfiguration): + """Configuration for ACEProvisioningManagementPartnerAPI + 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 str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ACEProvisioningManagementPartnerAPIConfiguration, self).__init__(base_url) + + self.add_user_agent('aceprovisioningmanagementpartnerapi/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + + +class ACEProvisioningManagementPartnerAPI(object): + """This API describe ACE Provisioning ManagementPartner + + :ivar config: Configuration for client. + :vartype config: ACEProvisioningManagementPartnerAPIConfiguration + + :ivar partner: Partner operations + :vartype partner: managementpartner.operations.PartnerOperations + :ivar operation: Operation operations + :vartype operation: managementpartner.operations.OperationOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = ACEProvisioningManagementPartnerAPIConfiguration(credentials, 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 = '2018-02-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.partner = PartnerOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/__init__.py b/src/managementpartner/azext_managementpartner/managementpartner/models/__init__.py new file mode 100644 index 00000000000..772c10272ac --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .partner_response import PartnerResponse +from .extended_error_info import ExtendedErrorInfo +from .error import Error, ErrorException +from .operation_display import OperationDisplay +from .operation_response import OperationResponse +from .operation_response_paged import OperationResponsePaged + +__all__ = [ + 'PartnerResponse', + 'ExtendedErrorInfo', + 'Error', 'ErrorException', + 'OperationDisplay', + 'OperationResponse', + 'OperationResponsePaged', +] diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/error.py b/src/managementpartner/azext_managementpartner/managementpartner/models/error.py new file mode 100644 index 00000000000..05dac412c5e --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/error.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 is the management partner operations error. + + :param error: this is the ExtendedErrorInfo property + :type error: ~managementpartner.models.ExtendedErrorInfo + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ExtendedErrorInfo'}, + } + + def __init__(self, error=None): + super(Error, self).__init__() + self.error = error + + +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/src/managementpartner/azext_managementpartner/managementpartner/models/extended_error_info.py b/src/managementpartner/azext_managementpartner/managementpartner/models/extended_error_info.py new file mode 100644 index 00000000000..058b1235da7 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/extended_error_info.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ExtendedErrorInfo(Model): + """this is the extended error info. + + :param code: this is the error response code. Possible values include: + 'NotFound', 'Conflict', 'BadRequest' + :type code: str or ~managementpartner.models.enum + :param message: this is the extended error info message + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, code=None, message=None): + super(ExtendedErrorInfo, self).__init__() + self.code = code + self.message = message diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/operation_display.py b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_display.py new file mode 100644 index 00000000000..b405114efd0 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_display.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationDisplay(Model): + """this is the management partner operation. + + :param provider: the is management partner provider + :type provider: str + :param resource: the is management partner resource + :type resource: str + :param operation: the is management partner operation + :type operation: str + :param description: the is management partner operation description + :type description: str + """ + + _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, provider=None, resource=None, operation=None, description=None): + super(OperationDisplay, self).__init__() + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response.py b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response.py new file mode 100644 index 00000000000..8857e12d85e --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 OperationResponse(Model): + """this is the management partner operations response. + + :param name: this is the operation response name + :type name: str + :param display: this is the operation display + :type display: ~managementpartner.models.OperationDisplay + :param origin: the is operation response origin information + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, name=None, display=None, origin=None): + super(OperationResponse, self).__init__() + self.name = name + self.display = display + self.origin = origin diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response_paged.py b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response_paged.py new file mode 100644 index 00000000000..f4d8e664794 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/operation_response_paged.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 OperationResponsePaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationResponse ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationResponse]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationResponsePaged, self).__init__(*args, **kwargs) diff --git a/src/managementpartner/azext_managementpartner/managementpartner/models/partner_response.py b/src/managementpartner/azext_managementpartner/managementpartner/models/partner_response.py new file mode 100644 index 00000000000..ddb75d66341 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/models/partner_response.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 PartnerResponse(Model): + """this is the management partner operations response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param etag: Type of the partner + :type etag: int + :ivar id: Identifier of the partner + :vartype id: str + :ivar name: Name of the partner + :vartype name: str + :param partner_id: This is the partner id + :type partner_id: str + :param tenant_id: This is the tenant id. + :type tenant_id: str + :param object_id: This is the object id. + :type object_id: str + :param version: This is the version. + :type version: str + :param updated_time: This is the DateTime when the partner was updated. + :type updated_time: datetime + :param created_time: This is the DateTime when the partner was created. + :type created_time: datetime + :param state: This is the partner state. Possible values include: + 'Active', 'Deleted' + :type state: str or ~managementpartner.models.enum + :ivar type: Type of resource. "Microsoft.ManagementPartner/partners" + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'etag': {'key': 'etag', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'partner_id': {'key': 'properties.partnerId', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'updated_time': {'key': 'properties.updatedTime', 'type': 'iso-8601'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, etag=None, partner_id=None, tenant_id=None, object_id=None, version=None, updated_time=None, created_time=None, state=None): + super(PartnerResponse, self).__init__() + self.etag = etag + self.id = None + self.name = None + self.partner_id = partner_id + self.tenant_id = tenant_id + self.object_id = object_id + self.version = version + self.updated_time = updated_time + self.created_time = created_time + self.state = state + self.type = None diff --git a/src/managementpartner/azext_managementpartner/managementpartner/operations/__init__.py b/src/managementpartner/azext_managementpartner/managementpartner/operations/__init__.py new file mode 100644 index 00000000000..47482d6a229 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/operations/__init__.py @@ -0,0 +1,14 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .partner_operations import PartnerOperations +from .operation_operations import OperationOperations + +__all__ = [ + 'PartnerOperations', + 'OperationOperations', +] diff --git a/src/managementpartner/azext_managementpartner/managementpartner/operations/operation_operations.py b/src/managementpartner/azext_managementpartner/managementpartner/operations/operation_operations.py new file mode 100644 index 00000000000..51bad660f1a --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/operations/operation_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 OperationOperations(object): + """OperationOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Supported version. Constant value: "2018-02-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-02-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get operations. + + List all the operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of OperationResponse + :rtype: + ~managementpartner.models.OperationResponsePaged[~managementpartner.models.OperationResponse] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/providers/Microsoft.ManagementPartner/operations' + + # 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.OperationResponsePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/src/managementpartner/azext_managementpartner/managementpartner/operations/partner_operations.py b/src/managementpartner/azext_managementpartner/managementpartner/operations/partner_operations.py new file mode 100644 index 00000000000..502a47358e3 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/operations/partner_operations.py @@ -0,0 +1,257 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 PartnerOperations(object): + """PartnerOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Supported version. Constant value: "2018-02-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-02-01" + + self.config = config + + def get( + self, partner_id, custom_headers=None, raw=False, **operation_config): + """Get a specific `Partner`. + + Get the management partner using the partnerId, objectId and tenantId. + + :param partner_id: Id of the Partner + :type partner_id: 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: PartnerResponse or ClientRawResponse if raw=true + :rtype: ~managementpartner.models.PartnerResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/providers/Microsoft.ManagementPartner/partners/{partnerId}' + path_format_arguments = { + 'partnerId': self._serialize.url("partner_id", partner_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') + + # 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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PartnerResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, partner_id, custom_headers=None, raw=False, **operation_config): + """Create a specific `Partner`. + + Create a management partner for the objectId and tenantId. + + :param partner_id: Id of the Partner + :type partner_id: 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: PartnerResponse or ClientRawResponse if raw=true + :rtype: ~managementpartner.models.PartnerResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/providers/Microsoft.ManagementPartner/partners/{partnerId}' + path_format_arguments = { + 'partnerId': self._serialize.url("partner_id", partner_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') + + # 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.put(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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PartnerResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, partner_id, custom_headers=None, raw=False, **operation_config): + """Update a specific `Partner`. + + Update the management partner for the objectId and tenantId. + + :param partner_id: Id of the Partner + :type partner_id: 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: PartnerResponse or ClientRawResponse if raw=true + :rtype: ~managementpartner.models.PartnerResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/providers/Microsoft.ManagementPartner/partners/{partnerId}' + path_format_arguments = { + 'partnerId': self._serialize.url("partner_id", partner_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') + + # 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.patch(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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PartnerResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, partner_id, custom_headers=None, raw=False, **operation_config): + """Delete a specific `Partner`. + + Delete the management partner for the objectId and tenantId. + + :param partner_id: Id of the Partner + :type partner_id: 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 = '/providers/Microsoft.ManagementPartner/partners/{partnerId}' + path_format_arguments = { + 'partnerId': self._serialize.url("partner_id", partner_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') + + # 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]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response diff --git a/src/managementpartner/azext_managementpartner/managementpartner/version.py b/src/managementpartner/azext_managementpartner/managementpartner/version.py new file mode 100644 index 00000000000..2c417bf4e8f --- /dev/null +++ b/src/managementpartner/azext_managementpartner/managementpartner/version.py @@ -0,0 +1,8 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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" diff --git a/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_create_managementpartner.yaml b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_create_managementpartner.yaml new file mode 100644 index 00000000000..f9b60622a3c --- /dev/null +++ b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_create_managementpartner.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:02 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzp08B7NPUWo52JjdaOi4e4IhF4rRbCjtmHkM-TV24V9KcvCVcV_OTFQRECH_RdGrhA9G5Wz-6RjFRrMOLMyQIEAG045wYM7xRB6YGHP4sig-QGc7kzfju4JYorq1eS9UJ-rkXOa1pHKMqDXVaJNZTkAjIhJasOy3t0gx_eul462wgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner create] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123456","type":"Microsoft.ManagementPartner/partners","name":"123456","etag":57,"properties":{"partnerId":"123456","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":57,"updatedTime":"2018-02-11T22:18:03.2858169Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:04 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [caf4fe63-a33c-40bb-8ba0-62d91fc34d72] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1199'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:04 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHz8SY4qRR_pBgb4DVgiujfK19a__5vNW-FHTRI9atz9sBbG7BevjBUAMgXoiYnuanhExQowoUSgPCFdzmcRVtRnPS7T5MnHFBz4rb3rIvdSaPvNsCX3BGjSGvOU0VAYPUoeHUhELlZOSC5DA8Nvr4CnPuMtxjlHLZMOyUKxgr76hIgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 11 Feb 2018 22:18:06 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [be66349a-f293-4ea9-8369-5be9bc907cd9] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1195'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_delete_managementpartner.yaml b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_delete_managementpartner.yaml new file mode 100644 index 00000000000..24698ab4dc4 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_delete_managementpartner.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:07 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzcKiapDBqtRbS_n5pfg7jppz5_zoDacQORahkJ9u5_PLhtnsNgm-DZuebAeFKqDFMAOsNGt1x_5B7sBBfyhGaT-h0NAZ-AE6sL_Yzyv4E7AnlnGlTfy-HFSt9TQinMXVR3H5QCQcLbqKHrQafyulFeRLBEyHt9YJVrVSnuJzcgUMgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner create] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123456","type":"Microsoft.ManagementPartner/partners","name":"123456","etag":59,"properties":{"partnerId":"123456","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":59,"updatedTime":"2018-02-11T22:18:08.1612112Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:08 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [8497e7d6-6b08-4df0-b2c0-55f66316a262] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:08 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzNpc_xyeY2YkVPLvDWut9zg5fYU1oGGkBzpLrfL6GwxmgH7M0zu2b6KC3rOsQqeHoXW717xkklUVvooaZFckBJBm_PDpJgSdhTgiaM_82Gq087arjvKqWVbbn-No8jBaUp6j9zUdiVaDtx8r-91s9Qr3xQK4dwX9oXnYJnqPBrQcgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 11 Feb 2018 22:18:09 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [409f895f-852b-4bb4-b918-9a58343b1aef] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1198'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_show_managementpartner.yaml b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_show_managementpartner.yaml new file mode 100644 index 00000000000..6d0abb8be7d --- /dev/null +++ b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_show_managementpartner.yaml @@ -0,0 +1,195 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:10 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHznVqREJ__IWc5Dm5Uf3uDVqQ_Daa7tJ8EsyHFMT8cdsBheyoD2K96jUAi2jkI8tSRgeYCUiZWEPDIOgJ3PLsUDuZ6JzarhoPDFEwpLr1QMObHXy6YAG53GoapWMDK_msxD4e6h38NeAJTWt17ORLl7uliY74jXHBS194UJ5-Gdj4gAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner create] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123456","type":"Microsoft.ManagementPartner/partners","name":"123456","etag":61,"properties":{"partnerId":"123456","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":61,"updatedTime":"2018-02-11T22:18:10.5395747Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:10 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [77a07a21-be7e-49a8-a023-ac9afa429a10] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1196'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:11 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzYOV1XQY88oG9EGtp5vaE72Tlir_aDM6hhhqSvBdhKmSMLsXmD09-rXtRpec7L-HJIDXGTrHFlvkb0C_9ZC_GmqXSYzwO_wjpAFbbEdUoqkZJV674lS9o8XT83O67TSWC0Y_kC8B75OAO21PV0b1yHGWHjUA_J_rKHFXs7nFrapogAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123456","type":"Microsoft.ManagementPartner/partners","name":"123456","etag":61,"properties":{"partnerId":"123456","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":61,"updatedTime":"2018-02-11T22:18:10.5395747Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:10 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [f3097e3c-7be5-40ab-8ada-645d80e885c7] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:11 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzYgq05jL4mUwJiR69zZlQqbiJYotQSeEGV9qsY1FNOIuvk7J4cHcsIEyJInNC6We07iglBwBQqYBo6XB1GZuSFS0kA0kryDt0UUWqwY6B657AwxsiqwgupQJlV60r5N8aCPtVR3-MSff_u81q0ULk9ZzYEuQ2r1XMkKpKZoZ36bcgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 11 Feb 2018 22:18:12 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [3800329b-b1c5-4ab9-bf9e-55e879084caa] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1194'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_update_managementpartner.yaml b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_update_managementpartner.yaml new file mode 100644 index 00000000000..998767f27d2 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/tests/latest/recordings/test_update_managementpartner.yaml @@ -0,0 +1,197 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:12 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzkXkxGAYs6pbE5HSUWAty8vYKx6Sdx9UMP31fXWA94H6BPSnzO0IPZ21hi8FUL0AHwPLO9OROhL0iHeez03Pw3TnpGqdBthhDmhtW7EVqtgOTVi9NHQKNjVGFGyEiERKWSqAJJeE5v0wUjRqNq-jzF8H0HGPlut9pP857v02Gc5AgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner create] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123456?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123456","type":"Microsoft.ManagementPartner/partners","name":"123456","etag":63,"properties":{"partnerId":"123456","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":63,"updatedTime":"2018-02-11T22:18:13.2210806Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:12 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [eb512415-cef0-4237-959d-cfcfcd1b0b16] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1195'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:13 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHztlnvRv-IHZ5EL4KLdUItdPUhoP6RBJYmrMTnTts7r0npKBckorwtEmE3AOmkcBf6uZsPIrOcclk7k8oSz3T4VUafZamc1sY5LDwKcC-2046RRFHkViSwxUjOXs-YaMpVQ1ucZZTrj5tkEAlsz4j36HZoB6GQaShhufx8qtrCNsQgAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner update] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: PATCH + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123457?api-version=2018-02-01 + response: + body: {string: '{"id":"/providers/microsoft.managementpartner/partners/123457","type":"Microsoft.ManagementPartner/partners","name":"123457","etag":64,"properties":{"partnerId":"123457","tenantId":"1b1121dd-6900-412a-af73-e8d44f81e1c1","objectId":"aa67f786-0552-423e-8849-244ed12bf581","version":64,"updatedTime":"2018-02-11T22:18:14.2210619Z","createdTime":"2018-01-20T01:23:40.5280496Z","state":"Active"}}'} + headers: + cache-control: [no-cache] + content-length: ['391'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [182a280a-7ebc-49da-9457-be5384534837] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1197'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Charset: [utf-8] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.18.4] + return-client-request-id: ['true'] + x-client-CPU: [x86] + x-client-OS: [win32] + x-client-SKU: [Python] + x-client-Ver: [0.5.0] + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F1b1121dd-6900-412a-af73-e8d44f81e1c1%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: {string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/1b1121dd-6900-412a-af73-e8d44f81e1c1/.well-known/openid-configuration"}'} + headers: + access-control-allow-methods: ['GET, OPTIONS'] + access-control-allow-origin: ['*'] + cache-control: [private] + content-length: ['131'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 11 Feb 2018 22:18:14 GMT'] + p3p: [CP="DSP CUR OTPi IND OTRi ONL FIN"] + server: [Microsoft-IIS/10.0] + set-cookie: [esctx=AQABAAAAAABHh4kmS_aKT5XrjzxRAtHzCQHpEaeLLvmvZ-DLkChFYLPHAj4UAAtZvqFQhbbD0e4iWi-G1WjnSLcH0VDQUIwfoLuPryDnGMHRsk9ZVIxVLDnkTCeWkBtQ4RxOMo8CreHPTZdNjaBcJDExA5eouPCens4E1GUs0d3w9x7toKQZoQbp-ljikc3Pcsfs023s2Y8gAA; + domain=.login.windows.net; path=/; secure; HttpOnly, x-ms-gateway-slice=corp; + path=/; secure; HttpOnly, stsservicecookie=ests; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [managementpartner delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.25 + msrest_azure/0.4.20 aceprovisioningmanagementpartnerapi/0.1.0 Azure-SDK-For-Python + AZURECLI/2.0.27] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/providers/Microsoft.ManagementPartner/partners/123457?api-version=2018-02-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 11 Feb 2018 22:18:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-id: [49fa6c7e-160d-4ecb-a07a-ff5b8d6ff10a] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-gsm: ['8.1.0.54 (AD-CAB-Provisioning:stage.6d5d2b81c.180209-1821)'] + x-ms-ratelimit-remaining-tenant-writes: ['1198'] + status: {code: 200, message: OK} +version: 1 diff --git a/src/managementpartner/azext_managementpartner/tests/latest/test_managementpartner_commands.py b/src/managementpartner/azext_managementpartner/tests/latest/test_managementpartner_commands.py new file mode 100644 index 00000000000..fe77b34e058 --- /dev/null +++ b/src/managementpartner/azext_managementpartner/tests/latest/test_managementpartner_commands.py @@ -0,0 +1,77 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.testsdk import ScenarioTest, record_only + + +@record_only() +class AzureManagementPartnerTests(ScenarioTest): + + def _validate_managementpartner(self, partner): + self.assertIsNotNone(partner) + self.assertTrue(partner['objectId']) + self.assertTrue(partner['partnerId']) + self.assertTrue(partner['state']) + self.assertTrue(partner['tenantId']) + + def test_delete_managementpartner(self): + self.kwargs.update({ + 'partnerid': '123456' + }) + + # Setup + self.cmd('az managementpartner create --partner-id {partnerid}') + + # Run + self.cmd('az managementpartner delete --partner-id {partnerid}') + + def test_create_managementpartner(self): + self.kwargs.update({ + 'partnerid': '123456' + }) + # Run + result = self.cmd('az managementpartner create --partner-id {partnerid}') \ + .get_output_in_json() + # Validate + self._validate_managementpartner(result) + + # Cleanup + self.cmd('az managementpartner delete --partner-id {partnerid}') + + def test_show_managementpartner(self): + self.kwargs.update({ + 'partnerid': '123456' + }) + # Setup + self.cmd('az managementpartner create --partner-id {partnerid}') + + # Run + result = self.cmd('az managementpartner show --partner-id {partnerid}')\ + .get_output_in_json() + + # Validate + self._validate_managementpartner(result) + + # Cleanup + self.cmd('az managementpartner delete --partner-id {partnerid}') + + def test_update_managementpartner(self): + self.kwargs.update({ + 'partnerid': '123456', + 'newpartnerid': '123457' + }) + # Setup + self.cmd('az managementpartner create --partner-id {partnerid}') + + # Run + result = self.cmd('az managementpartner update --partner-id {newpartnerid}')\ + .get_output_in_json() + + # Validate + self._validate_managementpartner(result) + + # Cleanup + self.cmd('az managementpartner delete --partner-id {newpartnerid}') diff --git a/src/managementpartner/setup.cfg b/src/managementpartner/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/src/managementpartner/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/managementpartner/setup.py b/src/managementpartner/setup.py new file mode 100644 index 00000000000..531467e4813 --- /dev/null +++ b/src/managementpartner/setup.py @@ -0,0 +1,41 @@ +#!/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. +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + +VERSION = "0.1.0" + +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + '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', +] + +DEPENDENCIES = [] + +setup( + name='managementpartner', + version=VERSION, + description='An Azure CLI Extension for Management Partner', + long_description='An Azure CLI Extension for Management Partner', + license='MIT', + author='Jeffrey Li', + author_email='jefl@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + install_requires=DEPENDENCIES +)