Hello community,
here is the log from the commit of package azure-cli-consumption for
openSUSE:Factory checked in at 2018-05-13 16:01:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-consumption (Old)
and /work/SRC/openSUSE:Factory/.azure-cli-consumption.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-consumption"
Sun May 13 16:01:49 2018 rev:3 rq:600042 version:0.3.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/azure-cli-consumption/azure-cli-consumption.changes
2018-02-14 09:30:27.426012713 +0100
+++
/work/SRC/openSUSE:Factory/.azure-cli-consumption.new/azure-cli-consumption.changes
2018-05-13 16:01:54.145254891 +0200
@@ -1,0 +2,8 @@
+Wed Apr 18 10:52:00 UTC 2018 - [email protected]
+
+- New upstream release
+ + Version 0.3.0
+- Move LICENSE.txt from %doc to %license section
+- Update Requires from setup.py
+
+-------------------------------------------------------------------
Old:
----
azure-cli-consumption-0.2.1.tar.gz
New:
----
azure-cli-consumption-0.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ azure-cli-consumption.spec ++++++
--- /var/tmp/diff_new_pack.g4QHse/_old 2018-05-13 16:01:54.945225705 +0200
+++ /var/tmp/diff_new_pack.g4QHse/_new 2018-05-13 16:01:54.949225558 +0200
@@ -17,7 +17,7 @@
Name: azure-cli-consumption
-Version: 0.2.1
+Version: 0.3.0
Release: 0
Summary: Microsoft Azure CLI 'consumption' Command Module
License: MIT
@@ -32,8 +32,9 @@
BuildRequires: python3-setuptools
BuildRequires: unzip
Requires: azure-cli-command-modules-nspkg
+Requires: azure-cli-core
Requires: azure-cli-nspkg
-Requires: python3-azure-mgmt-consumption >= 1.1.0
+Requires: python3-azure-mgmt-consumption >= 2.0.0
Requires: python3-azure-nspkg
Conflicts: azure-cli < 2.0.0
@@ -63,7 +64,8 @@
%files
%defattr(-,root,root,-)
-%doc HISTORY.rst LICENSE.txt README.rst
+%doc HISTORY.rst README.rst
+%license LICENSE.txt
%{python3_sitelib}/azure/cli/command_modules/consumption
%{python3_sitelib}/azure_cli_consumption-*.egg-info
++++++ azure-cli-consumption-0.2.1.tar.gz -> azure-cli-consumption-0.3.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.2.1/HISTORY.rst
new/azure-cli-consumption-0.3.0/HISTORY.rst
--- old/azure-cli-consumption-0.2.1/HISTORY.rst 2018-01-05 20:41:15.000000000
+0100
+++ new/azure-cli-consumption-0.3.0/HISTORY.rst 2018-04-06 19:33:13.000000000
+0200
@@ -2,6 +2,20 @@
Release History
===============
+0.3.0
++++++
+* Added commands `marketplace`.
+* BREAKING CHANGE: `reservations summaries` commands renamed to `reservation
summary`.
+* BREAKING CHANGE: `reservations details` commands renamed to `reservation
detail`.
+* BREAKING CHANGE: removed `--reservation-order-id` and `--reservation-id`
short options for `reservation` commands.
+* BREAKING CHANGE: removed `--grain` short options for `reservation summary`
commands.
+* BREAKING CHANGE: removed `--include-meter-details` short options for
`pricesheet` commands.
+* `sdist` is now compatible with wheel 0.31.0
+
+0.2.2
++++++
+* Added new commands for pricesheet API. Also, updated the existing Usage
Details and Reservation Details API request format.
+
0.2.1
+++++
* Added two new commands for reservations. Reservation Summaries and
Reservation Details
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.2.1/PKG-INFO
new/azure-cli-consumption-0.3.0/PKG-INFO
--- old/azure-cli-consumption-0.2.1/PKG-INFO 2018-01-05 20:42:02.000000000
+0100
+++ new/azure-cli-consumption-0.3.0/PKG-INFO 2018-04-06 19:33:42.000000000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: azure-cli-consumption
-Version: 0.2.1
+Version: 0.3.0
Summary: Microsoft Azure Command-Line Tools Consumption Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
@@ -20,6 +20,20 @@
Release History
===============
+ 0.3.0
+ +++++
+ * Added commands `marketplace`.
+ * BREAKING CHANGE: `reservations summaries` commands renamed to
`reservation summary`.
+ * BREAKING CHANGE: `reservations details` commands renamed to
`reservation detail`.
+ * BREAKING CHANGE: removed `--reservation-order-id` and
`--reservation-id` short options for `reservation` commands.
+ * BREAKING CHANGE: removed `--grain` short options for `reservation
summary` commands.
+ * BREAKING CHANGE: removed `--include-meter-details` short options for
`pricesheet` commands.
+ * `sdist` is now compatible with wheel 0.31.0
+
+ 0.2.2
+ +++++
+ * Added new commands for pricesheet API. Also, updated the existing
Usage Details and Reservation Details API request format.
+
0.2.1
+++++
* Added two new commands for reservations. Reservation Summaries and
Reservation Details
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_client_factory.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_client_factory.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_client_factory.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_client_factory.py
2018-04-06 19:33:13.000000000 +0200
@@ -14,9 +14,17 @@
return cf_consumption(cli_ctx, **kwargs).usage_details
-def reservations_summaries_mgmt_client_factory(cli_ctx, kwargs):
+def reservation_summary_mgmt_client_factory(cli_ctx, kwargs):
return cf_consumption(cli_ctx, **kwargs).reservations_summaries
-def reservations_details_mgmt_client_factory(cli_ctx, kwargs):
+def reservation_detail_mgmt_client_factory(cli_ctx, kwargs):
return cf_consumption(cli_ctx, **kwargs).reservations_details
+
+
+def pricesheet_mgmt_client_factory(cli_ctx, kwargs):
+ return cf_consumption(cli_ctx, **kwargs).price_sheet
+
+
+def marketplace_mgmt_client_factory(cli_ctx, kwargs):
+ return cf_consumption(cli_ctx, **kwargs).marketplaces
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_help.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_help.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_help.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_help.py
2018-04-06 19:33:13.000000000 +0200
@@ -10,19 +10,28 @@
short-summary: Manage consumption of Azure resources.
"""
-helps['consumption reservations'] = """
+helps['consumption reservation'] = """
type: group
short-summary: Manage reservations for Azure resources.
"""
-helps['consumption reservations summaries'] = """
+helps['consumption reservation summary'] = """
type: group
- short-summary: Manage reservations summaries for daily or monthly.
+ short-summary: List reservation summaries.
+"""
+helps['consumption reservation summary list'] = """
+ type: command
+ short-summary: List reservation summaries for daily or monthly by order Id
or reservation id.
"""
-helps['consumption reservations details'] = """
+helps['consumption reservation detail'] = """
type: group
- short-summary: Manage reservations details.
+ short-summary: List reservation details.
+"""
+
+helps['consumption reservation detail list'] = """
+ type: command
+ short-summary: List the details of a reservation by order id or
reservation id.
"""
helps['consumption usage'] = """
@@ -32,5 +41,25 @@
helps['consumption usage list'] = """
type: command
- short-summary: Show the details of Azure resource consumption, either as
an invoice or within a billing period.
+ short-summary: List the details of Azure resource consumption, either as
an invoice or within a billing period.
+"""
+
+helps['consumption pricesheet'] = """
+ type: group
+ short-summary: Inspect the price sheet of an Azure subscription within a
billing period.
+"""
+
+helps['consumption pricesheet show'] = """
+ type: command
+ short-summary: Show the price sheet for an Azure subscription within a
billing period.
+"""
+
+helps['consumption marketplace'] = """
+ type: group
+ short-summary: Inspect the marketplace usage data of an Azure subscription
within a billing period.
+"""
+
+helps['consumption marketplace list'] = """
+ type: command
+ short-summary: List the marketplace for an Azure subscription within a
billing period.
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_params.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_params.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_params.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_params.py
2018-04-06 19:33:13.000000000 +0200
@@ -8,21 +8,29 @@
def load_arguments(self, _):
- with self.argument_context('consumption usage list') as c:
- c.argument('top', options_list=['--top', '-t'], type=int,
help='maximum number of items to return. Accepted range for this value is 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 (in UTC Y-m-d) of the usages. Both
start date and end date need to be supplied or neither')
- c.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='end date (in UTC Y-m-d) of the usages. Both
start date and end date need to be supplied or neither')
- c.argument('billing_period_name',
options_list=['--billing-period-name', '-p'], help='name of a specific billing
period to get the usage details that associate with')
- with self.argument_context('consumption reservations summaries list') as
rs:
- rs.argument('reservationorderid',
options_list=['--reservation-order-id', '-r'], help='Reservation order id')
- rs.argument('reservationid', options_list=['--reservation-id', '-i'],
help='Reservation id')
- rs.argument('start_date', options_list=['--start-date', '-s'],
type=get_datetime_type(), help='start date (in UTC Y-m-d) of the reservation
summaries. Only needed for daily grain and both start date and end date need to
be supplied or neither')
- rs.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='end date (in UTC Y-m-d) of the reservation
summaries. Only needed for daily grain and both start date and end date need to
be supplied or neither')
- rs.argument('grain', options_list=['--grain', '-g'], type=str,
help='Reservation summaries grain. Possible values are daily or monthly')
- with self.argument_context('consumption reservations details list') as rd:
- rd.argument('reservationorderid',
options_list=['--reservation-order-id', '-r'], help='Reservation order id')
- rd.argument('reservationid', options_list=['--reservation-id', '-i'],
help='Reservation id')
- rd.argument('start_date', options_list=['--start-date', '-s'],
type=get_datetime_type(), help='start date (in UTC Y-m-d) of the reservation
summaries. Only needed for daily grain and both start date and end date need to
be supplied or neither')
- rd.argument('end_date', options_list=['--end-date', '-e'],
type=get_datetime_type(), help='end date (in UTC Y-m-d) of the reservation
summaries. Only needed for daily grain and both start date and end date need to
be supplied or neither')
+ with self.argument_context('consumption usage') as c:
+ 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('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.')
+
+ 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.')
+
+ 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('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.')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_transformers.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_transformers.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_transformers.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_transformers.py
2018-04-06 19:33:13.000000000 +0200
@@ -20,7 +20,7 @@
return [transform_usage_output(item) for item in result]
-def reservation_summaries_output(result):
+def reservation_summary_output(result):
result.reserved_hours = str(result.reserved_hours)
result.usage_date = result.usage_date.strftime("%Y-%m-%dT%H:%M:%SZ")
@@ -31,11 +31,11 @@
return result
-def transform_reservation_summaries_list_output(result):
- return [reservation_summaries_output(item) for item in result]
+def transform_reservation_summary_list_output(result):
+ return [reservation_summary_output(item) for item in result]
-def reservation_details_output(result):
+def reservation_detail_output(result):
result.reserved_hours = str(result.reserved_hours)
result.usage_date = result.usage_date.strftime("%Y-%m-%dT%H:%M:%SZ")
@@ -44,5 +44,31 @@
return result
-def transform_reservation_details_list_output(result):
- return [reservation_details_output(item) for item in result]
+def transform_reservation_detail_list_output(result):
+ return [reservation_detail_output(item) for item in result]
+
+
+def pricesheet_show_properties(result):
+ result.unit_of_measure = str(result.unit_of_measure)
+ result.included_quantity = str(result.included_quantity)
+ result.unit_price = str(result.unit_price)
+ if result.meter_details:
+ result.meter_details.total_included_quantity =
str(result.meter_details.total_included_quantity)
+ result.meter_details.pretax_standard_rate =
str(result.meter_details.pretax_standard_rate)
+ return result
+
+
+def transform_pricesheet_show_output(result):
+ result.pricesheets = [pricesheet_show_properties(item) for item in
result.pricesheets]
+ return result
+
+
+def marketplace_list_output(result):
+ result.pretax_cost = str(result.pretax_cost)
+ result.consumed_quantity = str(result.consumed_quantity)
+ result.resource_rate = str(result.resource_rate)
+ return result
+
+
+def transform_marketplace_list_output(result):
+ return [marketplace_list_output(item) for item in result]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_validators.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_validators.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_validators.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/_validators.py
2018-04-06 19:33:13.000000000 +0200
@@ -26,26 +26,14 @@
def validate_both_start_end_dates(namespace):
"""Validates the existence of both start and end dates in the parameter or
neither"""
- if (namespace.start_date and not namespace.end_date) or
(namespace.end_date and not namespace.start_date):
+ if bool(namespace.start_date) != bool(namespace.end_date):
raise CLIError("usage error: Both --start-date and --end-date need to
be supplied or neither.")
-def validate_reservations_summaries(namespace):
+def validate_reservation_summary(namespace):
"""lowercase the data grain for comparison"""
data_grain = namespace.grain.lower()
- if not namespace.reservationorderid:
- raise CLIError("usage error: Reservation Order Id needs to be
supplied.")
if data_grain != 'daily' and data_grain != 'monthly':
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_reservations_details(namespace):
- """Validates reservation order id """
- if not namespace.reservationorderid:
- raise CLIError("usage error: Reservation Order Id needs to be
supplied.")
- if not namespace.start_date:
- raise CLIError("usage error: --start-date needs to be supplied for
reservation details.")
- if not namespace.end_date:
- raise CLIError("usage error:--end-date needs to be supplied for
reservation details.")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/commands.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/commands.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/commands.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/commands.py
2018-04-06 19:33:13.000000000 +0200
@@ -4,16 +4,19 @@
#
--------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
-from azure.cli.command_modules.consumption._transformers import
transform_usage_list_output
-from azure.cli.command_modules.consumption._transformers import
transform_reservation_summaries_list_output
-from azure.cli.command_modules.consumption._transformers import
transform_reservation_details_list_output
-from azure.cli.command_modules.consumption._client_factory import
usage_details_mgmt_client_factory
-from azure.cli.command_modules.consumption._client_factory import
reservations_summaries_mgmt_client_factory
-from azure.cli.command_modules.consumption._client_factory import
reservations_details_mgmt_client_factory
+from ._transformers import (transform_usage_list_output,
+ transform_reservation_summary_list_output,
+ transform_reservation_detail_list_output,
+ transform_pricesheet_show_output,
+ transform_marketplace_list_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)
from ._exception_handler import consumption_exception_handler
-from ._validators import validate_both_start_end_dates
-from ._validators import validate_reservations_summaries
-from ._validators import validate_reservations_details
+from ._validators import (validate_both_start_end_dates,
+ validate_reservation_summary)
def load_command_table(self, _):
@@ -21,10 +24,18 @@
g.custom_command('list', 'cli_consumption_list_usage',
transform=transform_usage_list_output,
exception_handler=consumption_exception_handler,
validator=validate_both_start_end_dates,
client_factory=usage_details_mgmt_client_factory)
- with self.command_group('consumption reservations summaries') as s:
- s.custom_command('list',
'cli_consumption_list_reservations_summaries',
transform=transform_reservation_summaries_list_output,
- exception_handler=consumption_exception_handler,
validator=validate_reservations_summaries,
client_factory=reservations_summaries_mgmt_client_factory)
-
- with self.command_group('consumption reservations details') as d:
- d.custom_command('list', 'cli_consumption_list_reservations_details',
transform=transform_reservation_details_list_output,
- exception_handler=consumption_exception_handler,
validator=validate_reservations_details,
client_factory=reservations_details_mgmt_client_factory)
+ with self.command_group('consumption reservation summary') as s:
+ s.custom_command('list', 'cli_consumption_list_reservation_summary',
transform=transform_reservation_summary_list_output,
+ exception_handler=consumption_exception_handler,
validator=validate_reservation_summary,
client_factory=reservation_summary_mgmt_client_factory)
+
+ with self.command_group('consumption reservation detail') as d:
+ d.custom_command('list', 'cli_consumption_list_reservation_detail',
transform=transform_reservation_detail_list_output,
+ 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)
+
+ 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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/custom.py
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/custom.py
---
old/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/custom.py
2018-01-05 20:41:15.000000000 +0100
+++
new/azure-cli-consumption-0.3.0/azure/cli/command_modules/consumption/custom.py
2018-04-06 19:33:13.000000000 +0200
@@ -5,11 +5,8 @@
# pylint: disable=line-too-long
-from azure.cli.command_modules.consumption._client_factory import
cf_consumption
-
-def cli_consumption_list_usage(cmd, client, billing_period_name=None,
top=None, include_additional_properties=False, include_meter_details=False,
start_date=None, end_date=None):
- """List all usage details of the subscription"""
+def cli_consumption_list_usage(client, billing_period_name=None, top=None,
include_additional_properties=False, include_meter_details=False,
start_date=None, end_date=None):
if include_additional_properties and include_meter_details:
expand = 'properties/additionalProperties,properties/meterDetails'
elif include_additional_properties:
@@ -19,11 +16,6 @@
else:
expand = None
- if billing_period_name:
- scope =
"/subscriptions/{}/providers/Microsoft.Billing/billingPeriods/{}".format(cf_consumption(cmd.cli_ctx).config.subscription_id,
billing_period_name)
- else:
- scope =
"/subscriptions/{}".format(cf_consumption(cmd.cli_ctx).config.subscription_id)
-
filter_from = None
filter_to = None
filter_expression = None
@@ -31,19 +23,17 @@
filter_from = "properties/usageEnd ge
\'{}\'".format(start_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_to = "properties/usageEnd le
\'{}\'".format(end_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_expression = "{} and {}".format(filter_from, filter_to)
- if top:
- pages = client.list(scope, expand=expand, filter=filter_expression,
top=top)
- return list(pages.advance_page())
- return list(client.list(scope, expand=expand, filter=filter_expression))
+ if billing_period_name and top:
+ return list(client.list_by_billing_period(billing_period_name,
expand=expand, filter=filter_expression, top=top).advance_page())
+ elif billing_period_name and not top:
+ return list(client.list_by_billing_period(expand=expand,
filter=filter_expression))
+ elif not billing_period_name and top:
+ return list(client.list(expand=expand, filter=filter_expression,
top=top).advance_page())
+ return client.list(expand=expand, filter=filter_expression)
-def cli_consumption_list_reservations_summaries(client, grain,
reservationorderid, reservationid=None, start_date=None, end_date=None):
- """List all the reservation summaries """
- if reservationid:
- scope =
"providers/Microsoft.Capacity/reservationorders/{}/reservations/{}".format(reservationorderid,
reservationid)
- else:
- scope =
"providers/Microsoft.Capacity/reservationorders/{}".format(reservationorderid)
+def cli_consumption_list_reservation_summary(client, grain,
reservation_order_id, reservation_id=None, start_date=None, end_date=None):
filter_from = None
filter_to = None
filter_expression = None
@@ -51,22 +41,51 @@
filter_from = "properties/UsageDate ge
{}".format(start_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_to = "properties/UsageDate le
{}".format(end_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_expression = "{} and {}".format(filter_from, filter_to)
- return list(client.list(scope, grain=grain, filter=filter_expression))
+ if reservation_id:
+ return
list(client.list_by_reservation_order_and_reservation(reservation_order_id,
reservation_id, grain=grain, filter=filter_expression))
+ return list(client.list_by_reservation_order(reservation_order_id,
grain=grain, filter=filter_expression))
- return list(client.list(scope, grain=grain))
+ if reservation_id:
+ return
list(client.list_by_reservation_order_and_reservation(reservation_order_id,
reservation_id, grain=grain))
+ return list(client.list_by_reservation_order(reservation_order_id,
grain=grain))
-def cli_consumption_list_reservations_details(client, reservationorderid,
start_date, end_date, reservationid=None):
- """List all the reservation details """
- if reservationid:
- scope =
"providers/Microsoft.Capacity/reservationorders/{}/reservations/{}".format(reservationorderid,
reservationid)
- else:
- scope =
"providers/Microsoft.Capacity/reservationorders/{}".format(reservationorderid)
-
+def cli_consumption_list_reservation_detail(client, reservation_order_id,
start_date, end_date, reservation_id=None):
filter_from = None
filter_to = None
filter_expression = None
filter_from = "properties/UsageDate ge
{}".format(start_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_to = "properties/UsageDate le
{}".format(end_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
filter_expression = "{} and {}".format(filter_from, filter_to)
- return list(client.list(scope, filter=filter_expression))
+ if reservation_id:
+ return
list(client.list_by_reservation_order_and_reservation(reservation_order_id,
reservation_id, filter=filter_expression))
+ return list(client.list_by_reservation_order(reservation_order_id,
filter=filter_expression))
+
+
+def cli_consumption_list_pricesheet_show(client, billing_period_name=None,
include_meter_details=False):
+ if include_meter_details:
+ expand_properties = 'properties/meterDetails'
+ else:
+ expand_properties = None
+
+ if billing_period_name:
+ return client.get_by_billing_period(billing_period_name,
expand=expand_properties)
+ return client.get(expand=expand_properties)
+
+
+def cli_consumption_list_marketplace(client, billing_period_name=None,
start_date=None, end_date=None, top=None):
+ filter_from = None
+ filter_to = None
+ filter_expression = None
+ if start_date and end_date:
+ filter_from = "properties/usageEnd ge
\'{}\'".format(start_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
+ filter_to = "properties/usageEnd le
\'{}\'".format(end_date.strftime("%Y-%m-%dT%H:%M:%SZ"))
+ filter_expression = "{} and {}".format(filter_from, filter_to)
+
+ if billing_period_name and top:
+ return list(client.list_by_billing_period(billing_period_name,
filter=filter_expression, top=top).advance_page())
+ elif billing_period_name and not top:
+ return list(client.list_by_billing_period(billing_period_name,
filter=filter_expression))
+ elif not billing_period_name and top:
+ return list(client.list(filter=filter_expression,
top=top).advance_page())
+ return client.list(filter=filter_expression)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/PKG-INFO
new/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/PKG-INFO
--- old/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/PKG-INFO
2018-01-05 20:42:02.000000000 +0100
+++ new/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/PKG-INFO
2018-04-06 19:33:42.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: azure-cli-consumption
-Version: 0.2.1
+Version: 0.3.0
Summary: Microsoft Azure Command-Line Tools Consumption Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
@@ -20,6 +20,20 @@
Release History
===============
+ 0.3.0
+ +++++
+ * Added commands `marketplace`.
+ * BREAKING CHANGE: `reservations summaries` commands renamed to
`reservation summary`.
+ * BREAKING CHANGE: `reservations details` commands renamed to
`reservation detail`.
+ * BREAKING CHANGE: removed `--reservation-order-id` and
`--reservation-id` short options for `reservation` commands.
+ * BREAKING CHANGE: removed `--grain` short options for `reservation
summary` commands.
+ * BREAKING CHANGE: removed `--include-meter-details` short options for
`pricesheet` commands.
+ * `sdist` is now compatible with wheel 0.31.0
+
+ 0.2.2
+ +++++
+ * Added new commands for pricesheet API. Also, updated the existing
Usage Details and Reservation Details API request format.
+
0.2.1
+++++
* Added two new commands for reservations. Reservation Summaries and
Reservation Details
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/requires.txt
new/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/requires.txt
--- old/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/requires.txt
2018-01-05 20:42:02.000000000 +0100
+++ new/azure-cli-consumption-0.3.0/azure_cli_consumption.egg-info/requires.txt
2018-04-06 19:33:42.000000000 +0200
@@ -1,2 +1,2 @@
-azure-mgmt-consumption==1.1.0
+azure-mgmt-consumption==2.0.0
azure-cli-core
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-consumption-0.2.1/setup.py
new/azure-cli-consumption-0.3.0/setup.py
--- old/azure-cli-consumption-0.2.1/setup.py 2018-01-05 20:41:15.000000000
+0100
+++ new/azure-cli-consumption-0.3.0/setup.py 2018-04-06 19:33:13.000000000
+0200
@@ -16,7 +16,7 @@
cmdclass = {}
-VERSION = "0.2.1"
+VERSION = "0.3.0"
# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
@@ -33,7 +33,7 @@
]
DEPENDENCIES = [
- 'azure-mgmt-consumption==1.1.0',
+ 'azure-mgmt-consumption==2.0.0',
'azure-cli-core'
]