Skip to content

Commit

Permalink
[AutoPR consumption/resource-manager] Added Tags filter for budgets a…
Browse files Browse the repository at this point in the history
…nd updated the api version (#2134)

* Generated from 7b927cf53f15dfbde515c6e0cc96f0b2b953efc3

Added Tags filter for budgets and updated the api version

Added Tags filter for budgets and updated the api version

* Generated from c641158a0e8753654c0d36343ba3244865283f3a

Updated comments

Updated comments

* Generated from 0e276b2b94ebe626431581607e9ddf975a29df86

Incorporated review comments

Incorporated review comments

* Generated from 7be436462b7c40da7cc4f8054bd8ea195f7a5146

Incorporated review comments

Incorporated review comments
  • Loading branch information
AutorestCI committed Jul 12, 2018
1 parent e6dcc5b commit fd13348
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 35 deletions.
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,17 +87,20 @@ 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)}
self.api_version = '2018-01-31'
self.api_version = '2018-03-31'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
10 changes: 7 additions & 3 deletions azure-mgmt-consumption/azure/mgmt/consumption/models/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ class Filters(Model):
:type resource_groups: list[str]
:param resources: The list of filters on resources.
:type resources: list[str]
:param meters: The list of filters on meters, mandatory for budgets of
usage category.
:param meters: The list of filters on meters (GUID), mandatory for budgets
of usage category.
:type meters: list[str]
:param tags: The dictionary of filters on tags.
:type tags: dict[str, list[str]]
"""

_validation = {
Expand All @@ -35,10 +37,12 @@ class Filters(Model):
'resource_groups': {'key': 'resourceGroups', 'type': '[str]'},
'resources': {'key': 'resources', 'type': '[str]'},
'meters': {'key': 'meters', 'type': '[str]'},
'tags': {'key': 'tags', 'type': '{[str]}'},
}

def __init__(self, resource_groups=None, resources=None, meters=None):
def __init__(self, resource_groups=None, resources=None, meters=None, tags=None):
super(Filters, self).__init__()
self.resource_groups = resource_groups
self.resources = resources
self.meters = meters
self.tags = tags
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Marketplace(Resource):
:vartype pretax_cost: decimal.Decimal
:ivar is_estimated: The estimated usage is subject to change.
:vartype is_estimated: bool
:ivar meter_id: The meter id.
:ivar meter_id: The meter id (GUID).
:vartype meter_id: str
:ivar subscription_guid: Subscription guid.
:vartype subscription_guid: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PriceSheetProperties(Model):
:ivar billing_period_id: The id of the billing period resource that the
usage belongs to.
:vartype billing_period_id: str
:ivar meter_id: The meter id
:ivar meter_id: The meter id (GUID)
:vartype meter_id: str
:ivar meter_details: The details about the meter. By default this is not
populated, unless it's specified in $expand.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UsageDetail(Resource):
:vartype pretax_cost: decimal.Decimal
:ivar is_estimated: The estimated usage is subject to change.
:vartype is_estimated: bool
:ivar meter_id: The meter id.
:ivar meter_id: The meter id (GUID).
:vartype meter_id: str
:ivar meter_details: The details about the meter. By default this is not
populated, unless it's specified in $expand.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BudgetsOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MarketplacesOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Operations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PriceSheetOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ReservationsDetailsOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ReservationsSummariesOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,19 +32,16 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UsageDetailsOperations(object):
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-01-31. Constant value: "2018-01-31".
:ivar api_version: Version of the API to be used with the client request. The current version is 2018-03-31. Constant value: "2018-03-31".
"""

models = models
Expand All @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2018-01-31"
self.api_version = "2018-03-31"

self.config = config

Expand Down
3 changes: 2 additions & 1 deletion azure-mgmt-consumption/azure/mgmt/consumption/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "2.0.0"
VERSION = "1.2.0"

0 comments on commit fd13348

Please sign in to comment.