Hello community,

here is the log from the commit of package azure-cli-consumption for 
openSUSE:Factory checked in at 2018-02-14 09:30:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-consumption (Old)
 and      /work/SRC/openSUSE:Factory/.azure-cli-consumption.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "azure-cli-consumption"

Wed Feb 14 09:30:26 2018 rev:2 rq:574803 version:0.2.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/azure-cli-consumption/azure-cli-consumption.changes  
    2017-11-10 14:53:18.140964659 +0100
+++ 
/work/SRC/openSUSE:Factory/.azure-cli-consumption.new/azure-cli-consumption.changes
 2018-02-14 09:30:27.426012713 +0100
@@ -1,0 +2,10 @@
+Wed Feb  7 15:24:12 UTC 2018 - adrian.glaub...@suse.com
+
+- New upstream release
+  + Version 0.2.1
+  + For detailed information about changes see the
+    HISTORY.rst file provided with this package
+- Install HISTORY.rst into doc directory
+- Update Requires from setup.py
+
+-------------------------------------------------------------------

Old:
----
  azure-cli-consumption-0.1.5.tar.gz

New:
----
  azure-cli-consumption-0.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ azure-cli-consumption.spec ++++++
--- /var/tmp/diff_new_pack.1b5gcx/_old  2018-02-14 09:30:28.701966477 +0100
+++ /var/tmp/diff_new_pack.1b5gcx/_new  2018-02-14 09:30:28.729965463 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package azure-cli-consumption
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,8 +15,9 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 Name:           azure-cli-consumption
-Version:        0.1.5
+Version:        0.2.1
 Release:        0
 Summary:        Microsoft Azure CLI 'consumption' Command Module
 License:        MIT
@@ -24,16 +25,16 @@
 Url:            https://github.com/Azure/azure-cli
 Source:         
https://files.pythonhosted.org/packages/source/a/azure-cli-consumption/azure-cli-consumption-%{version}.tar.gz
 Source1:        LICENSE.txt
-BuildRequires:  python3-devel
-BuildRequires:  python3-setuptools
-BuildRequires:  unzip
 BuildRequires:  azure-cli-command-modules-nspkg
 BuildRequires:  azure-cli-nspkg
 BuildRequires:  python3-azure-nspkg
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+BuildRequires:  unzip
 Requires:       azure-cli-command-modules-nspkg
 Requires:       azure-cli-nspkg
+Requires:       python3-azure-mgmt-consumption >= 1.1.0
 Requires:       python3-azure-nspkg
-Requires:       python3-azure-mgmt-consumption >= 0.1.0
 Conflicts:      azure-cli < 2.0.0
 
 BuildArch:      noarch
@@ -62,7 +63,8 @@
 
 %files
 %defattr(-,root,root,-)
-%doc LICENSE.txt README.rst
+%doc HISTORY.rst LICENSE.txt README.rst
 %{python3_sitelib}/azure/cli/command_modules/consumption
 %{python3_sitelib}/azure_cli_consumption-*.egg-info
+
 %changelog

++++++ azure-cli-consumption-0.1.5.tar.gz -> azure-cli-consumption-0.2.1.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-consumption-0.1.5/HISTORY.rst 
new/azure-cli-consumption-0.2.1/HISTORY.rst
--- old/azure-cli-consumption-0.1.5/HISTORY.rst 2017-09-23 01:47:00.000000000 
+0200
+++ new/azure-cli-consumption-0.2.1/HISTORY.rst 2018-01-05 20:41:15.000000000 
+0100
@@ -2,6 +2,18 @@
 
 Release History
 ===============
+0.2.1
++++++
+* Added two new commands for reservations. Reservation Summaries and 
Reservation Details
+
+0.2.0
++++++
+* Release of new GA api version 2017-11-30.
+
+0.1.6
++++++
+* minor fixes
+
 0.1.5 (2017-09-22)
 ++++++++++++++++++
 * minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-consumption-0.1.5/PKG-INFO 
new/azure-cli-consumption-0.2.1/PKG-INFO
--- old/azure-cli-consumption-0.1.5/PKG-INFO    2017-09-23 01:50:01.000000000 
+0200
+++ new/azure-cli-consumption-0.2.1/PKG-INFO    2018-01-05 20:42:02.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: azure-cli-consumption
-Version: 0.1.5
+Version: 0.2.1
 Summary: Microsoft Azure Command-Line Tools Consumption Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
@@ -20,6 +20,18 @@
         
         Release History
         ===============
+        0.2.1
+        +++++
+        * Added two new commands for reservations. Reservation Summaries and 
Reservation Details
+        
+        0.2.0
+        +++++
+        * Release of new GA api version 2017-11-30.
+        
+        0.1.6
+        +++++
+        * minor fixes
+        
         0.1.5 (2017-09-22)
         ++++++++++++++++++
         * minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/__init__.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/__init__.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/__init__.py
   2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/__init__.py
   2018-01-05 20:41:15.000000000 +0100
@@ -3,12 +3,26 @@
 # Licensed under the MIT License. See License.txt in the project root for 
license information.
 # 
--------------------------------------------------------------------------------------------
 
+from azure.cli.core import AzCommandsLoader
+
 import azure.cli.command_modules.consumption._help  # pylint: 
disable=unused-import
 
 
-def load_params(_):
-    import azure.cli.command_modules.consumption._params  # pylint: 
disable=redefined-outer-name, unused-variable
+class ConsumptionCommandsLoader(AzCommandsLoader):
+    def __init__(self, cli_ctx=None):
+        from azure.cli.core.commands import CliCommandType
+        consumption_custom = 
CliCommandType(operations_tmpl='azure.cli.command_modules.consumption.custom#{}')
+        super(ConsumptionCommandsLoader, self).__init__(cli_ctx=cli_ctx, 
custom_command_type=consumption_custom,
+                                                        
min_profile='2017-03-10-profile')
+
+    def load_command_table(self, args):
+        from azure.cli.command_modules.consumption.commands import 
load_command_table
+        load_command_table(self, args)
+        return self.command_table
+
+    def load_arguments(self, command):
+        from azure.cli.command_modules.consumption._params import 
load_arguments
+        load_arguments(self, command)
 
 
-def load_commands():
-    import azure.cli.command_modules.consumption.commands  # pylint: 
disable=redefined-outer-name, unused-variable
+COMMAND_LOADER_CLS = ConsumptionCommandsLoader
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_client_factory.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_client_factory.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_client_factory.py
    2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_client_factory.py
    2018-01-05 20:41:15.000000000 +0100
@@ -4,11 +4,19 @@
 # 
--------------------------------------------------------------------------------------------
 
 
-def cf_consumption(**_):
+def cf_consumption(cli_ctx, **_):
     from azure.cli.core.commands.client_factory import get_mgmt_service_client
     from azure.mgmt.consumption import ConsumptionManagementClient
-    return get_mgmt_service_client(ConsumptionManagementClient)
+    return get_mgmt_service_client(cli_ctx, ConsumptionManagementClient)
 
 
-def usage_details_mgmt_client_factory(kwargs):
-    return cf_consumption(**kwargs).usage_details
+def usage_details_mgmt_client_factory(cli_ctx, kwargs):
+    return cf_consumption(cli_ctx, **kwargs).usage_details
+
+
+def reservations_summaries_mgmt_client_factory(cli_ctx, kwargs):
+    return cf_consumption(cli_ctx, **kwargs).reservations_summaries
+
+
+def reservations_details_mgmt_client_factory(cli_ctx, kwargs):
+    return cf_consumption(cli_ctx, **kwargs).reservations_details
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_exception_handler.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_exception_handler.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_exception_handler.py
 2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_exception_handler.py
 2018-01-05 20:41:15.000000000 +0100
@@ -3,7 +3,7 @@
 # Licensed under the MIT License. See License.txt in the project root for 
license information.
 # 
--------------------------------------------------------------------------------------------
 
-from azure.cli.core.util import CLIError
+from knack.util import CLIError
 
 
 def consumption_exception_handler(ex):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_help.py 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_help.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_help.py  
    2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_help.py  
    2018-01-05 20:41:15.000000000 +0100
@@ -3,13 +3,28 @@
 # Licensed under the MIT License. See License.txt in the project root for 
license information.
 # 
--------------------------------------------------------------------------------------------
 
-from azure.cli.core.help_files import helps
+from knack.help_files import helps
 
 helps['consumption'] = """
     type: group
     short-summary: Manage consumption of Azure resources.
 """
 
+helps['consumption reservations'] = """
+    type: group
+    short-summary: Manage reservations for Azure resources.
+"""
+
+helps['consumption reservations summaries'] = """
+    type: group
+    short-summary: Manage reservations summaries for daily or monthly.
+"""
+
+helps['consumption reservations details'] = """
+    type: group
+    short-summary: Manage reservations details.
+"""
+
 helps['consumption usage'] = """
     type: group
     short-summary: Inspect the usage of Azure resources.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_params.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_params.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_params.py
    2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_params.py
    2018-01-05 20:41:15.000000000 +0100
@@ -4,13 +4,25 @@
 # 
--------------------------------------------------------------------------------------------
 
 # pylint: disable=line-too-long
-from azure.cli.core.commands import register_cli_argument
 from ._validators import get_datetime_type
 
-register_cli_argument('consumption usage list', 'top', options_list=('--top', 
'-t'), type=int, help='maximum number of items to return. Accepted range for 
this value is 1 - 1000')
-register_cli_argument('consumption usage list', 
'include_additional_properties', 
options_list=('--include-additional-properties', '-a'), action='store_true', 
help='include additional properties in the usages')
-register_cli_argument('consumption usage list', 'include_meter_details', 
options_list=('--include-meter-details', '-m'), action='store_true', 
help='include meter details in the usages')
-register_cli_argument('consumption usage list', 'start_date', 
options_list=('--start-date', '-s'), type=get_datetime_type(), help='start date 
(in UTC Y-m-d) of the usages')
-register_cli_argument('consumption usage list', 'end_date', 
options_list=('--end-date', '-e'), type=get_datetime_type(), help='end date (in 
UTC Y-m-d) of the usages')
-register_cli_argument('consumption usage list', 'invoice_name', 
options_list=('--invoice-name', '-i'), help='name of a specific invoice to get 
the usage details that associate with')
-register_cli_argument('consumption usage list', 'billing_period_name', 
options_list=('--billing-period-name', '-p'), help='name of a specific billing 
period to get the usage details that associate with')
+
+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')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_transformers.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_transformers.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_transformers.py
      2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_transformers.py
      2018-01-05 20:41:15.000000000 +0100
@@ -18,3 +18,31 @@
 
 def transform_usage_list_output(result):
     return [transform_usage_output(item) for item in result]
+
+
+def reservation_summaries_output(result):
+
+    result.reserved_hours = str(result.reserved_hours)
+    result.usage_date = result.usage_date.strftime("%Y-%m-%dT%H:%M:%SZ")
+    result.used_hours = str(result.used_hours)
+    result.max_utilization_percentage = str(result.max_utilization_percentage)
+    result.min_utilization_percentage = str(result.min_utilization_percentage)
+    result.avg_utilization_percentage = str(result.avg_utilization_percentage)
+    return result
+
+
+def transform_reservation_summaries_list_output(result):
+    return [reservation_summaries_output(item) for item in result]
+
+
+def reservation_details_output(result):
+
+    result.reserved_hours = str(result.reserved_hours)
+    result.usage_date = result.usage_date.strftime("%Y-%m-%dT%H:%M:%SZ")
+    result.used_hours = str(result.used_hours)
+    result.total_reserved_quantity = str(result.total_reserved_quantity)
+    return result
+
+
+def transform_reservation_details_list_output(result):
+    return [reservation_details_output(item) for item in result]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_validators.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_validators.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/_validators.py
        2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/_validators.py
        2018-01-05 20:41:15.000000000 +0100
@@ -4,6 +4,7 @@
 # 
--------------------------------------------------------------------------------------------
 
 from datetime import datetime
+from azure.cli.core.util import CLIError
 
 
 def get_datetime_type():
@@ -21,3 +22,30 @@
                 continue
         raise ValueError("Input '{}' not valid. Valid example: 
2017-02-11T23:59:59Z".format(string))
     return datetime_type
+
+
+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):
+        raise CLIError("usage error: Both --start-date and --end-date need to 
be supplied or neither.")
+
+
+def validate_reservations_summaries(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.1.5/azure/cli/command_modules/consumption/commands.py
 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/commands.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/commands.py
   2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/commands.py
   2018-01-05 20:41:15.000000000 +0100
@@ -4,12 +4,27 @@
 # 
--------------------------------------------------------------------------------------------
 
 # pylint: disable=line-too-long
-
-from azure.cli.core.commands import cli_command
-from azure.cli.core.profiles import supported_api_version, PROFILE_TYPE
-from azure.cli.command_modules.consumption._client_factory import 
usage_details_mgmt_client_factory
 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 ._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
+
+
+def load_command_table(self, _):
+    with self.command_group('consumption usage') as g:
+        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)
 
-if not supported_api_version(PROFILE_TYPE, max_api='2017-03-09-profile'):
-    cli_command(__name__, 'consumption usage list', 
'azure.cli.command_modules.consumption.custom#cli_consumption_list_usage', 
usage_details_mgmt_client_factory, transform=transform_usage_list_output, 
exception_handler=consumption_exception_handler)
+    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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/custom.py 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/custom.py
--- 
old/azure-cli-consumption-0.1.5/azure/cli/command_modules/consumption/custom.py 
    2017-09-23 01:47:00.000000000 +0200
+++ 
new/azure-cli-consumption-0.2.1/azure/cli/command_modules/consumption/custom.py 
    2018-01-05 20:41:15.000000000 +0100
@@ -5,42 +5,68 @@
 
 # pylint: disable=line-too-long
 
-from datetime import timedelta
 from azure.cli.command_modules.consumption._client_factory import 
cf_consumption
 
 
-def cli_consumption_list_usage(client, invoice_name=None, 
billing_period_name=None, top=None, include_additional_properties=False, 
include_meter_details=False, start_date=None, end_date=None):
+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"""
     if include_additional_properties and include_meter_details:
-        expand = 'additionalProperties,meterDetails'
+        expand = 'properties/additionalProperties,properties/meterDetails'
     elif include_additional_properties:
-        expand = 'additionalProperties'
+        expand = 'properties/additionalProperties'
     elif include_meter_details:
-        expand = 'meterDetails'
+        expand = 'properties/meterDetails'
     else:
         expand = None
 
     if billing_period_name:
-        scope = 
"/subscriptions/{}/providers/Microsoft.Billing/billingPeriods/{}".format(cf_consumption().config.subscription_id,
 billing_period_name)
-    elif invoice_name:
-        scope = 
"/subscriptions/{}/providers/Microsoft.Billing/invoices/{}".format(cf_consumption().config.subscription_id,
 invoice_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().config.subscription_id)
+        scope = 
"/subscriptions/{}".format(cf_consumption(cmd.cli_ctx).config.subscription_id)
 
     filter_from = None
     filter_to = None
     filter_expression = None
-    if start_date:
-        # pylint: disable=no-member
-        from_time = start_date + timedelta(days=1) - timedelta(seconds=1)
-        filter_from = "usageEnd ge 
{}".format(from_time.strftime("%Y-%m-%dT%H:%M:%SZ"))
-        filter_expression = filter_from
-    if end_date:
-        # pylint: disable=no-member
-        to_time = end_date + timedelta(days=1) - timedelta(seconds=1)
-        filter_to = "usageEnd le 
{}".format(to_time.strftime("%Y-%m-%dT%H:%M:%SZ"))
-        filter_expression = filter_to
-    if filter_from and filter_to:
+    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 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))
 
-    return list(client.list(scope, expand=expand, filter=filter_expression, 
top=top))
+
+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)
+
+    filter_from = None
+    filter_to = None
+    filter_expression = None
+    if start_date and end_date:
+        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))
+
+    return list(client.list(scope, 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)
+
+    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))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure_cli_consumption.egg-info/PKG-INFO 
new/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/PKG-INFO
--- old/azure-cli-consumption-0.1.5/azure_cli_consumption.egg-info/PKG-INFO     
2017-09-23 01:50:01.000000000 +0200
+++ new/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/PKG-INFO     
2018-01-05 20:42:02.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: azure-cli-consumption
-Version: 0.1.5
+Version: 0.2.1
 Summary: Microsoft Azure Command-Line Tools Consumption Command Module
 Home-page: https://github.com/Azure/azure-cli
 Author: Microsoft Corporation
@@ -20,6 +20,18 @@
         
         Release History
         ===============
+        0.2.1
+        +++++
+        * Added two new commands for reservations. Reservation Summaries and 
Reservation Details
+        
+        0.2.0
+        +++++
+        * Release of new GA api version 2017-11-30.
+        
+        0.1.6
+        +++++
+        * minor fixes
+        
         0.1.5 (2017-09-22)
         ++++++++++++++++++
         * minor fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/azure-cli-consumption-0.1.5/azure_cli_consumption.egg-info/requires.txt 
new/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/requires.txt
--- old/azure-cli-consumption-0.1.5/azure_cli_consumption.egg-info/requires.txt 
2017-09-23 01:50:01.000000000 +0200
+++ new/azure-cli-consumption-0.2.1/azure_cli_consumption.egg-info/requires.txt 
2018-01-05 20:42:02.000000000 +0100
@@ -1,3 +1,2 @@
-azure-mgmt-consumption==0.1.0
+azure-mgmt-consumption==1.1.0
 azure-cli-core
-azure-cli-command-modules-nspkg>=2.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/azure-cli-consumption-0.1.5/setup.py 
new/azure-cli-consumption-0.2.1/setup.py
--- old/azure-cli-consumption-0.1.5/setup.py    2017-09-23 01:50:00.000000000 
+0200
+++ new/azure-cli-consumption-0.2.1/setup.py    2018-01-05 20:41:15.000000000 
+0100
@@ -16,7 +16,7 @@
     cmdclass = {}
 
 
-VERSION = "0.1.5"
+VERSION = "0.2.1"
 # 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==0.1.0',
+    'azure-mgmt-consumption==1.1.0',
     'azure-cli-core'
 ]
 


Reply via email to