Skip to content

Commit

Permalink
[AutoPR consumption/resource-manager] Renamed cost allocation tags to…
Browse files Browse the repository at this point in the history
… cost tags and added schema for get list of all available tag keys (#2389)

* Generated from 1f2de0f37c163aa960c824541bb9094f41418b45

Renamed cost allocation tags to cost tags and added schema for get list of all available tag keys

Renamed cost allocation tags to cost tags and added schema for get list of all available tag keys

* Generated from 5699a841d9bb36bb99d1fbeecf46459473d054ac

Incorporated review comments

Incorporated review comments

* Generated from 3bd6450532e1e5132bbbe60dd88be6ff2716818a

Incorporated review comments

Incorporated review comments

* Generated from 7f53393ed97f6918aed8a574dc62a42fd1e36011

Incorporated review comments

Incorporated review comments
  • Loading branch information
AutorestCI committed Jul 12, 2018
1 parent c03d206 commit 145cc28
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from .operations.budgets_operations import BudgetsOperations
from .operations.operations import Operations
from .operations.price_sheet_operations import PriceSheetOperations
from .operations.cost_allocation_tags_operations import CostAllocationTagsOperations
from .operations.cost_tags_operations import CostTagsOperations
from .operations.tags_operations import TagsOperations
from . import models


Expand Down Expand Up @@ -79,8 +80,10 @@ class ConsumptionManagementClient(object):
:vartype operations: azure.mgmt.consumption.operations.Operations
:ivar price_sheet: PriceSheet operations
:vartype price_sheet: azure.mgmt.consumption.operations.PriceSheetOperations
:ivar cost_allocation_tags: CostAllocationTags operations
:vartype cost_allocation_tags: azure.mgmt.consumption.operations.CostAllocationTagsOperations
:ivar cost_tags: CostTags operations
:vartype cost_tags: azure.mgmt.consumption.operations.CostTagsOperations
:ivar tags: Tags operations
:vartype tags: azure.mgmt.consumption.operations.TagsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -117,5 +120,7 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.price_sheet = PriceSheetOperations(
self._client, self.config, self._serialize, self._deserialize)
self.cost_allocation_tags = CostAllocationTagsOperations(
self.cost_tags = CostTagsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.tags = TagsOperations(
self._client, self.config, self._serialize, self._deserialize)
12 changes: 8 additions & 4 deletions azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
from .reservation_summaries import ReservationSummaries
from .reservation_details import ReservationDetails
from .reservation_recommendations import ReservationRecommendations
from .tag import Tag
from .tags import Tags
from .budget_time_period import BudgetTimePeriod
from .filters import Filters
from .current_spend import CurrentSpend
from .notification import Notification
from .budget import Budget
from .cost_allocation_tag import CostAllocationTag
from .cost_allocation_tags import CostAllocationTags
from .cost_tag import CostTag
from .cost_tags import CostTags
from .error_details import ErrorDetails
from .error_response import ErrorResponse, ErrorResponseException
from .operation_display import OperationDisplay
Expand Down Expand Up @@ -53,13 +55,15 @@
'ReservationSummaries',
'ReservationDetails',
'ReservationRecommendations',
'Tag',
'Tags',
'BudgetTimePeriod',
'Filters',
'CurrentSpend',
'Notification',
'Budget',
'CostAllocationTag',
'CostAllocationTags',
'CostTag',
'CostTags',
'ErrorDetails',
'ErrorResponse', 'ErrorResponseException',
'OperationDisplay',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from msrest.serialization import Model


class CostAllocationTag(Model):
"""The cost allocation tag.
class CostTag(Model):
"""The cost tag.
:param key: Cost allocation tag key.
:param key: Cost tag key.
:type key: str
"""

Expand All @@ -24,5 +24,5 @@ class CostAllocationTag(Model):
}

def __init__(self, key=None):
super(CostAllocationTag, self).__init__()
super(CostTag, self).__init__()
self.key = key
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from .proxy_resource import ProxyResource


class CostAllocationTags(ProxyResource):
"""A cost allocation tag resource.
class CostTags(ProxyResource):
"""A cost tag resource.
Variables are only populated by the server, and will be ignored when
sending a request.
Expand All @@ -28,9 +28,8 @@ class CostAllocationTags(ProxyResource):
this field will be used to determine whether the user is updating the
latest version or not.
:type e_tag: str
:param cost_allocation_tags: Cost allocation tags.
:type cost_allocation_tags:
list[~azure.mgmt.consumption.models.CostAllocationTag]
:param cost_tags: Cost tags.
:type cost_tags: list[~azure.mgmt.consumption.models.CostTag]
"""

_validation = {
Expand All @@ -44,9 +43,9 @@ class CostAllocationTags(ProxyResource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'e_tag': {'key': 'eTag', 'type': 'str'},
'cost_allocation_tags': {'key': 'properties.costAllocationTags', 'type': '[CostAllocationTag]'},
'cost_tags': {'key': 'properties.costTags', 'type': '[CostTag]'},
}

def __init__(self, e_tag=None, cost_allocation_tags=None):
super(CostAllocationTags, self).__init__(e_tag=e_tag)
self.cost_allocation_tags = cost_allocation_tags
def __init__(self, e_tag=None, cost_tags=None):
super(CostTags, self).__init__(e_tag=e_tag)
self.cost_tags = cost_tags
28 changes: 28 additions & 0 deletions azure-mgmt-consumption/azure/mgmt/consumption/models/tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Tag(Model):
"""The tag resource.
:param key: Tag key.
:type key: str
"""

_attribute_map = {
'key': {'key': 'key', 'type': 'str'},
}

def __init__(self, key=None):
super(Tag, self).__init__()
self.key = key
51 changes: 51 additions & 0 deletions azure-mgmt-consumption/azure/mgmt/consumption/models/tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .proxy_resource import ProxyResource


class Tags(ProxyResource):
"""A resource listing all tags.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param e_tag: eTag of the resource. To handle concurrent update scenarion,
this field will be used to determine whether the user is updating the
latest version or not.
:type e_tag: str
:param tags: A list of Tag.
:type tags: list[~azure.mgmt.consumption.models.Tag]
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'e_tag': {'key': 'eTag', 'type': 'str'},
'tags': {'key': 'properties.tags', 'type': '[Tag]'},
}

def __init__(self, e_tag=None, tags=None):
super(Tags, self).__init__(e_tag=e_tag)
self.tags = tags
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from .budgets_operations import BudgetsOperations
from .operations import Operations
from .price_sheet_operations import PriceSheetOperations
from .cost_allocation_tags_operations import CostAllocationTagsOperations
from .cost_tags_operations import CostTagsOperations
from .tags_operations import TagsOperations

__all__ = [
'UsageDetailsOperations',
Expand All @@ -28,5 +29,6 @@
'BudgetsOperations',
'Operations',
'PriceSheetOperations',
'CostAllocationTagsOperations',
'CostTagsOperations',
'TagsOperations',
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from .. import models


class CostAllocationTagsOperations(object):
"""CostAllocationTagsOperations operations.
class CostTagsOperations(object):
"""CostTagsOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
Expand All @@ -38,7 +38,7 @@ def __init__(self, client, config, serializer, deserializer):

def get(
self, billing_account_id, custom_headers=None, raw=False, **operation_config):
"""Get cost allocation tags for a billing account.
"""Get cost tags for a billing account.
:param billing_account_id: Azure Billing Account ID.
:type billing_account_id: str
Expand All @@ -47,8 +47,8 @@ def get(
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CostAllocationTags or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.consumption.models.CostAllocationTags or
:return: CostTags or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.consumption.models.CostTags or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.consumption.models.ErrorResponseException>`
Expand Down Expand Up @@ -84,43 +84,42 @@ def get(
deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('CostAllocationTags', response)
deserialized = self._deserialize('CostTags', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
get.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costAllocationTags'}
get.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'}

def create_or_update(
self, billing_account_id, e_tag=None, cost_allocation_tags=None, custom_headers=None, raw=False, **operation_config):
"""The operation to create or update cost allocation tags assiciated with
a billing account. Update operation requires latest eTag to be set in
the request mandatorily. You may obtain the latest eTag by performing a
get operation. Create operation does not require eTag.
self, billing_account_id, e_tag=None, cost_tags=None, custom_headers=None, raw=False, **operation_config):
"""The operation to create or update cost tags assiciated with a billing
account. Update operation requires latest eTag to be set in the request
mandatorily. You may obtain the latest eTag by performing a get
operation. Create operation does not require eTag.
:param billing_account_id: Azure Billing Account ID.
:type billing_account_id: str
:param e_tag: eTag of the resource. To handle concurrent update
scenarion, this field will be used to determine whether the user is
updating the latest version or not.
:type e_tag: str
:param cost_allocation_tags: Cost allocation tags.
:type cost_allocation_tags:
list[~azure.mgmt.consumption.models.CostAllocationTag]
:param cost_tags: Cost tags.
:type cost_tags: list[~azure.mgmt.consumption.models.CostTag]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: CostAllocationTags or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.consumption.models.CostAllocationTags or
:return: CostTags or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.consumption.models.CostTags or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.consumption.models.ErrorResponseException>`
"""
parameters = models.CostAllocationTags(e_tag=e_tag, cost_allocation_tags=cost_allocation_tags)
parameters = models.CostTags(e_tag=e_tag, cost_tags=cost_tags)

# Construct URL
url = self.create_or_update.metadata['url']
Expand All @@ -144,7 +143,7 @@ def create_or_update(
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct body
body_content = self._serialize.body(parameters, 'CostAllocationTags')
body_content = self._serialize.body(parameters, 'CostTags')

# Construct and send request
request = self._client.put(url, query_parameters)
Expand All @@ -157,13 +156,13 @@ def create_or_update(
deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('CostAllocationTags', response)
deserialized = self._deserialize('CostTags', response)
if response.status_code == 201:
deserialized = self._deserialize('CostAllocationTags', response)
deserialized = self._deserialize('CostTags', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costAllocationTags'}
create_or_update.metadata = {'url': '/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'}
Loading

0 comments on commit 145cc28

Please sign in to comment.