-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
Copy pathcostallocation.json
617 lines (617 loc) · 19.6 KB
/
costallocation.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
{
"swagger": "2.0",
"info": {
"title": "CostManagementClient",
"version": "2023-08-01"
},
"tags": [
{
"name": "CostAllocationRules",
"description": "An API for creating and managing cost allocation rules within a billing account or enterprise enrollment. These rules can be used to reallocate cost between resources, filtered by Resource Group, Subscription, or Tag."
}
],
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow.",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules": {
"get": {
"tags": [
"CostAllocationRules"
],
"operationId": "CostAllocationRules_List",
"description": "Get the list of all cost allocation rules for a billing account or enterprise enrollment.",
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-examples": {
"CostAllocationRulesList": {
"$ref": "./examples/CostAllocationRulesList.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
}
],
"responses": {
"200": {
"description": "List of cost allocation rules for the billing account or enterprise enrollment.",
"schema": {
"$ref": "#/definitions/CostAllocationRuleList"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability": {
"post": {
"tags": [
"CostAllocationRules"
],
"operationId": "CostAllocationRules_CheckNameAvailability",
"description": "Checks availability and correctness of a name for a cost allocation rule",
"x-ms-examples": {
"CostAllocationRuleCheckNameAvailability": {
"$ref": "./examples/CostAllocationRuleCheckNameAvailability.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
},
{
"name": "costAllocationRuleCheckNameAvailabilityRequest",
"description": "Cost allocation rule to be created or updated",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CostAllocationRuleCheckNameAvailabilityRequest"
}
}
],
"responses": {
"200": {
"description": "Response of cost allocation rule name availability.",
"schema": {
"$ref": "#/definitions/CostAllocationRuleCheckNameAvailabilityResponse"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}": {
"get": {
"tags": [
"CostAllocationRules"
],
"operationId": "CostAllocationRules_Get",
"description": "Get a cost allocation rule by rule name and billing account or enterprise enrollment.",
"x-ms-examples": {
"CostAllocationRules": {
"$ref": "./examples/CostAllocationRuleGet.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
},
{
"$ref": "#/parameters/ruleNameParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/CostAllocationRuleDefinition"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"put": {
"tags": [
"CostAllocationRules"
],
"operationId": "CostAllocationRules_CreateOrUpdate",
"description": "Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment.",
"x-ms-examples": {
"CostAllocationRulesCreateResourceGroup": {
"$ref": "./examples/CostAllocationRuleCreate.json"
},
"CostAllocationRulesCreateTag": {
"$ref": "./examples/CostAllocationRuleCreateTag.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
},
{
"$ref": "#/parameters/ruleNameParameter"
},
{
"name": "costAllocationRule",
"description": "Cost allocation rule to be created or updated",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CostAllocationRuleDefinition"
}
}
],
"responses": {
"200": {
"description": "OK. The update request has succeeded.",
"schema": {
"$ref": "#/definitions/CostAllocationRuleDefinition"
}
},
"201": {
"description": "Created. The request has succeeded.",
"schema": {
"$ref": "#/definitions/CostAllocationRuleDefinition"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"delete": {
"tags": [
"CostAllocationRules"
],
"operationId": "CostAllocationRules_Delete",
"description": "Delete cost allocation rule for billing account or enterprise enrollment.",
"x-ms-examples": {
"DeleteCostAllocationRule": {
"$ref": "./examples/CostAllocationRuleDelete.json"
}
},
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountIdParameter"
},
{
"$ref": "#/parameters/ruleNameParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded."
},
"204": {
"description": "NoContent. Rule did not exist."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
"ErrorDetails": {
"description": "The details of the error.",
"type": "object",
"properties": {
"code": {
"description": "Error code.",
"type": "string",
"readOnly": true
},
"message": {
"description": "Error message indicating why the operation failed.",
"type": "string",
"readOnly": true
}
}
},
"ErrorResponse": {
"description": "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. \n\nSome Error responses: \n\n * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the \"x-ms-ratelimit-microsoft.consumption-retry-after\" header. \n\n * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the \"Retry-After\" header.",
"type": "object",
"properties": {
"error": {
"description": "The details of the error.",
"$ref": "#/definitions/ErrorDetails"
}
}
},
"CostAllocationRuleList": {
"type": "object",
"description": "Result of listing cost allocation rules. It contains a list of available rules in the billing account or enterprise enrollment provided.",
"properties": {
"value": {
"description": "The list of cost allocation rules.",
"type": "array",
"items": {
"$ref": "#/definitions/CostAllocationRuleDefinition"
},
"x-ms-identifiers": [
"id"
]
},
"nextLink": {
"description": "URL to get the next set of rule list results if there are any.",
"type": "string",
"readOnly": true
}
}
},
"CostAllocationRuleCheckNameAvailabilityRequest": {
"type": "object",
"description": "The cost allocation rule check name availability request",
"properties": {
"name": {
"type": "string",
"description": "Rule name"
},
"type": {
"type": "string",
"description": "Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules"
}
}
},
"CostAllocationRuleCheckNameAvailabilityResponse": {
"type": "object",
"description": "The cost allocation rule check name availability response",
"properties": {
"nameAvailable": {
"type": "boolean",
"description": "Whether this rule name is available"
},
"reason": {
"$ref": "#/definitions/Reason",
"description": "The reason this name is not available"
},
"message": {
"type": "string",
"description": "Error message if the name is not available"
}
}
},
"Reason": {
"type": "string",
"description": "The reason this name is not available.",
"enum": [
"Invalid",
"AlreadyExists",
"Valid"
],
"x-ms-enum": {
"name": "Reason",
"modelAsString": true
}
},
"CostAllocationRuleDefinition": {
"type": "object",
"description": "The cost allocation rule model definition",
"properties": {
"id": {
"type": "string",
"readOnly": true,
"description": "Azure Resource Manager Id for the rule. This is a read ony value."
},
"name": {
"type": "string",
"readOnly": true,
"description": "Name of the rule. This is a read only value."
},
"type": {
"type": "string",
"readOnly": true,
"description": "Resource type of the rule. This is a read only value of Microsoft.CostManagement/CostAllocationRule."
},
"properties": {
"description": "Cost allocation rule properties",
"$ref": "#/definitions/CostAllocationRuleProperties"
}
},
"x-ms-azure-resource": true
},
"CostAllocationRuleProperties": {
"type": "object",
"description": "The properties of a cost allocation rule",
"additionalProperties": false,
"required": [
"details",
"status"
],
"properties": {
"description": {
"description": "Description of a cost allocation rule.",
"type": "string"
},
"details": {
"description": "Resource information for the cost allocation rule",
"$ref": "#/definitions/CostAllocationRuleDetails"
},
"status": {
"$ref": "#/definitions/RuleStatus",
"description": "Status of the rule"
},
"createdDate": {
"type": "string",
"format": "date-time",
"readOnly": true,
"description": "Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation."
},
"updatedDate": {
"type": "string",
"format": "date-time",
"readOnly": true,
"description": "Time at which the rule was last updated."
}
}
},
"RuleStatus": {
"type": "string",
"description": "Current status of the rule.",
"enum": [
"NotActive",
"Active",
"Processing"
],
"x-ms-enum": {
"name": "RuleStatus",
"modelAsString": true,
"values": [
{
"value": "NotActive",
"description": "Rule is saved but not used to allocate costs.",
"name": "NotActive"
},
{
"value": "Active",
"description": "Rule is saved and impacting cost allocation.",
"name": "Active"
},
{
"value": "Processing",
"description": "Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request.",
"name": "Processing"
}
]
}
},
"CostAllocationRuleDetails": {
"type": "object",
"description": "Resource details of the cost allocation rule",
"properties": {
"sourceResources": {
"description": "Source resources for cost allocation. At this time, this list can contain no more than one element.",
"type": "array",
"items": {
"$ref": "#/definitions/SourceCostAllocationResource"
},
"x-ms-identifiers": [
"name"
]
},
"targetResources": {
"type": "array",
"description": "Target resources for cost allocation. At this time, this list can contain no more than one element.",
"items": {
"$ref": "#/definitions/TargetCostAllocationResource"
},
"x-ms-identifiers": [
"name"
]
}
}
},
"CostAllocationResource": {
"type": "object",
"description": "Common values for resources for cost allocation",
"required": [
"resourceType",
"name"
],
"properties": {
"resourceType": {
"description": "Type of resources contained in this cost allocation rule",
"$ref": "#/definitions/CostAllocationResourceType"
},
"name": {
"description": "If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag",
"type": "string"
}
}
},
"SourceCostAllocationResource": {
"allOf": [
{
"$ref": "#/definitions/CostAllocationResource"
},
{
"type": "object",
"properties": {
"values": {
"description": "Source Resources for cost allocation. This list cannot contain more than 25 values.",
"type": "array",
"items": {
"description": "Source resource for cost allocation",
"type": "string"
},
"x-ms-identifiers": [
"name"
]
}
},
"required": [
"values"
]
}
],
"description": "Source resources for cost allocation"
},
"TargetCostAllocationResource": {
"description": "Target resources for cost allocation.",
"allOf": [
{
"$ref": "#/definitions/CostAllocationResource"
},
{
"type": "object",
"properties": {
"values": {
"description": "Target resources for cost allocation. This list cannot contain more than 25 values.",
"type": "array",
"items": {
"$ref": "#/definitions/CostAllocationProportion"
},
"x-ms-identifiers": [
"name"
]
},
"policyType": {
"description": "Method of cost allocation for the rule",
"$ref": "#/definitions/CostAllocationPolicyType"
}
},
"required": [
"values",
"policyType"
]
}
]
},
"CostAllocationResourceType": {
"type": "string",
"description": "Category of resource to use for allocation.",
"enum": [
"Dimension",
"Tag"
],
"x-ms-enum": {
"name": "CostAllocationResourceType",
"modelAsString": true,
"values": [
{
"value": "Dimension",
"description": "Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation.",
"name": "Dimension"
},
{
"value": "Tag",
"description": "Allocates cost based on Azure Tag key value pairs.",
"name": "Tag"
}
]
}
},
"CostAllocationProportion": {
"type": "object",
"description": "Target resources and allocation",
"required": [
"percentage",
"name"
],
"properties": {
"name": {
"description": "Target resource for cost allocation",
"type": "string"
},
"percentage": {
"description": "Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00.",
"type": "number"
}
}
},
"CostAllocationPolicyType": {
"type": "string",
"description": "Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values.",
"enum": [
"FixedProportion"
],
"x-ms-enum": {
"name": "CostAllocationPolicyType",
"modelAsString": true
}
}
},
"parameters": {
"billingAccountIdParameter": {
"name": "billingAccountId",
"in": "path",
"description": "BillingAccount ID",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"ruleNameParameter": {
"name": "ruleName",
"in": "path",
"description": "Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method",
"pattern": "[A-Za-z0-9\\-_]+"
}
}
}