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 consumption/resource-manager] Added Tags filter for budgets and updated the api version #2134

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Generated from 7be436462b7c40da7cc4f8054bd8ea195f7a5146
Incorporated review comments

Incorporated review comments
  • Loading branch information
AutorestCI committed Mar 13, 2018
commit 123f737bf89155dfaefbc13a62836c1677e73899
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,21 @@ class ConsumptionManagementClientConfiguration(AzureConfiguration):
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param grain: Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
:type grain: str or ~azure.mgmt.consumption.models.Datagrain
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, subscription_id, grain, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if grain is None:
raise ValueError("Parameter 'grain' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -53,6 +58,7 @@ def __init__(

self.credentials = credentials
self.subscription_id = subscription_id
self.grain = grain


class ConsumptionManagementClient(object):
Expand Down Expand Up @@ -81,13 +87,16 @@ class ConsumptionManagementClient(object):
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param grain: Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
:type grain: str or ~azure.mgmt.consumption.models.Datagrain
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):
self, credentials, subscription_id, grain, base_url=None):

self.config = ConsumptionManagementClientConfiguration(credentials, subscription_id, base_url)
self.config = ConsumptionManagementClientConfiguration(credentials, subscription_id, grain, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def list_by_reservation_order(
self, reservation_order_id, grain, filter=None, custom_headers=None, raw=False, **operation_config):
self, reservation_order_id, filter=None, custom_headers=None, raw=False, **operation_config):
"""Lists the reservations summaries for daily or monthly grain.

:param reservation_order_id: Order Id of the reservation
:type reservation_order_id: str
:param grain: Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
:type grain: str or ~azure.mgmt.consumption.models.Datagrain
:param filter: Required only for daily grain. The properties/UsageDate
for start date and end date. The filter supports 'le' and 'ge'
:type filter: str
Expand All @@ -71,7 +68,7 @@ def internal_paging(next_link=None, raw=False):

# Construct parameters
query_parameters = {}
query_parameters['grain'] = self._serialize.query("grain", grain, 'str')
query_parameters['grain'] = self._serialize.query("self.config.grain", self.config.grain, 'str')
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
Expand Down Expand Up @@ -112,16 +109,13 @@ def internal_paging(next_link=None, raw=False):
list_by_reservation_order.metadata = {'url': '/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationSummaries'}

def list_by_reservation_order_and_reservation(
self, reservation_order_id, reservation_id, grain, filter=None, custom_headers=None, raw=False, **operation_config):
self, reservation_order_id, reservation_id, filter=None, custom_headers=None, raw=False, **operation_config):
"""Lists the reservations summaries for daily or monthly grain.

:param reservation_order_id: Order Id of the reservation
:type reservation_order_id: str
:param reservation_id: Id of the reservation
:type reservation_id: str
:param grain: Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
:type grain: str or ~azure.mgmt.consumption.models.Datagrain
:param filter: Required only for daily grain. The properties/UsageDate
for start date and end date. The filter supports 'le' and 'ge'
:type filter: str
Expand Down Expand Up @@ -149,7 +143,7 @@ def internal_paging(next_link=None, raw=False):

# Construct parameters
query_parameters = {}
query_parameters['grain'] = self._serialize.query("grain", grain, 'str')
query_parameters['grain'] = self._serialize.query("self.config.grain", self.config.grain, 'str')
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
Expand Down