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

[ReleasePR account] Adding optional parameter for alias #2482

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
7 changes: 0 additions & 7 deletions src/account/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
Release History
===============

0.2.0
+++++
* Breaking Change: remove `az account subscription create`.
* Add az account alias commands.
* Add az account tenant commands.
* Support sovereign clouds.

0.1.0
++++++
* Initial release.
File renamed without changes.
3 changes: 0 additions & 3 deletions src/account/azext_account/.flake8

This file was deleted.

23 changes: 16 additions & 7 deletions src/account/azext_account/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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
from azext_account.generated._help import helps # pylint: disable=unused-import
try:
from azext_account.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class SubscriptionClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_account.generated._client_factory import cf_account
from azext_account.generated._client_factory import cf_account_cl
account_custom = CliCommandType(
operations_tmpl='azext_account.custom#{}',
client_factory=cf_account)
super(SubscriptionClientCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=account_custom)
client_factory=cf_account_cl)
parent = super(SubscriptionClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=account_custom)

def load_command_table(self, args):
from azext_account.generated.commands import load_command_table
Expand Down
16 changes: 10 additions & 6 deletions src/account/azext_account/action.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# 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 azext_account.generated.action import * # noqa: F403
from .generated.action import * # noqa: F403
try:
from azext_account.manual.action import * # noqa: F403
from .manual.action import * # noqa: F403
except ImportError:
pass
2 changes: 1 addition & 1 deletion src/account/azext_account/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
"azext.minCliCoreVersion": "2.11.0"
}
16 changes: 10 additions & 6 deletions src/account/azext_account/custom.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# 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 azext_account.generated.custom import * # noqa: F403
from .generated.custom import * # noqa: F403
try:
from azext_account.manual.custom import * # noqa: F403
from .manual.custom import * # noqa: F403
except ImportError:
pass
14 changes: 11 additions & 3 deletions src/account/azext_account/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +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.
# --------------------------------------------------------------------------------------------
# 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__)
30 changes: 19 additions & 11 deletions src/account/azext_account/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# 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_account(cli_ctx, *_):
from azure.cli.core.commands.client_factory import _get_mgmt_service_client
def cf_account_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.subscription import SubscriptionClient
return _get_mgmt_service_client(cli_ctx, SubscriptionClient,
subscription_bound=False,
base_url_bound=True)[0]
return get_mgmt_service_client(cli_ctx,
SubscriptionClient)


def cf_subscription(cli_ctx, *_):
return cf_account(cli_ctx).subscription
return cf_account_cl(cli_ctx).subscription


def cf_tenant(cli_ctx, *_):
return cf_account(cli_ctx).tenant
return cf_account_cl(cli_ctx).tenant


def cf_subscription(cli_ctx, *_):
return cf_account_cl(cli_ctx).subscription


def cf_alias(cli_ctx, *_):
return cf_account(cli_ctx).alias
return cf_account_cl(cli_ctx).alias
115 changes: 68 additions & 47 deletions src/account/azext_account/generated/_help.py
Original file line number Diff line number Diff line change
@@ -1,104 +1,114 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
# 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['account subscription'] = """
type: group
short-summary: Manage subscriptions
short-summary: account subscription
"""

helps['account subscription rename'] = """
helps['account subscription list'] = """
type: command
short-summary: Rename subscription
short-summary: "Gets all subscriptions for a tenant."
examples:
- name: Rename subscription
- name: listSubscriptions
text: |-
az account subscription rename --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
az account subscription list
"""

helps['account subscription cancel'] = """
helps['account subscription show'] = """
type: command
short-summary: Cancel subscription
short-summary: "Gets details about a specified subscription."
examples:
- name: Cancel subscription
- name: getSubscription
text: |-
az account subscription cancel --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
az account subscription show --subscription-id "83aa47df-e3e9-49ff-877b-94304bf3d3ad"
"""

helps['account subscription enable'] = """
helps['account subscription list-location'] = """
type: command
short-summary: Enable subscription
short-summary: "This operation provides all the locations that are available for resource providers; however, each \
resource provider may support a subset of this list."
examples:
- name: Enable subscription
- name: listLocations
text: |-
az account subscription enable --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
az account subscription list-location --subscription-id "83aa47df-e3e9-49ff-877b-94304bf3d3ad"
"""

helps['account subscription list'] = """
helps['account tenant'] = """
type: group
short-summary: account tenant
"""

helps['account tenant list'] = """
type: command
short-summary: Get all subscriptions for a tenant.
short-summary: "Gets the tenants for your account."
examples:
- name: listSubscriptions
- name: listTenants
text: |-
az account subscription list
az account tenant list
"""

helps['account subscription show'] = """
helps['account subscription'] = """
type: group
short-summary: account subscription
"""

helps['account subscription cancel'] = """
type: command
short-summary: Get details about a specified subscription.
short-summary: "The operation to cancel a subscription"
examples:
- name: getSubscription
- name: cancelSubscription
text: |-
az account subscription show --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
az account subscription cancel --subscription-id "83aa47df-e3e9-49ff-877b-94304bf3d3ad"
"""

helps['account subscription list-location'] = """
helps['account subscription enable'] = """
type: command
short-summary: This operation provides all the locations that are available for resource providers; however, each r\
esource provider may support a subset of this list.
short-summary: "The operation to enable a subscription"
examples:
- name: listLocations
- name: enableSubscription
text: |-
az account subscription list-location --subscription-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
az account subscription enable --subscription-id "7948bcee-488c-47ce-941c-38e20ede803d"
"""

helps['account tenant'] = """
type: group
short-summary: Manage tenant
"""

helps['account tenant list'] = """
helps['account subscription rename'] = """
type: command
short-summary: Get the tenants for your account.
short-summary: "The operation to rename a subscription"
examples:
- name: listTenants
- name: renameSubscription
text: |-
az account tenant list
az account subscription rename --name "Test Sub" --subscription-id "83aa47df-e3e9-49ff-877b-94304bf3d3ad\
"
"""

helps['account alias'] = """
type: group
short-summary: Manage subscription alias
short-summary: account alias
"""

helps['account alias list'] = """
type: command
short-summary: List Alias Subscriptions.
short-summary: "Get Alias Subscription."
examples:
- name: List Alias Subscriptions
- name: GetAlias
text: |-
az account alias list
"""

helps['account alias show'] = """
type: command
short-summary: Get Alias Subscription.
short-summary: "Get Alias Subscription."
examples:
- name: GetAlias
text: |-
Expand All @@ -108,17 +118,28 @@
helps['account alias create'] = """
type: command
short-summary: "Create Alias Subscription."
parameters:
- name: --properties
short-summary: "Put alias request properties."
long-summary: |
Usage: --properties display-name=XX workload=XX billing-scope=XX subscription-id=XX reseller-id=XX

display-name: The friendly name of the subscription.
workload: The workload type of the subscription. It can be either Production or DevTest.
billing-scope: Determines whether subscription is fieldLed, partnerLed or LegacyEA
subscription-id: This parameter can be used to create alias for existing subscription Id
reseller-id: Reseller ID, basically MPN Id
examples:
- name: CreateAlias
text: |-
az account alias create --name "aliasForNewSub" --billing-scope "/providers/Microsoft.Billing/billingAcc\
ounts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31/billingProfiles/PE2Q-NOIT-BG\
7-TGB/invoiceSections/MTT4-OBS7-PJA-TGB" --display-name "Contoso MCA subscription" --workload "Production"
az account alias create --name "aliasForNewSub" --properties billing-scope="/providers/Microsoft.Billing\
/billingAccounts/e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31/billingProfiles/P\
E2Q-NOIT-BG7-TGB/invoiceSections/MTT4-OBS7-PJA-TGB" display-name="Contoso MCA subscription" workload="Production"
"""

helps['account alias delete'] = """
type: command
short-summary: Delete Alias.
short-summary: "Delete Alias."
examples:
- name: DeleteAlias
text: |-
Expand Down
Loading