Hello community,
here is the log from the commit of package azure-cli-consumption for
openSUSE:Factory checked in at 2018-10-15 10:47:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-consumption (Old)
and /work/SRC/openSUSE:Factory/.azure-cli-consumption.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-consumption"
Mon Oct 15 10:47:11 2018 rev:4 rq:641215 version:0.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/azure-cli-consumption/azure-cli-consumption.changes
2018-05-13 16:01:54.145254891 +0200
+++
/work/SRC/openSUSE:Factory/.azure-cli-consumption.new/azure-cli-consumption.changes
2018-10-15 10:47:13.803147239 +0200
@@ -1,0 +2,8 @@
+Mon Sep 17 09:37:57 UTC 2018 - John Paul Adrian Glaubitz
<[email protected]>
+
+- New upstream release
+ + Version 0.4.0
+ + For detailed information about changes see the
+ HISTORY.txt file provided with this package
+
+-------------------------------------------------------------------
Old:
----
azure-cli-consumption-0.3.0.tar.gz
New:
----
azure-cli-consumption-0.4.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ azure-cli-consumption.spec ++++++
--- /var/tmp/diff_new_pack.hnvZAU/_old 2018-10-15 10:47:14.359146645 +0200
+++ /var/tmp/diff_new_pack.hnvZAU/_new 2018-10-15 10:47:14.359146645 +0200
@@ -12,12 +12,12 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: azure-cli-consumption
-Version: 0.3.0
+Version: 0.4.0
Release: 0
Summary: Microsoft Azure CLI 'consumption' Command Module
License: MIT
++++++ azure-cli-consumption-0.3.0.tar.gz -> azure-cli-consumption-0.4.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.3.0/HISTORY.rst
new/azure-cli-consumption-0.4.0/HISTORY.rst
--- old/azure-cli-consumption-0.3.0/HISTORY.rst 2018-04-06 19:33:13.000000000
+0200
+++ new/azure-cli-consumption-0.4.0/HISTORY.rst 2018-07-14 01:41:34.000000000
+0200
@@ -2,6 +2,19 @@
Release History
===============
+
+0.4.0
++++++
+* BREAKING CHANGE: 'show' commands log error message and fail with exit code
of 3 upon a missing resource.
+
+0.3.2
+++++++
+* Minor fixes.
+
+0.3.1
++++++
+* Added new commands for budget API.
+
0.3.0
+++++
* Added commands `marketplace`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.3.0/PKG-INFO
new/azure-cli-consumption-0.4.0/PKG-INFO
--- old/azure-cli-consumption-0.3.0/PKG-INFO 2018-04-06 19:33:42.000000000
+0200
+++ new/azure-cli-consumption-0.4.0/PKG-INFO 2018-07-14 01:41:58.000000000
+0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: azure-cli-consumption
-Version: 0.3.0
+Version: 0.4.0
Summary: Microsoft Azure Command-Line Tools Consumption Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
-Description-Content-Type: UNKNOWN
Description: Microsoft Azure CLI 'consumption' Command Module
================================================
@@ -20,6 +19,19 @@
Release History
===============
+
+ 0.4.0
+ +++++
+ * BREAKING CHANGE: 'show' commands log error message and fail with
exit code of 3 upon a missing resource.
+
+ 0.3.2
+ ++++++
+ * Minor fixes.
+
+ 0.3.1
+ +++++
+ * Added new commands for budget API.
+
0.3.0
+++++
* Added commands `marketplace`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_client_factory.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_client_factory.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_client_factory.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_client_factory.py
2018-07-14 01:41:34.000000000 +0200
@@ -28,3 +28,7 @@
def marketplace_mgmt_client_factory(cli_ctx, kwargs):
return cf_consumption(cli_ctx, **kwargs).marketplaces
+
+
+def budget_mgmt_client_factory(cli_ctx, kwargs):
+ return cf_consumption(cli_ctx, **kwargs).budgets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_help.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_help.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_help.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_help.py
2018-07-14 01:41:34.000000000 +0200
@@ -1,3 +1,4 @@
+# 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.
@@ -63,3 +64,28 @@
type: command
short-summary: List the marketplace for an Azure subscription within a
billing period.
"""
+
+helps['consumption budget'] = """
+ type: group
+ short-summary: Manage budgets for an Azure subscription.
+"""
+
+helps['consumption budget list'] = """
+ type: command
+ short-summary: List budgets for an Azure subscription.
+"""
+
+helps['consumption budget show'] = """
+ type: command
+ short-summary: Show budget for an Azure subscription.
+"""
+
+helps['consumption budget create'] = """
+ type: command
+ short-summary: Create a budget for an Azure subscription.
+"""
+
+helps['consumption budget delete'] = """
+ type: command
+ short-summary: Delete a budget for an Azure subscription.
+"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_params.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_params.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_params.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_params.py
2018-07-14 01:41:34.000000000 +0200
@@ -4,7 +4,10 @@
#
--------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
-from ._validators import get_datetime_type
+# pylint: disable=too-many-statements
+from azure.cli.core.commands.parameters import get_enum_type
+from ._validators import (datetime_type,
+ decimal_type)
def load_arguments(self, _):
@@ -12,25 +15,36 @@
c.argument('top', options_list=['--top', '-t'], type=int,
help='Maximum number of items to return. Value range: 1-1000.')
c.argument('include_additional_properties',
options_list=['--include-additional-properties', '-a'], action='store_true',
help='Include additional properties in the usages.')
c.argument('include_meter_details',
options_list=['--include-meter-details', '-m'], action='store_true',
help='Include meter details in the usages.')
- c.argument('start_date', options_list=['--start-date', '-s'],
type=get_datetime_type(), help='Start date (YYYY-MM-DD in UTC). If specified,
also requires --end-date.')
- c.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='End date (YYYY-MM-DD in UTC). If specified,
also requires --start-date.')
+ c.argument('start_date', options_list=['--start-date', '-s'],
type=datetime_type, help='Start date (YYYY-MM-DD in UTC). If specified, also
requires --end-date.')
+ c.argument('end_date', options_list=['--end-date', '-e'],
type=datetime_type, help='End date (YYYY-MM-DD in UTC). If specified, also
requires --start-date.')
c.argument('billing_period_name',
options_list=['--billing-period-name', '-p'], help='Name of the billing period
to get the usage details that associate with.')
with self.argument_context('consumption reservation') as rs:
- rs.argument('reservation_order_id',
options_list='--reservation-order-id', help='Reservation order id.')
- rs.argument('start_date', options_list=['--start-date', '-s'],
type=get_datetime_type(), help='Start date (YYYY-MM-DD in UTC). Only needed for
daily grain and if specified, also requires --end-date.')
- rs.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='End date (YYYY-MM-DD in UTC). Only needed for
daily grain and if specified, also requires --start-date.')
- rs.argument('reservation_id', options_list='--reservation-id',
help='Reservation id.')
+ rs.argument('reservation_order_id', help='Reservation order id.')
+ rs.argument('start_date', options_list=['--start-date', '-s'],
type=datetime_type, help='Start date (YYYY-MM-DD in UTC). Only needed for daily
grain and if specified, also requires --end-date.')
+ rs.argument('end_date', options_list=['--end-date', '-e'],
type=datetime_type, help='End date (YYYY-MM-DD in UTC). Only needed for daily
grain and if specified, also requires --start-date.')
+ rs.argument('reservation_id', help='Reservation id.')
with self.argument_context('consumption reservation summary list') as rs:
- rs.argument('grain', options_list='--grain', type=str,
help='Reservation summary grain. Possible values are daily or monthly.')
+ rs.argument('grain', help='Reservation summary grain. Possible values
are daily or monthly.')
with self.argument_context('consumption pricesheet show') as cps:
- cps.argument('include_meter_details',
options_list='--include-meter-details', action='store_true', help='Include
meter details in the price sheet.')
+ cps.argument('include_meter_details', action='store_true',
help='Include meter details in the price sheet.')
cps.argument('billing_period_name',
options_list=['--billing-period-name', '-p'], help='Name of the billing period
to get the price sheet.')
with self.argument_context('consumption marketplace list') as cmp:
cmp.argument('billing_period_name',
options_list=['--billing-period-name', '-p'], help='Name of the billing period
to get the marketplace.')
cmp.argument('top', options_list=['--top', '-t'], type=int,
help='Maximum number of items to return. Value range: 1-1000.')
- cmp.argument('start_date', options_list=['--start-date', '-s'],
type=get_datetime_type(), help='Start date (YYYY-MM-DD in UTC). If specified,
also requires --end-date.')
- cmp.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='End date (YYYY-MM-DD in UTC). If specified,
also requires --start-date.')
+ cmp.argument('start_date', options_list=['--start-date', '-s'],
type=datetime_type, help='Start date (YYYY-MM-DD in UTC). If specified, also
requires --end-date.')
+ cmp.argument('end_date', options_list=['--end-date', '-e'],
type=datetime_type, help='End date (YYYY-MM-DD in UTC). If specified, also
requires --start-date.')
+
+ with self.argument_context('consumption budget') as cb:
+ cb.argument('budget_name', help='Name of a budget.')
+ cb.argument('category', arg_type=get_enum_type(['cost', 'usage']),
help='Category of the budget can be cost or usage.')
+ cb.argument('amount', type=decimal_type, help='Amount of a budget.')
+ cb.argument('time_grain', arg_type=get_enum_type(['monthly',
'quarterly', 'annually']), help='Time grain of the budget can be monthly,
quarterly, or annually.')
+ cb.argument('start_date', options_list=['--start-date', '-s'],
type=datetime_type, help='Start date (YYYY-MM-DD in UTC) of time period of a
budget.')
+ cb.argument('end_date', options_list=['--end-date', '-e'],
type=datetime_type, help='End date (YYYY-MM-DD in UTC) of time period of a
budget.')
+ cb.argument('resource_groups', options_list='--resource-group-filter',
nargs='+', help='Space-separated list of resource groups to filter on.')
+ cb.argument('resources', options_list='--resource-filter', nargs='+',
help='Space-separated list of resource instances to filter on.')
+ cb.argument('meters', options_list='--meter-filter', nargs='+',
help='Space-separated list of meters to filter on. Required if category is
usage.')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_transformers.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_transformers.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_transformers.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_transformers.py
2018-07-14 01:41:34.000000000 +0200
@@ -72,3 +72,22 @@
def transform_marketplace_list_output(result):
return [marketplace_list_output(item) for item in result]
+
+
+def budget_output(result):
+ result.amount = str(result.amount)
+ if result.current_spend:
+ result.current_spend.amount = str(result.current_spend.amount)
+ return result
+
+
+def transform_budget_list_output(result):
+ return [budget_output(item) for item in result]
+
+
+def transform_budget_show_output(result):
+ return budget_output(result)
+
+
+def transform_budget_create_update_output(result):
+ return budget_output(result)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_validators.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_validators.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_validators.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/_validators.py
2018-07-14 01:41:34.000000000 +0200
@@ -4,24 +4,27 @@
#
--------------------------------------------------------------------------------------------
from datetime import datetime
+from decimal import Decimal
from azure.cli.core.util import CLIError
-def get_datetime_type():
+def datetime_type(string):
""" Validates UTC datetime. Examples of accepted forms:
2017-12-31T01:11:59Z,2017-12-31T01:11Z or 2017-12-31T01Z or 2017-12-31 """
- def datetime_type(string):
- """ Validates UTC datetime. Examples of accepted forms:
- 2017-12-31T01:11:59Z,2017-12-31T01:11Z or 2017-12-31T01Z or 2017-12-31
"""
- accepted_date_formats = ['%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%dT%H:%MZ',
- '%Y-%m-%dT%HZ', '%Y-%m-%d']
- for form in accepted_date_formats:
- try:
- return datetime.strptime(string, form)
- except ValueError:
- continue
- raise ValueError("Input '{}' not valid. Valid example:
2017-02-11T23:59:59Z".format(string))
- return datetime_type
+ accepted_date_formats = ['%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%dT%H:%MZ',
'%Y-%m-%dT%HZ', '%Y-%m-%d']
+ for form in accepted_date_formats:
+ try:
+ return datetime.strptime(string, form)
+ except ValueError:
+ continue
+ raise ValueError("Input '{}' not valid. Valid example:
2017-02-11T23:59:59Z".format(string))
+
+
+def decimal_type(string):
+ try:
+ return Decimal(string)
+ except ValueError:
+ raise ValueError("the value passed cannot be converted to decimal")
def validate_both_start_end_dates(namespace):
@@ -37,3 +40,8 @@
raise CLIError("usage error: --grain can be either daily or monthly.")
if data_grain == 'daily' and (not namespace.start_date or not
namespace.end_date):
raise CLIError("usage error: Both --start-date and --end-date need to
be supplied for daily grain.")
+
+
+def validate_budget_parameters(namespace):
+ if namespace.amount < 0:
+ raise CLIError("usage error: --amount must be greater than 0")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/commands.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/commands.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/commands.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/commands.py
2018-07-14 01:41:34.000000000 +0200
@@ -8,15 +8,20 @@
transform_reservation_summary_list_output,
transform_reservation_detail_list_output,
transform_pricesheet_show_output,
- transform_marketplace_list_output)
+ transform_marketplace_list_output,
+ transform_budget_list_output,
+ transform_budget_show_output,
+ transform_budget_create_update_output)
from ._client_factory import (usage_details_mgmt_client_factory,
reservation_summary_mgmt_client_factory,
reservation_detail_mgmt_client_factory,
pricesheet_mgmt_client_factory,
- marketplace_mgmt_client_factory)
+ marketplace_mgmt_client_factory,
+ budget_mgmt_client_factory)
from ._exception_handler import consumption_exception_handler
from ._validators import (validate_both_start_end_dates,
- validate_reservation_summary)
+ validate_reservation_summary,
+ validate_budget_parameters)
def load_command_table(self, _):
@@ -33,9 +38,18 @@
exception_handler=consumption_exception_handler,
client_factory=reservation_detail_mgmt_client_factory)
with self.command_group('consumption pricesheet') as p:
- p.custom_command('show', 'cli_consumption_list_pricesheet_show',
transform=transform_pricesheet_show_output,
- exception_handler=consumption_exception_handler,
client_factory=pricesheet_mgmt_client_factory)
+ p.custom_show_command('show', 'cli_consumption_list_pricesheet_show',
transform=transform_pricesheet_show_output,
+ exception_handler=consumption_exception_handler,
client_factory=pricesheet_mgmt_client_factory)
with self.command_group('consumption marketplace') as m:
m.custom_command('list', 'cli_consumption_list_marketplace',
transform=transform_marketplace_list_output,
exception_handler=consumption_exception_handler,
validator=validate_both_start_end_dates,
client_factory=marketplace_mgmt_client_factory)
+
+ with self.command_group('consumption budget',
exception_handler=consumption_exception_handler,
client_factory=budget_mgmt_client_factory) as p:
+ p.custom_command('list', 'cli_consumption_list_budgets',
transform=transform_budget_list_output)
+
+ p.custom_show_command('show', 'cli_consumption_show_budget',
transform=transform_budget_show_output)
+
+ p.custom_command('create', 'cli_consumption_create_budget',
transform=transform_budget_create_update_output,
validator=validate_budget_parameters)
+
+ p.custom_command('delete', 'cli_consumption_delete_budget')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/custom.py
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/custom.py
---
old/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/custom.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-consumption-0.4.0/azure/cli/command_modules/consumption/custom.py
2018-07-14 01:41:34.000000000 +0200
@@ -89,3 +89,30 @@
elif not billing_period_name and top:
return list(client.list(filter=filter_expression,
top=top).advance_page())
return client.list(filter=filter_expression)
+
+
+def cli_consumption_list_budgets(client, resource_group_name=None):
+ if resource_group_name:
+ return client.list_by_resource_group_name(resource_group_name)
+ return client.list()
+
+
+def cli_consumption_show_budget(client, budget_name, resource_group_name=None):
+ if resource_group_name:
+ return client.get_by_resource_group_name(resource_group_name,
budget_name)
+ return client.get(budget_name)
+
+
+def cli_consumption_create_budget(client, budget_name, category, amount,
time_grain, start_date, end_date, resource_groups=None, resources=None,
meters=None, resource_group_name=None):
+ time_period = client.models.BudgetTimePeriod(start_date, end_date)
+ filters = client.models.Filters(resource_groups=resource_groups,
resources=resources, meters=meters)
+ parameters = client.models.Budget(category=category, amount=amount,
time_grain=time_grain, time_period=time_period, filters=filters,
notifications=None)
+ if resource_group_name:
+ return client.create_or_update(resource_group_name, budget_name,
parameters)
+ return client.create_or_update(budget_name, parameters)
+
+
+def cli_consumption_delete_budget(client, budget_name,
resource_group_name=None):
+ if resource_group_name:
+ return client.delete(resource_group_name, budget_name)
+ return client.delete(budget_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/PKG-INFO
new/azure-cli-consumption-0.4.0/azure_cli_consumption.egg-info/PKG-INFO
--- old/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/PKG-INFO
2018-04-06 19:33:42.000000000 +0200
+++ new/azure-cli-consumption-0.4.0/azure_cli_consumption.egg-info/PKG-INFO
2018-07-14 01:41:58.000000000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: azure-cli-consumption
-Version: 0.3.0
+Version: 0.4.0
Summary: Microsoft Azure Command-Line Tools Consumption Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
-Description-Content-Type: UNKNOWN
Description: Microsoft Azure CLI 'consumption' Command Module
================================================
@@ -20,6 +19,19 @@
Release History
===============
+
+ 0.4.0
+ +++++
+ * BREAKING CHANGE: 'show' commands log error message and fail with
exit code of 3 upon a missing resource.
+
+ 0.3.2
+ ++++++
+ * Minor fixes.
+
+ 0.3.1
+ +++++
+ * Added new commands for budget API.
+
0.3.0
+++++
* Added commands `marketplace`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.3.0/setup.py
new/azure-cli-consumption-0.4.0/setup.py
--- old/azure-cli-consumption-0.3.0/setup.py 2018-04-06 19:33:13.000000000
+0200
+++ new/azure-cli-consumption-0.4.0/setup.py 2018-07-14 01:41:34.000000000
+0200
@@ -16,7 +16,7 @@
cmdclass = {}
-VERSION = "0.3.0"
+VERSION = "0.4.0"
# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [