-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[MarketplaceOrdering] New command group az term to accept/show terms
#17686
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b1d62f9
MarketplaceOrdering init checkin
yungezz 73deb19
update doc_source_map
yungezz 6897c6c
resolve comments
yungezz 592a5ff
Merge branch 'dev' into term
yungezz f0b3798
re-record test after manual customize
yungezz e5fb3dc
add none check
yungezz 09f697b
Merge branch 'dev' into term
yungezz fc180a4
update help
yungezz ddc2d6b
fix linter
yungezz 5de5d11
fix linter: unused-import in helper
yungezz d0f4d22
manual customize sample in help.py
yungezz c5fd000
Merge branch 'dev' into term
yungezz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/azure-cli/azure/cli/command_modules/marketplaceordering/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
|
|
||
| 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 | ||
20 changes: 20 additions & 0 deletions
20
src/azure-cli/azure/cli/command_modules/marketplaceordering/_help.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
20 changes: 20 additions & 0 deletions
20
src/azure-cli/azure/cli/command_modules/marketplaceordering/action.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
20 changes: 20 additions & 0 deletions
20
src/azure-cli/azure/cli/command_modules/marketplaceordering/custom.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
12 changes: 12 additions & 0 deletions
12
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__) |
20 changes: 20 additions & 0 deletions
20
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_client_factory.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
36 changes: 36 additions & 0 deletions
36
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_help.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| """ | ||
24 changes: 24 additions & 0 deletions
24
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_params.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.') |
9 changes: 9 additions & 0 deletions
9
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/_validators.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
| # -------------------------------------------------------------------------- |
10 changes: 10 additions & 0 deletions
10
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/action.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
31 changes: 31 additions & 0 deletions
31
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/commands.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
|
||
20 changes: 20 additions & 0 deletions
20
src/azure-cli/azure/cli/command_modules/marketplaceordering/generated/custom.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
12 changes: 12 additions & 0 deletions
12
src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__) |
36 changes: 36 additions & 0 deletions
36
src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/_help.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| """ |
39 changes: 39 additions & 0 deletions
39
src/azure-cli/azure/cli/command_modules/marketplaceordering/manual/custom.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.