Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not merge: for diagnose ci style check failure #94

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
/src/rdbms/ @rohit-joy

/src/alias/ @chewong @troydai

/src/managementpartner/ @jeffrey-ace
4 changes: 2 additions & 2 deletions scripts/ci/test_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"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"
}
}
]
}
}
38 changes: 38 additions & 0 deletions src/managementpartner/azext_managementpartner/__init__.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions src/managementpartner/azext_managementpartner/_client_factory.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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())
32 changes: 32 additions & 0 deletions src/managementpartner/azext_managementpartner/_help.py
Original file line number Diff line number Diff line change
@@ -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.
"""
12 changes: 12 additions & 0 deletions src/managementpartner/azext_managementpartner/_params.py
Original file line number Diff line number Diff line change
@@ -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)
25 changes: 25 additions & 0 deletions src/managementpartner/azext_managementpartner/commands.py
Original file line number Diff line number Diff line change
@@ -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')
35 changes: 35 additions & 0 deletions src/managementpartner/azext_managementpartner/custom.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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<msrestazure.azure_active_directory>`
: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<msrestazure.azure_active_directory>`
: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)
Original file line number Diff line number Diff line change
@@ -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',
]
Loading