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

[AutoPR billing] Fixing s360 swagger correctness #1905

Closed
wants to merge 1 commit 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
8 changes: 8 additions & 0 deletions src/billing/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
257 changes: 257 additions & 0 deletions src/billing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
# Azure CLI billing Extension #
This is the extension for billing

### How to use ###
Install this extension using the below CLI command
```
az extension add --name billing
```

### Included Features ###
#### billing account ####
##### List #####
```
az billing account list
```
##### List #####
```
az billing account list --expand "soldTo,billingProfiles,billingProfiles/invoiceSections"
```
##### List #####
```
az billing account list --expand "enrollmentDetails,departments,enrollmentAccounts"
```
##### Show #####
```
az billing account show --expand "soldTo,billingProfiles,billingProfiles/invoiceSections" --name "{billingAccountName}"
```
##### Show #####
```
az billing account show --name "{billingAccountName}"
```
##### Update #####
```
az billing account update --name "{billingAccountName}" --display-name "Test Account" \
--sold-to address-line1="Test Address 1" city="Redmond" company-name="Contoso" country="US" first-name="Test" last-name="User" postal-code="12345" region="WA"
```
#### billing balance ####
##### Show #####
```
az billing balance show --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
#### billing instruction ####
##### Create #####
```
az billing instruction create --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{instructionName}" --amount 5000 --end-date "2020-12-30T21:26:47.997Z" \
--start-date "2019-12-30T21:26:47.997Z"
```
##### Show #####
```
az billing instruction show --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{instructionName}"
```
##### List #####
```
az billing instruction list --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
#### billing profile ####
##### Create #####
```
az billing profile create --account-name "{billingAccountName}" --name "{billingProfileName}" \
--bill-to address-line1="Test Address 1" city="Redmond" country="US" first-name="Test" last-name="User" postal-code="12345" region="WA" \
--display-name "Finance" --enabled-azure-plans sku-id="0001" --enabled-azure-plans sku-id="0002" \
--invoice-email-opt-in true --po-number "ABC12345"
```
##### List #####
```
az billing profile list --expand "invoiceSections" --account-name "{billingAccountName}"
```
##### Show #####
```
az billing profile show --account-name "{billingAccountName}" --name "{billingProfileName}"
```
##### Show #####
```
az billing profile show --expand "invoiceSections" --account-name "{billingAccountName}" --name "{billingProfileName}"
```
##### List #####
```
az billing profile list --account-name "{billingAccountName}"
```
#### billing customer ####
##### List #####
```
az billing customer list --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
##### Show #####
```
az billing customer show --account-name "{billingAccountName}" --name "{customerName}"
```
##### Show #####
```
az billing customer show --expand "enabledAzurePlans,resellers" --account-name "{billingAccountName}" \
--name "{customerName}"
```
#### billing invoice section ####
##### Create #####
```
az billing invoice section create --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{invoiceSectionName}" --display-name "invoiceSection1" --labels costCategory="Support" pcCode="A123456"
```
##### Show #####
```
az billing invoice section show --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{invoiceSectionName}"
```
##### List #####
```
az billing invoice section list --account-name "{billingAccountName}" --profile-name "{billingProfileName}"
```
#### billing permission ####
##### List #####
```
az billing permission list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
#### billing subscription ####
##### List #####
```
az billing subscription list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
##### Show #####
```
az billing subscription show --account-name "{billingAccountName}"
```
##### Update #####
```
az billing subscription update --account-name "{billingAccountName}" --cost-center "ABC1234"
```
##### Move #####
```
az billing subscription move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
##### Validate-move #####
```
az billing subscription validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
##### Validate-move #####
```
az billing subscription validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"
```
#### billing product ####
##### List #####
```
az billing product list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
##### Show #####
```
az billing product show --account-name "{billingAccountName}" --name "{productName}"
```
##### Update #####
```
az billing product update --account-name "{billingAccountName}" --auto-renew "Off" --name "{productName}"
```
##### Move #####
```
az billing product move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
##### Validate-move #####
```
az billing product validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
##### Validate-move #####
```
az billing product validate-move --account-name "{billingAccountName}" \
--destination-invoice-section-id "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" \
--name "{productName}"
```
#### billing invoice ####
##### List #####
```
az billing invoice list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--period-end-date "2018-06-30" --period-start-date "2018-01-01"
```
##### List #####
```
az billing invoice list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--period-end-date "2018-06-30" --period-start-date "2018-01-01"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
##### Show #####
```
az billing invoice show --account-name "{billingAccountName}" --name "{invoiceName}"
```
#### billing transaction ####
##### List #####
```
az billing transaction list --account-name "{billingAccountName}" --invoice-name "{invoiceName}"
```
#### billing policy ####
##### Update #####
```
az billing policy update --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--marketplace-purchases "OnlyFreeAllowed" --reservation-purchases "NotAllowed" --view-charges "Allowed"
```
#### billing property ####
##### Show #####
```
az billing property show
```
##### Update #####
```
az billing property update --cost-center "1010"
```
#### billing role-definition ####
##### List #####
```
az billing role-definition list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
#### billing role-assignment ####
##### List #####
```
az billing role-assignment list --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--invoice-section-name "{invoiceSectionName}"
```
##### Delete #####
```
az billing role-assignment delete --account-name "{billingAccountName}" --profile-name "{billingProfileName}" \
--name "{billingRoleAssignmentName}" --invoice-section-name "{invoiceSectionName}"
```
#### billing agreement ####
##### List #####
```
az billing agreement list --account-name "{billingAccountName}"
```
##### Show #####
```
az billing agreement show --name "{agreementName}" --account-name "{billingAccountName}"
```
#### billing reservation ####
##### List #####
```
az billing reservation list --filter "properties/reservedResourceType eq \'VirtualMachines\'" \
--orderby "properties/userFriendlyAppliedScopeType asc" --account-name "{billingAccountName}" \
--profile-name "{billingProfileName}" --refresh-summary "true" --selected-state "Succeeded"
```
50 changes: 50 additions & 0 deletions src/billing/azext_billing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------
# 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
from azext_billing.generated._help import helps # pylint: disable=unused-import
try:
from azext_billing.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


class BillingManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_billing.generated._client_factory import cf_billing_cl
billing_custom = CliCommandType(
operations_tmpl='azext_billing.custom#{}',
client_factory=cf_billing_cl)
parent = super(BillingManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=billing_custom)

def load_command_table(self, args):
from azext_billing.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_billing.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_billing.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_billing.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = BillingManagementClientCommandsLoader
17 changes: 17 additions & 0 deletions src/billing/azext_billing/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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:
pass
3 changes: 3 additions & 0 deletions src/billing/azext_billing/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"azext.minCliCoreVersion": "2.15.0"
}
17 changes: 17 additions & 0 deletions src/billing/azext_billing/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# 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:
pass
12 changes: 12 additions & 0 deletions src/billing/azext_billing/generated/__init__.py
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__)
Loading