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 reservation recommendations and tags #2679

Merged
merged 16 commits into from
Mar 19, 2018
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
Next Next commit
Added Tags filter and grouping for UsageDetails
Added Tags filter and grouping for UsageDetails
  • Loading branch information
asarkar84 committed Mar 15, 2018
commit 002a6dbdb5b9a98d96e17b04b0ce0163bfad8e30
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"x-ms-examples": {
"UsageDetailsList": {
"$ref": "./examples/UsageDetailsList.json"
},
"UsageDetailsListFilterByTag": {
"$ref": "./examples/UsageDetailsListFilterByTag.json"
},
"UsageDetailsListGroupByTagDate": {
"$ref": "./examples/UsageDetailsListGroupByTagDate.json"
}
},
"parameters": [
Expand All @@ -62,7 +68,7 @@
},
{
"name": "$filter",
"description": "May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.",
"description": "May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:).",
"in": "query",
"required": false,
"type": "string"
Expand All @@ -83,6 +89,18 @@
"minimum": 1,
"maximum": 1000
},
{
"name": "$apply",
"description": "OData apply expression to aggregatie usageDetails by tags or (tags and properties/usageStart)",
"in": "query",
"required": false,
"type": "string",
"x-ms-parameter-location": "method",
"x-ms-parameter-grouping": {
"name": "QueryOptions"
},
"x-ms-client-name": "Apply"
},
{
"$ref": "#/parameters/apiVersionParameter"
}
Expand Down Expand Up @@ -122,6 +140,9 @@
},
"UsageDetailsExpand": {
"$ref": "./examples/UsageDetailsExpand.json"
},
"UsageDetailsListForBillingPeriodGroupByTag": {
"$ref": "./examples/UsageDetailsListForBillingPeriodGroupByTag.json"
}
},
"parameters": [
Expand All @@ -140,11 +161,23 @@
},
{
"name": "$filter",
"description": "May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.",
"description": "May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:).",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "$apply",
"description": "OData apply expression to aggregatie usageDetails by tags or (tags and properties/usageStart) for specified billing period",
"in": "query",
"required": false,
"type": "string",
"x-ms-parameter-location": "method",
"x-ms-parameter-grouping": {
"name": "QueryOptions"
},
"x-ms-client-name": "Apply"
},
{
"name": "$skiptoken",
"description": "Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.",
Expand Down Expand Up @@ -533,6 +566,55 @@
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations": {
"get": {
"tags": [
"ReservationRecommendations"
],
"operationId": "reservationRecommendations_List",
Copy link
Member

Choose a reason for hiding this comment

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

Should be "ReservationRecommendations_List" (upper-case 'r').

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Corrected.

"description": "List of recomendations for purchasing reserved instances.",
"externalDocs": {
"url": "https://docs.microsoft.com/en-us/rest/api/consumption/"
},
"x-ms-examples": {
"ReservationRecommendations": {
"$ref": "./examples/ReservationRecommendations.json"
},
"ReservationRecommendationsFilterByScopeLookBackPeriod": {
"$ref": "./examples/ReservationRecommendationsFilterByScopeLookBackPeriod.json"
}
},
"parameters": [
Copy link
Member

Choose a reason for hiding this comment

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

The subscriptionId parameter is missing which is the cause of the travis failure, see the log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Just missed it. I have added it.

{
"name": "$filter",
"description": "May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod.",
"in": "query",
"required": false,
"type": "string"
},
{
"$ref": "#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/ReservationRecommendationsListResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets": {
"get": {
"tags": [
Expand Down Expand Up @@ -1550,6 +1632,66 @@
}
}
},
"ReservationRecommendationsProperties": {
"description": "The properties of the reservation summaries.",
"properties": {
"reservationOrderId": {
"description": "The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations.",
"type": "string",
"readOnly": true
},
"reservationId": {
"description": "The reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to.",
"type": "string",
"readOnly": true
},
"skuName": {
"description": "This is the ARM Sku name. It can be used to join with the servicetype field in additoinalinfo in usage records.",
"type": "string",
"readOnly": true
},
"reservedHours": {
"description": "This is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days",
"type": "number",
"format": "decimal",
"readOnly": true
}
}
},
"ReservationRecommendations": {
"description": "reservation recommendations resource.",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/Resource"
}
],
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/ReservationRecommendationsProperties",
"title": "Reservation Recommendations properties"
}
}
},
"ReservationRecommendationsListResult": {
"description": "Result of listing reservation recommendations.",
"properties": {
"value": {
"description": "The list of reservation recommendations.",
"type": "array",
"readOnly": true,
"items": {
"$ref": "#/definitions/ReservationRecommendations"
}
},
"nextLink": {
"description": "The link (url) to the next page of results.",
"type": "string",
"readOnly": true
}
}
},
"ReservationDetailsProperties": {
"description": "The properties of the reservation details.",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"billingPeriodName": "201702",
"$expand": "meterDetails,additionalProperties",
"$filter": "properties/usageEnd ge '2018-01-14' AND properties/usageEnd le '2018-02-14'",
"$filter": "properties/usageEnd ge '2018-01-14' AND properties/usageEnd le '2018-02-14' AND tags eq 'dev:tools'",
"$top": 1
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"parameters": {
"api-version": "2018-03-31",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"$filter": "tags eq 'dev:tools'"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
"name": "usageDetailsId1",
"type": "Microsoft.Consumption/usageDetails",
"tags": {
"dev": "tools"
},
"properties": {
"billingPeriodId": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702",
"invoiceId": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/invoices/201703-123456789",
"usageStart": "2017-02-13T00:00:00Z",
"usageEnd": "2017-02-13T23:59:59Z",
"instanceName": "shared1",
"instanceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1",
"instanceLocation": "eastasia",
"currency": "USD",
"usageQuantity": 0.00328,
"billableQuantity": 0.00328,
"pretaxCost": 0.67,
"isEstimated": false,
"meterId": "00000000-0000-0000-0000-000000000000"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"parameters": {
"api-version": "2018-03-31",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"billingPeriodName": "201803",
"$apply": "groupby((tags))"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
"name": "usageDetailsId1",
"type": "Microsoft.Consumption/usageDetails",
"tags": {
"description": "Azure VCAP STA - RDS Server"
},
"properties": {
"billingPeriodId": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301",
"usageQuantity": 11.11111,
"pretaxCost": 0,
"currency": "USD"
}
},
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
"name": "usageDetailsId1",
"type": "Microsoft.Consumption/usageDetails",
"tags": {
"description": "Domain controller - STA"
},
"properties": {
"billingPeriodId": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301",
"usageQuantity": 111.11111111111,
"pretaxCost": 0,
"currency": "USD"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parameters": {
"api-version": "2018-03-31",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"$apply": "groupby((tags,properties/usageStart))"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
"name": "usageDetailsId1",
"type": "Microsoft.Consumption/usageDetails",
"tags": {
"description": "Azure VCAP STA - RDS Server"
},
"properties": {
"billingPeriodId": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301",
"usageStart": "2018-03-01T00:00:00.0000000Z",
"usageEnd": "2018-03-01T23:59:59.0000000Z",
"usageQuantity": 11.11111,
"pretaxCost": 0,
"currency": "USD"
}
},
{
"id": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
"name": "usageDetailsId1",
"type": "Microsoft.Consumption/usageDetails",
"tags": {
"description": "Domain controller - STA"
},
"properties": {
"billingPeriodId": "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/20180301",
"usageStart": "2018-03-01T00:00:00.0000000Z",
"usageEnd": "2018-03-01T23:59:59.0000000Z",
"usageQuantity": 1.11111111111,
"pretaxCost": 0,
"currency": "USD"
}
}
]
}
}
}
}