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

Added schema spec for cost allocation tags #2742

Merged
merged 23 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7b927cf
Added Tags filter for budgets and updated the api version
asarkar84 Mar 8, 2018
c641158
Updated comments
asarkar84 Mar 9, 2018
0e276b2
Incorporated review comments
asarkar84 Mar 10, 2018
7be4364
Incorporated review comments
asarkar84 Mar 13, 2018
bff7aa7
Incorporated review comment
asarkar84 Mar 13, 2018
011c9f0
Merge remote-tracking branch 'upstream/master'
asarkar84 Mar 13, 2018
002a6db
Added Tags filter and grouping for UsageDetails
asarkar84 Mar 15, 2018
020911c
Merge remote-tracking branch 'upstream/master'
asarkar84 Mar 15, 2018
502d70e
Added reservation recommendations and tags
asarkar84 Mar 16, 2018
b41bd12
Merge remote-tracking branch 'upstream/master'
asarkar84 Mar 16, 2018
7956270
Incorporated review comments
asarkar84 Mar 16, 2018
346ce83
Incorporated review comments
asarkar84 Mar 16, 2018
a0072f9
Removed unwanted space
asarkar84 Mar 16, 2018
ee9bfc3
Removed extra whitespace
asarkar84 Mar 16, 2018
6df7a9e
add swagger->sdk config for go
jhendrixMSFT Mar 16, 2018
7a5eab1
fix broken tags for go
jhendrixMSFT Mar 17, 2018
623ff00
Merge remote-tracking branch 'upstream/master'
asarkar84 Mar 22, 2018
6388784
Added schema spec for cost allocation tags
asarkar84 Mar 23, 2018
a8d47d1
Merge remote-tracking branch 'upstream/master'
asarkar84 Mar 23, 2018
3ccf1b4
Updated Get Operation
asarkar84 Mar 23, 2018
884aabe
Incorporated review comments
asarkar84 Mar 23, 2018
3d1c7c1
Review comments incorporated
asarkar84 Mar 26, 2018
def6325
Updated path
asarkar84 Mar 27, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,97 @@
}
}
}
},
"/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costAllocationTags": {
"get": {
"tags": [
"CostAllocationTags"
],
"operationId": "CostAllocationTags_Get",
"description": "Get cost allocation tags for a billing account.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/"
},
"x-ms-examples": {
"CostAllocationTags_Get": {
"$ref": "./examples/CostAllocationTags.json"
}
},
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/CostAllocationTags"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"put": {
"tags": [
"CostAllocationTags"
],
"operationId": "CostAllocationTags_CreateOrUpdate",
"description": "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.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/"
},
"x-ms-examples": {
"CreateOrUpdateCostAllocationTags": {
"$ref": "./examples/CreateOrUpdateCostAllocationTags.json"
}
},
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CostAllocationTags"
},
"description": "Parameters supplied to the Create cost allocation tags operation."
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/CostAllocationTags"
}
},
"201": {
"description": "Created.",
"schema": {
"$ref": "#/definitions/CostAllocationTags"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -2012,6 +2103,43 @@
"contactEmails"
]
},
"CostAllocationTags": {
"description": "A cost allocation tag resource.",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/ProxyResource"
}
],
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/CostAllocationTagProperties",
"title": "Cost allocation tag properties"
}
}
},
"CostAllocationTagProperties": {
"description": "The properties of the cost allocation tag.",
"properties": {
"costAllocationTags": {
"description": "Cost allocation tags.",
"type": "array",
"items": {
"$ref": "#/definitions/CostAllocationTag"
}
}
}
},
"CostAllocationTag": {
"description": "The cost allocation tag.",
"properties": {
"key": {
"description": "Cost allocation tag key.",
"type": "string"
}
}
},
"ErrorDetails": {
"description": "The details of the error.",
"properties": {
Expand Down Expand Up @@ -2253,6 +2381,14 @@
"required": true,
"type": "string"
},
"billingAccountIdParameter": {
"name": "billingAccountId",
"in": "path",
"description": "Azure Billing Account ID.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"resourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
Expand Down Expand Up @@ -2296,6 +2432,7 @@
"grainParameter": {
"name": "grain",
"description": "Can be daily or monthly",
"x-ms-parameter-location": "method",
"in": "query",
"required": true,
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parameters": {
"api-version": "2018-03-31",
"billingAccountId": "12345"
},
"responses": {
"200": {
"body": {
"id": "providers/Microsoft.CostManagement/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/costAllocationTags/costAllocationTags1",
"name": "costAllocationTags1",
"type": "Microsoft.Consumption/costAllocationTags",
"eTag": "\"1d34d012214157f\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asarkar84 - As per the definition of "eTag" in the spec, it is a string.

What is the reason behind escaping the quotes "\"1d34d012214157f\""? Wouldn't this "1d34d012214157f" be sufficient? Why is the service sending a string with quotes in it ?
/cc @sergey-shandar - FYI.

Copy link
Contributor Author

@asarkar84 asarkar84 Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how azure services or apis do eTag: " For example, I checked the CosmosDB data explorer which is publicly available. I found _eTag property exposed there and the service returns it with quotes. Storage also has quotes in their eTag. Since 2 double quotes are not accepted in json we need to escape one which is inside the value.

PFB the CosmosDB example for reference:
_etag": ""00000e3a-0000-0000-0000-59c94cd20000"",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amarzavery Just refer any public API for reference, eTag will have quote. Escape char is used as per json standard since it will not accept 2 quotes like this ""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation. That makes sense.

"properties": {
"costAllocationTags": [
{
"key": "Department"
},
{
"key": "CostCenter"
},
{
"key": "Portal"
},
{
"key": "OrgName"
}
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"parameters": {
"api-version": "2018-03-31",
"billingAccountId": "12345",
"parameters": {
"costAllocationTags": [
{
"key": "Department"
},
{
"key": "CostCenter"
},
{
"key": "Portal"
},
{
"key": "OrgName"
}
]
}
},
"responses": {
"201": {
"body": {
"id": "providers/Microsoft.CostManagement/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/costAllocationTags/costAllocationTags1",
"name": "costAllocationTags1",
"type": "Microsoft.Consumption/costAllocationTags",
"eTag": "\"1d34d012214157f\"",
"properties": {
"costAllocationTags": [
{
"key": "Department"
},
{
"key": "CostCenter"
},
{
"key": "Portal"
},
{
"key": "OrgName"
}
]
}
}
},
"200": {
"body": {
"id": "providers/Microsoft.CostManagement/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/costAllocationTags/costAllocationTags1",
"name": "costAllocationTags1",
"type": "Microsoft.Consumption/costAllocationTags",
"eTag": "\"1d34d012214157f\"",
"properties": {
"costAllocationTags": [
{
"key": "Department"
},
{
"key": "CostCenter"
},
{
"key": "Portal"
},
{
"key": "OrgName"
}
]
}
}
}
}
}