-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[TSP Migration][cost-management] Migrate cost-management to TypeSpec #37377
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
Merged
Merged
Changes from 43 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
a1f8ab6
The first version of TSP
melina5656 9750037
Merge branch 'main' into cost-management-errorresponse-fix
melina5656 661b5a7
Merge branch 'main' into cost-management-errorresponse-fix
melina5656 178e8e7
Fix errors and diff
melina5656 794801a
Delete old swagger files
melina5656 dd73c01
Update tspconfig.yaml
melina5656 fb3ae5e
Fix model validation errors and spellcheck errors
melina5656 90e66bb
Update BillingAccountAlerts.json
melina5656 d065701
update example files
melina5656 0b7e473
update example files
melina5656 706792f
update example files
melina5656 5274165
Remove operationId Decorator
melina5656 3d1a24f
Update tspconfig.yaml
melina5656 9cac238
Add x-ms-long-running-operation to GET operation
melina5656 85c73f9
Remove unnecessary properties
melina5656 91bc07f
Update tspconfig.yaml
melina5656 40e382e
resolve conflicts from folder migration
zedy-wj 0384d32
Merge branch 'main' into convert/cost-management
melina5656 ad7d1fd
run tsp compile
melina5656 8393a66
Merge branch 'main' into convert/cost-management
melina5656 923a482
Add visibility
melina5656 6633322
Update cspell.yaml
melina5656 95bc708
Update cspell.yaml
melina5656 718193e
Update cspell.yaml
melina5656 291070f
Update cspell.yaml
melina5656 0ef7989
Update cspell.yaml
melina5656 29d599b
Update tspconfig.yaml
melina5656 4251312
format tspconfig.yaml
melina5656 f02cc39
tsp format
melina5656 6ccd9c9
Add client.tsp with Java breaking change mitigations
weidongxu-microsoft 308c28d
rename in java
weidongxu-microsoft 5a97dfd
Update client.tsp and tspconfig.yaml with additional breaking change …
weidongxu-microsoft 73f09e1
more java rename
weidongxu-microsoft 58a7ea3
Update specification/cost-management/resource-manager/Microsoft.CostM…
kazrael2119 0f04521
Merge branch 'main' into cost-management-errorresponse-fix
kazrael2119 546549c
Update specification/cost-management/resource-manager/Microsoft.CostM…
kazrael2119 cf50ba4
update
melina5656 5eaf51d
Merge branch 'cost-management-errorresponse-fix' of https://github.co…
melina5656 d9d3264
Merge branch 'main' into convert/cost-management
melina5656 1c0467d
update tagFilter
melina5656 a75992b
update OperationStatusType
melina5656 53d58aa
Remove and Replace Deprecated or Disabled Decorators
melina5656 11dbb8e
Update tspconfig.yaml
melina5656 b642e04
Update specification/cost-management/resource-manager/Microsoft.CostM…
kazrael2119 f61e119
Merge branch 'main' into cost-management-errorresponse-fix
kazrael2119 58c5801
Add client overrides
melina5656 77dab6c
Update client.tsp
ChenxiJiang333 1d9a7d2
Update client.tsp
ChenxiJiang333 c12e031
update operation name for JavaScript
melina5656 991d3e1
Update CostDetailsOperationResults to be a non-resource model
melina5656 c5b4124
Replace some list operation templates with ListSinglePage
melina5656 fe33147
Update readme.md
melina5656 c8270db
Update client.tsp
kazrael2119 ac7a987
Merge branch 'main' into cost-management-errorresponse-fix
mikeharder 3d0d17f
Update client.tsp
kazrael2119 ce6a346
Merge branch 'cost-management-errorresponse-fix' of https://github.co…
kazrael2119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...cation/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/Alert.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.CostManagement; | ||
| /** | ||
| * An individual alert. | ||
| */ | ||
| model Alert is Azure.ResourceManager.ExtensionResource<AlertProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = Alert, | ||
| KeyName = "alertId", | ||
| SegmentName = "alerts", | ||
| NamePattern = "" | ||
| >; | ||
|
|
||
| /** | ||
| * eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| eTag?: Azure.Core.eTag; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface Alerts { | ||
| /** | ||
| * Gets the alert for the scope by alert ID. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/costmanagement/") | ||
| get is Extension.Read<Extension.ScopeParameter, Alert, Error = ErrorResponse>; | ||
|
|
||
| /** | ||
| * Dismisses the specified alert | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @patch(#{ implicitOptionality: false }) | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/costmanagement/") | ||
| dismiss is Extension.CustomPatchSync< | ||
| Extension.ScopeParameter, | ||
| Alert, | ||
| PatchModel = DismissAlertPayload, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Lists the alerts for scope defined. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/costmanagement/") | ||
| list is Extension.ListByTarget< | ||
| Extension.ScopeParameter, | ||
| Alert, | ||
| Response = ArmResponse<AlertsResult>, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(Alert.name, "Alert ID"); | ||
| @@doc(Alert.properties, "Alert properties."); | ||
| @@doc(Alerts.dismiss::parameters.properties, | ||
| "Parameters supplied to the Dismiss Alert operation." | ||
| ); | ||
| @@path(Alert.name, #{ allowReserved: true }); | ||
94 changes: 94 additions & 0 deletions
94
...ation/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/Budget.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.CostManagement; | ||
| /** | ||
| * A budget resource. | ||
| */ | ||
| model Budget is Azure.ResourceManager.ExtensionResource<BudgetProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = Budget, | ||
| KeyName = "budgetName", | ||
| SegmentName = "budgets", | ||
| NamePattern = "^[a-zA-Z0-9_-]+$" | ||
| >; | ||
|
|
||
| /** | ||
| * eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| eTag?: Azure.Core.eTag; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface Budgets { | ||
| /** | ||
| * Gets the budget for the scope by budget name. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/CostManagement/") | ||
| get is Extension.Read< | ||
| Extension.ScopeParameter, | ||
| Budget, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/CostManagement/") | ||
| createOrUpdate is Extension.CreateOrReplaceSync< | ||
| Extension.ScopeParameter, | ||
| Budget, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * The operation to delete a budget. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/CostManagement/") | ||
| delete is Extension.DeleteSync< | ||
| Extension.ScopeParameter, | ||
| Budget, | ||
| Response = ArmDeletedResponse, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Lists all budgets for the defined scope. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @externalDocs("https://docs.microsoft.com/en-us/rest/api/CostManagement/") | ||
| list is Extension.ListByTarget< | ||
| Extension.ScopeParameter, | ||
| Budget, | ||
| Parameters = { | ||
| /** | ||
| * OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. | ||
| */ | ||
| @query("$filter") | ||
| $filter?: string; | ||
| }, | ||
| Response = ArmResponse<BudgetsListResult>, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@maxLength(Budget.name, 63); | ||
| @@minLength(Budget.name, 1); | ||
| @@doc(Budget.name, "Budget Name."); | ||
| @@doc(Budget.properties, "The properties of the budget."); | ||
| @@doc(Budgets.createOrUpdate::parameters.resource, | ||
| "Parameters supplied to the Create Budget operation." | ||
| ); |
83 changes: 83 additions & 0 deletions
83
...resource-manager/Microsoft.CostManagement/CostManagement/CostAllocationRuleDefinition.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.CostManagement; | ||
| /** | ||
| * The cost allocation rule model definition | ||
| */ | ||
| @tenantResource | ||
| model CostAllocationRuleDefinition | ||
| is Azure.ResourceManager.ProxyResource<CostAllocationRuleProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = CostAllocationRuleDefinition, | ||
| KeyName = "ruleName", | ||
| SegmentName = "costAllocationRules", | ||
| NamePattern = "[A-Za-z0-9\\-_]+" | ||
| >; | ||
| } | ||
|
|
||
| alias CostAllocationRuleDefinitionsOps = Extension.ExternalResource< | ||
| "microsoft.Billing", | ||
| "billingAccounts", | ||
| "billingAccountId", | ||
| Description = "BillingAccount ID", | ||
| ParentType = "Tenant" | ||
| >; | ||
|
|
||
| @armResourceOperations | ||
| interface CostAllocationRuleDefinitions { | ||
| /** | ||
| * Get a cost allocation rule by rule name and billing account or enterprise enrollment. | ||
| */ | ||
| get is Extension.Read< | ||
| CostAllocationRuleDefinitionsOps, | ||
| CostAllocationRuleDefinition, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. | ||
| */ | ||
| createOrUpdate is Extension.CreateOrReplaceSync< | ||
| CostAllocationRuleDefinitionsOps, | ||
| CostAllocationRuleDefinition, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Delete cost allocation rule for billing account or enterprise enrollment. | ||
| */ | ||
| delete is Extension.DeleteSync< | ||
| CostAllocationRuleDefinitionsOps, | ||
| CostAllocationRuleDefinition, | ||
| Error = ErrorResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Get the list of all cost allocation rules for a billing account or enterprise enrollment. | ||
| */ | ||
| list is Extension.ListByTarget< | ||
| CostAllocationRuleDefinitionsOps, | ||
| CostAllocationRuleDefinition, | ||
| Response = ArmResponse<CostAllocationRuleList>, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(CostAllocationRuleDefinition.name, | ||
| "Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters." | ||
| ); | ||
| @@doc(CostAllocationRuleDefinition.properties, | ||
| "Cost allocation rule properties" | ||
| ); | ||
| @@doc(CostAllocationRuleDefinitions.createOrUpdate::parameters.resource, | ||
| "Cost allocation rule to be created or updated" | ||
| ); |
69 changes: 69 additions & 0 deletions
69
.../resource-manager/Microsoft.CostManagement/CostManagement/CostDetailsOperationResults.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.CostManagement; | ||
| // FIXME: CostDetailsOperationResults has no properties property | ||
| /** | ||
| * The result of the long running operation for cost details Api. | ||
| */ | ||
| model CostDetailsOperationResults | ||
pshao25 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| is Azure.ResourceManager.ExtensionResource<never> { | ||
| ...ResourceNameParameter< | ||
| Resource = CostDetailsOperationResults, | ||
| KeyName = "operationId", | ||
| SegmentName = "costDetailsOperationResults", | ||
| NamePattern = "" | ||
| >; | ||
|
|
||
| /** | ||
| * The status of the cost details operation | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| status?: CostDetailsStatusType; | ||
|
|
||
| /** | ||
| * The manifest of the report generated by the operation. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| manifest?: ReportManifest; | ||
|
|
||
| /** | ||
| * The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. | ||
| */ | ||
| // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| validTill?: utcDateTime; | ||
|
|
||
| /** | ||
| * The details of the error. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| error?: ErrorDetails; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface GenerateCostDetailsReport { | ||
| /** | ||
| * Get the result of the specified operation. This link is provided in the CostDetails creation request response Location header. | ||
| */ | ||
| #suppress "@azure-tools/typespec-client-generator-core/mark-as-lro-ineffective" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
| @Azure.ClientGenerator.Core.Legacy.markAsLro | ||
| getOperationResults is Extension.Read< | ||
| Extension.ScopeParameter, | ||
| CostDetailsOperationResults, | ||
| Response = ArmResponse<CostDetailsOperationResults> | ArmAcceptedResponse, | ||
| Error = ErrorResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(CostDetailsOperationResults.name, "The target operation Id."); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.