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

[MarketplaceOrdering] New command group az term to accept/show terms #17686

Merged
merged 12 commits into from
Apr 28, 2021
3 changes: 2 additions & 1 deletion doc/sphinx/azhelpgen/doc_source_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
"aro": "src/azure-cli/azure/cli/command_modules/aro/_help.py",
"util": "src/azure-cli/azure/cli/command_modules/util/_help.py",
"synapse": "src/azure-cli/azure/cli/command_modules/synapse/_help.py",
"databoxedge": "src/azure-cli/azure/cli/command_modules/databoxedge/_help.py"
"databoxedge": "src/azure-cli/azure/cli/command_modules/databoxedge/_help.py",
"term": "src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
import azure.cli.command_modules.marketplaceordering._help # pylint: disable=unused-import

yungezz marked this conversation as resolved.
Show resolved Hide resolved

class MarketplaceOrderingAgreementsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .generated._client_factory import cf_marketplaceordering_cl
marketplaceordering_custom = CliCommandType(
operations_tmpl='azure.cli.command_modules.marketplaceordering.custom#{}',
client_factory=cf_marketplaceordering_cl)
parent = super(MarketplaceOrderingAgreementsCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=marketplaceordering_custom)

def load_command_table(self, args):
from .generated.commands import load_command_table
load_command_table(self, args)
try:
from .manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
load_arguments(self, command)
try:
from .manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = MarketplaceOrderingAgreementsCommandsLoader
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
yungezz marked this conversation as resolved.
Show resolved Hide resolved

from .generated._help import helps # pylint: disable=unused-import, disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_marketplaceordering_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
return get_mgmt_service_client(cli_ctx,
MarketplaceOrderingAgreements)


def cf_marketplace_agreement(cli_ctx, *_):
return cf_marketplaceordering_cl(cli_ctx).marketplace_agreements
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines

from knack.help_files import helps


helps['term'] = """
type: group
short-summary: Manage marketplace agreement with marketplaceordering
"""

helps['term show'] = """
type: command
short-summary: "Get marketplace terms."
examples:
- name: GetMarketplaceTerms
yungezz marked this conversation as resolved.
Show resolved Hide resolved
text: |-
az term show --product "offid" --plan "planid" --publisher "pubid"
"""

helps['term accept'] = """
type: command
short-summary: "Accept marketplace terms."
examples:
- name: SetMarketplaceTerms
text: |-
az term accept --product "offid" --plan "planid" --publisher "pubid"
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _):

with self.argument_context('term show') as c:
c.argument('publisher', type=str, help='Publisher identifier string of image being deployed.')
c.argument('product', type=str, help='Offeridentifier string of image being deployed.')
c.argument('plan', type=str, help='Plan identifier string of image being deployed.')

with self.argument_context('term accept') as c:
c.argument('publisher', type=str, help='Publisher identifier string of image being deployed.')
c.argument('product', type=str, help='Offer identifier string of image being deployed.')
c.argument('plan', type=str, help='Plan identifier string of image being deployed.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=protected-access
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals
# pylint: disable=bad-continuation
# pylint: disable=line-too-long

from azure.cli.core.commands import CliCommandType
from ..generated._client_factory import cf_marketplace_agreement


marketplaceordering_marketplace_agreement = CliCommandType(
operations_tmpl='azure.mgmt.marketplaceordering.operations._marketplace_agreements_operations#MarketplaceAgreementsOperations.{}',
client_factory=cf_marketplace_agreement,
)


def load_command_table(self, _):

with self.command_group(
'term', marketplaceordering_marketplace_agreement, client_factory=cf_marketplace_agreement, is_experimental=True
) as g:
g.custom_show_command('show', 'term_show')
g.custom_command('accept', 'term_accept')
yungezz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines


def term_show(client,
publisher,
product,
plan):
return client.get(offer_type="virtualmachine",
publisher_id=publisher,
offer_id=product,
plan_id=plan)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines

from knack.help_files import helps


helps['term'] = """
type: group
short-summary: Manage marketplace agreement with marketplaceordering
"""

helps['term show'] = """
type: command
short-summary: "Get marketplace terms."
examples:
- name: Get marketeplace terms.
text: |-
az term show --product "windows-data-science-vm" --plan "windows2016" --publisher "microsoft-ads"
"""

helps['term accept'] = """
type: command
short-summary: "Accept marketplace terms."
examples:
- name: Set marketplace terms.
text: |-
az term accept --product "windows-data-science-vm" --plan "windows2016" --publisher "microsoft-ads"
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines


def term_accept(client,
publisher,
product,
plan):
offerDetail = client.get(offer_type="virtualmachine",
publisher_id=publisher,
offer_id=product,
plan_id=plan)
if offerDetail is None:
from azure.cli.core.azclierror import ValidationError
raise ValidationError(
'cannot find offer with publisher {}, product {} and plan {}.'.format(publisher, product, plan))
parameters = {}
parameters['publisher'] = publisher
parameters['product'] = product
parameters['plan'] = plan
parameters['license_text_link'] = offerDetail.license_text_link
parameters['privacy_policy_link'] = offerDetail.privacy_policy_link
parameters['marketplace_terms_link'] = offerDetail.marketplace_terms_link
parameters['retrieve_datetime'] = offerDetail.retrieve_datetime
parameters['signature'] = offerDetail.signature
parameters['accepted'] = True
return client.create(offer_type="virtualmachine",
publisher_id=publisher,
offer_id=product,
plan_id=plan,
parameters=parameters)
Loading