Skip to content

Commit 095f0ee

Browse files
committed
[Consumption] Add --name/-n aliases, flatten --time-period, add examples
- Expose --budget-name also as --name and -n on budget show/delete/create/update. - Flatten --time-period on budget create/update so users pass --start-date and --end-date directly. - Add a manual example for 'budget create' and a swagger-generated example for 'budget show'.
1 parent 06fc79e commit 095f0ee

5 files changed

Lines changed: 43 additions & 27 deletions

File tree

Commands/consumption/budget/_create.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ Create operation to create or update a budget. You can optionally provide an eTa
1111
### [2024-08-01](/Resources/mgmt-plane/L3tzY29wZX0vcHJvdmlkZXJzL21pY3Jvc29mdC5jb25zdW1wdGlvbi9idWRnZXRzL3t9/2024-08-01.xml) **Stable**
1212

1313
<!-- mgmt-plane /{scope}/providers/microsoft.consumption/budgets/{} 2024-08-01 -->
14+
15+
#### examples
16+
17+
- Create a monthly cost budget
18+
```bash
19+
consumption budget create -n my-budget --amount 100 --category Cost --time-grain Monthly --start-date 2025-01-01T00:00:00Z --end-date 2025-12-31T00:00:00Z --scope subscriptions/00000000-0000-0000-0000-000000000000
20+
```

Commands/consumption/budget/_show.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ Get the budget for the scope by budget name.
1111
### [2024-08-01](/Resources/mgmt-plane/L3tzY29wZX0vcHJvdmlkZXJzL21pY3Jvc29mdC5jb25zdW1wdGlvbi9idWRnZXRzL3t9/2024-08-01.xml) **Stable**
1212

1313
<!-- mgmt-plane /{scope}/providers/microsoft.consumption/budgets/{} 2024-08-01 -->
14+
15+
#### examples
16+
17+
- Budget
18+
```bash
19+
consumption budget show --scope subscriptions/00000000-0000-0000-0000-000000000000 --name TestBudget
20+
```

Commands/consumption/usage/_list.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ List the usage details for the defined scope. Usage details are available via th
44

55
**Note:Microsoft will be retiring the Consumption Usage Details API at some point in the future. We do not recommend that you take a new dependency on this API. Please use the Cost Details API instead. We will notify customers once a date for retirement has been determined.For Learn more,see [Generate Cost Details Report - Create Operation](https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?tabs=HTTP)**
66

7+
**Note:Microsoft will be retiring the Consumption Usage Details API at some point in the future. We do not recommend that you take a new dependency on this API. Please use the Cost Details API instead. We will notify customers once a date for retirement has been determined.For Learn more,see [Generate Cost Details Report - Create Operation](https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?tabs=HTTP)**
8+
9+
**Note:Microsoft will be retiring the Consumption Usage Details API at some point in the future. We do not recommend that you take a new dependency on this API. Please use the Cost Details API instead. We will notify customers once a date for retirement has been determined.For Learn more,see [Generate Cost Details Report - Create Operation](https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?tabs=HTTP)**
10+
711
## Versions
812

913
### [2018-01-31](/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5iaWxsaW5nL2JpbGxpbmdwZXJpb2RzL3t9L3Byb3ZpZGVycy9taWNyb3NvZnQuY29uc3VtcHRpb24vdXNhZ2VkZXRhaWxz/2018-01-31.xml) **Preview**

Resources/mgmt-plane/L3tzY29wZX0vcHJvdmlkZXJzL21pY3Jvc29mdC5jb25zdW1wdGlvbi9idWRnZXRzL3t9/2024-08-01.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Resources/mgmt-plane/L3tzY29wZX0vcHJvdmlkZXJzL21pY3Jvc29mdC5jb25zdW1wdGlvbi9idWRnZXRzL3t9/2024-08-01.xml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<command name="show" version="2024-08-01">
66
<resource id="/{scope}/providers/microsoft.consumption/budgets/{}" version="2024-08-01" swagger="mgmt-plane/consumption/ResourceProviders/Microsoft.Consumption/Paths/L3tzY29wZX0vcHJvdmlkZXJzL01pY3Jvc29mdC5Db25zdW1wdGlvbi9idWRnZXRzL3tidWRnZXROYW1lfQ==/V/MjAyNC0wOC0wMQ=="/>
77
<argGroup name="">
8-
<arg type="string" var="$Path.budgetName" options="budget-name" required="True">
8+
<arg type="string" var="$Path.budgetName" options="name n" required="True">
99
<help short="Budget Name."/>
1010
</arg>
1111
<arg type="string" var="$Path.scope" options="scope" required="True">
@@ -194,7 +194,7 @@
194194
<command name="delete" version="2024-08-01" confirmation="Are you sure you want to perform this operation?">
195195
<resource id="/{scope}/providers/microsoft.consumption/budgets/{}" version="2024-08-01" swagger="mgmt-plane/consumption/ResourceProviders/Microsoft.Consumption/Paths/L3tzY29wZX0vcHJvdmlkZXJzL01pY3Jvc29mdC5Db25zdW1wdGlvbi9idWRnZXRzL3tidWRnZXROYW1lfQ==/V/MjAyNC0wOC0wMQ=="/>
196196
<argGroup name="">
197-
<arg type="string" var="$Path.budgetName" options="budget-name" required="True">
197+
<arg type="string" var="$Path.budgetName" options="name n" required="True">
198198
<help short="Budget Name."/>
199199
</arg>
200200
<arg type="string" var="$Path.scope" options="scope" required="True">
@@ -229,7 +229,7 @@
229229
<command name="create" version="2024-08-01">
230230
<resource id="/{scope}/providers/microsoft.consumption/budgets/{}" version="2024-08-01" swagger="mgmt-plane/consumption/ResourceProviders/Microsoft.Consumption/Paths/L3tzY29wZX0vcHJvdmlkZXJzL01pY3Jvc29mdC5Db25zdW1wdGlvbi9idWRnZXRzL3tidWRnZXROYW1lfQ==/V/MjAyNC0wOC0wMQ=="/>
231231
<argGroup name="">
232-
<arg type="string" var="$Path.budgetName" options="budget-name" required="True">
232+
<arg type="string" var="$Path.budgetName" options="name n" required="True">
233233
<help short="Budget Name."/>
234234
</arg>
235235
<arg type="string" var="$Path.scope" options="scope" required="True">
@@ -366,16 +366,15 @@
366366
<item name="Quarterly" value="&quot;Quarterly&quot;"/>
367367
</enum>
368368
</arg>
369-
<arg type="object" var="$parameters.properties.timePeriod" options="time-period" group="Properties">
370-
<help short="Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on the end date."/>
371-
<arg type="dateTime" var="$parameters.properties.timePeriod.endDate" options="end-date">
372-
<help short="The end date for the budget. If not provided, we default this to 10 years from the start date."/>
373-
<format protocol="iso"/>
374-
</arg>
375-
<arg type="dateTime" var="$parameters.properties.timePeriod.startDate" options="start-date" required="True">
376-
<help short="The start date for the budget."/>
377-
<format protocol="iso"/>
378-
</arg>
369+
</argGroup>
370+
<argGroup name="TimePeriod">
371+
<arg type="dateTime" var="$parameters.properties.timePeriod.endDate" options="end-date" group="TimePeriod">
372+
<help short="The end date for the budget. If not provided, we default this to 10 years from the start date."/>
373+
<format protocol="iso"/>
374+
</arg>
375+
<arg type="dateTime" var="$parameters.properties.timePeriod.startDate" options="start-date" group="TimePeriod">
376+
<help short="The start date for the budget."/>
377+
<format protocol="iso"/>
379378
</arg>
380379
</argGroup>
381380
<operation operationId="Budgets_CreateOrUpdate">
@@ -492,7 +491,7 @@
492491
<item value="&quot;Quarterly&quot;"/>
493492
</enum>
494493
</prop>
495-
<prop type="object" name="timePeriod" arg="$parameters.properties.timePeriod" required="True">
494+
<prop type="object" name="timePeriod" required="True">
496495
<prop type="dateTime" name="endDate" arg="$parameters.properties.timePeriod.endDate">
497496
<format protocol="iso"/>
498497
</prop>
@@ -673,7 +672,7 @@
673672
<command name="update" version="2024-08-01">
674673
<resource id="/{scope}/providers/microsoft.consumption/budgets/{}" version="2024-08-01" swagger="mgmt-plane/consumption/ResourceProviders/Microsoft.Consumption/Paths/L3tzY29wZX0vcHJvdmlkZXJzL01pY3Jvc29mdC5Db25zdW1wdGlvbi9idWRnZXRzL3tidWRnZXROYW1lfQ==/V/MjAyNC0wOC0wMQ=="/>
675674
<argGroup name="">
676-
<arg type="string" var="$Path.budgetName" options="budget-name" required="True">
675+
<arg type="string" var="$Path.budgetName" options="name n" required="True">
677676
<help short="Budget Name."/>
678677
</arg>
679678
<arg type="string" var="$Path.scope" options="scope" required="True">
@@ -809,16 +808,15 @@
809808
<item name="Quarterly" value="&quot;Quarterly&quot;"/>
810809
</enum>
811810
</arg>
812-
<arg type="object" var="$parameters.properties.timePeriod" options="time-period" group="Properties">
813-
<help short="Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on the end date."/>
814-
<arg nullable="True" type="dateTime" var="$parameters.properties.timePeriod.endDate" options="end-date">
815-
<help short="The end date for the budget. If not provided, we default this to 10 years from the start date."/>
816-
<format protocol="iso"/>
817-
</arg>
818-
<arg type="dateTime" var="$parameters.properties.timePeriod.startDate" options="start-date">
819-
<help short="The start date for the budget."/>
820-
<format protocol="iso"/>
821-
</arg>
811+
</argGroup>
812+
<argGroup name="TimePeriod">
813+
<arg nullable="True" type="dateTime" var="$parameters.properties.timePeriod.endDate" options="end-date" group="TimePeriod">
814+
<help short="The end date for the budget. If not provided, we default this to 10 years from the start date."/>
815+
<format protocol="iso"/>
816+
</arg>
817+
<arg type="dateTime" var="$parameters.properties.timePeriod.startDate" options="start-date" group="TimePeriod">
818+
<help short="The start date for the budget."/>
819+
<format protocol="iso"/>
822820
</arg>
823821
</argGroup>
824822
<operation operationId="Budgets_Get">
@@ -1100,7 +1098,7 @@
11001098
<item value="&quot;Quarterly&quot;"/>
11011099
</enum>
11021100
</prop>
1103-
<prop type="object" name="timePeriod" arg="$parameters.properties.timePeriod" required="True">
1101+
<prop type="object" name="timePeriod" required="True">
11041102
<prop type="dateTime" name="endDate" arg="$parameters.properties.timePeriod.endDate">
11051103
<format protocol="iso"/>
11061104
</prop>

0 commit comments

Comments
 (0)