-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[TypeSpec-Migration] ManagementGroups #38384
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 all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
8e13b1c
initial convert
XiaofeiCao 5e729cb
single swagger file compare
XiaofeiCao f50e1ad
fix routes
XiaofeiCao 0b7d6df
fix managementgroups paths
XiaofeiCao 68c9c57
fix
XiaofeiCao f94bf87
format
XiaofeiCao 6ca72eb
sdk configs
XiaofeiCao d860ff3
Revert "single swagger file compare"
XiaofeiCao e8bdb74
prettier
XiaofeiCao cdb693f
service-dir
XiaofeiCao 8fe0d75
fix cache-control and x-nullable
XiaofeiCao f9d5665
config
XiaofeiCao c6962c7
Merge branch 'main' into migrate/managementgroups
v-jiaodi cfead55
remove operation id
XiaofeiCao d70ecde
fix x-nullable
XiaofeiCao 997c275
x-ms-parameter-location for subscriptionId
XiaofeiCao f7556bc
add code
jliusan b927d94
add code
jliusan 143811f
Add client customization for ManagementGroupsAPI
msyyc 526c295
Rename client to ManagementGroupsMgmtClient
msyyc 4e6a339
Revert "x-ms-parameter-location for subscriptionId"
XiaofeiCao df79d9f
make subscriptionId method level parameter
XiaofeiCao 00b0015
add clientlocation
jliusan b6d242a
fix merge
jliusan 809ed22
test config
jliusan cb874a8
test config
jliusan 150cdee
update config
jliusan fe62140
change code place
jliusan 4675e37
change code place
jliusan 9ec5522
remove code
jliusan 777e250
add usage for input model
v-jiaodi 2f37c3c
update client name
v-jiaodi 5c01ab4
Merge branch 'Azure:main' into migrate/managementgroups
XiaofeiCao 9efc7ad
fix pageable
XiaofeiCao ef04b8e
Update back-compatible.tsp
v-jiaodi f30976e
Update flattenProperty call for EntityInfo
v-jiaodi 46f450d
fix format and final state schema
XiaofeiCao d3b4188
Merge branch 'main' into migrate/managementgroups
pshao25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
specification/managementgroups/ManagementGroups.Management/HierarchySettings.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/rest"; | ||
| import "./models.tsp"; | ||
| import "./ManagementGroup.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
|
|
||
| namespace Microsoft.Management; | ||
| /** | ||
| * Settings defined at the Management Group scope. | ||
| */ | ||
| @singleton("default") | ||
| @parentResource(ManagementGroup) | ||
| model HierarchySettings | ||
| is Azure.ResourceManager.ProxyResource<HierarchySettingsProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = HierarchySettings, | ||
| KeyName = "setting", | ||
| SegmentName = "settings", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface HierarchySettingsOperationGroup { | ||
| /** | ||
| * Gets the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| get is Extension.Read<Extension.Tenant, HierarchySettings>; | ||
|
|
||
| /** | ||
| * Creates or updates the hierarchy settings defined at the Management Group level. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" | ||
| createOrUpdate is Azure.ResourceManager.Legacy.Extension.CreateOrReplaceSync< | ||
| Extension.Tenant, | ||
| HierarchySettings, | ||
| Request = CreateOrUpdateSettingsRequest, | ||
| Response = ArmResourceUpdatedResponse<HierarchySettings> | ||
| >; | ||
|
|
||
| /** | ||
| * Updates the hierarchy settings defined at the Management Group level. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @patch(#{ implicitOptionality: false }) | ||
| update is Extension.CustomPatchSync< | ||
| Extension.Tenant, | ||
| HierarchySettings, | ||
| PatchModel = CreateOrUpdateSettingsRequest | ||
| >; | ||
|
|
||
| /** | ||
| * Deletes the hierarchy settings defined at the Management Group level. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" | ||
| delete is Extension.DeleteSync< | ||
| Extension.Tenant, | ||
| HierarchySettings, | ||
| Response = ArmDeletedResponse | ||
| >; | ||
| } | ||
|
|
||
| @@doc(HierarchySettings.name, ""); | ||
| @@doc(HierarchySettings.properties, | ||
| "The generic properties of hierarchy settings." | ||
| ); | ||
| @@doc(HierarchySettingsOperationGroup.createOrUpdate::parameters.resource, | ||
| "Tenant level settings request parameter." | ||
| ); | ||
| @@doc(HierarchySettingsOperationGroup.update::parameters.properties, | ||
| "Tenant level settings request parameter." | ||
| ); | ||
189 changes: 189 additions & 0 deletions
189
specification/managementgroups/ManagementGroups.Management/ManagementGroup.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,189 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
|
|
||
| namespace Microsoft.Management; | ||
| /** | ||
| * The management group details. | ||
| */ | ||
| model ManagementGroup | ||
| is Azure.ResourceManager.ProxyResource<ManagementGroupProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = ManagementGroup, | ||
| KeyName = "groupId", | ||
| SegmentName = "managementGroups", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface ManagementGroups { | ||
| /** | ||
| * Get the details of the management group. | ||
| * | ||
| */ | ||
| get is Extension.Read< | ||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| Parameters = { | ||
XiaofeiCao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * The $expand=children query string parameter allows clients to request inclusion of children in the response payload. $expand=path includes the path from the root group to the current group. $expand=ancestors includes the ancestor Ids of the current group. | ||
| */ | ||
| @query("$expand") | ||
| $expand?: ManagementGroupExpandType; | ||
|
|
||
| /** | ||
| * The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload. Note that $expand=children must be passed up if $recurse is set to true. | ||
| */ | ||
| @query("$recurse") | ||
| $recurse?: boolean; | ||
|
|
||
| /** | ||
| * A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription') | ||
| */ | ||
| @query("$filter") | ||
| $filter?: string; | ||
|
|
||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| } | ||
| >; | ||
|
|
||
| /** | ||
| * Create or update a management group. | ||
| * If a management group is already created and a subsequent create request is issued with different properties, the management group properties will be updated. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility" | ||
| #suppress "@azure-tools/typespec-azure-core/response-schema-problem" "For backward compatibility" | ||
| @Azure.Core.useFinalStateVia("azure-async-operation") | ||
| createOrUpdate is Azure.ResourceManager.Legacy.Extension.CreateOrReplaceAsync< | ||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| Request = CreateManagementGroupRequest, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| }, | ||
| Response = ArmResourceUpdatedResponse<ManagementGroup> | (ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders<FinalResult = ManagementGroup>> & { | ||
| @bodyRoot | ||
| _: AzureAsyncOperationResults; | ||
| }) | ||
| >; | ||
|
|
||
| /** | ||
| * Update a management group. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/response-schema-problem" "For backward compatibility" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "For backward compatibility" | ||
| @patch(#{ implicitOptionality: false }) | ||
| update is Extension.CustomPatchSync< | ||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| PatchModel = PatchManagementGroupRequest, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| } | ||
| >; | ||
|
|
||
| /** | ||
| * Delete management group. | ||
| * If a management group contains child resources, the request will fail. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" | ||
| @Azure.Core.useFinalStateVia("azure-async-operation") | ||
| delete is Extension.DeleteWithoutOkAsync< | ||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| }, | ||
| Response = (ArmDeleteAcceptedLroResponse<ArmCombinedLroHeaders & | ||
| Azure.Core.Foundations.RetryAfterHeader> & { | ||
| @bodyRoot | ||
| _: AzureAsyncOperationResults; | ||
| }) | ArmDeletedNoContentResponse | ||
| >; | ||
|
|
||
| /** | ||
| * List all entities that descend from a management group. | ||
| * | ||
| */ | ||
| @list | ||
| @get | ||
| @action("descendants") | ||
| getDescendants is Extension.ActionSync< | ||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| void, | ||
| ArmResponse<DescendantListResult>, | ||
| Parameters = { | ||
| /** | ||
| * Page continuation token 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 token parameter that specifies a starting point to use for subsequent calls. | ||
| * | ||
| */ | ||
| @query("$skiptoken") | ||
| $skiptoken?: string; | ||
|
|
||
| /** | ||
| * Number of elements to return when retrieving results. Passing this in will override $skipToken. | ||
| */ | ||
| @query("$top") | ||
| $top?: int32; | ||
| } | ||
| >; | ||
|
|
||
| /** | ||
| * Gets all the hierarchy settings defined at the Management Group level. Settings can only be set on the root Management Group of the hierarchy. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @get | ||
| @action("settings") | ||
| list is Extension.ActionSync< | ||
JiaqiZhang-Dev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Extension.Tenant, | ||
| ManagementGroup, | ||
| void, | ||
| ArmResponse<HierarchySettingsList> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(ManagementGroup.name, "Management Group ID."); | ||
| @@doc(ManagementGroup.properties, | ||
| "The generic properties of a management group." | ||
| ); | ||
| @@doc(ManagementGroups.createOrUpdate::parameters.resource, | ||
| "Management group creation parameters." | ||
| ); | ||
| @@doc(ManagementGroups.update::parameters.properties, | ||
| "Management group patch parameters." | ||
| ); | ||
109 changes: 109 additions & 0 deletions
109
...ication/managementgroups/ManagementGroups.Management/SubscriptionUnderManagementGroup.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,109 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./ManagementGroup.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
|
|
||
| namespace Microsoft.Management; | ||
| /** | ||
| * The details of subscription under management group. | ||
| */ | ||
| @parentResource(ManagementGroup) | ||
| model SubscriptionUnderManagementGroup | ||
| is Azure.ResourceManager.ProxyResource<SubscriptionUnderManagementGroupProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = SubscriptionUnderManagementGroup, | ||
| KeyName = "subscriptionId", | ||
| SegmentName = "subscriptions", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface SubscriptionUnderManagementGroups { | ||
| /** | ||
| * Retrieves details about given subscription which is associated with the management group. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| getSubscription is Extension.Read< | ||
XiaofeiCao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Extension.Tenant, | ||
| SubscriptionUnderManagementGroup, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| } | ||
| >; | ||
|
|
||
| /** | ||
| * Associates existing subscription with the management group. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" | ||
| create is Azure.ResourceManager.Legacy.Extension.CreateOrReplaceSync< | ||
| Extension.Tenant, | ||
| SubscriptionUnderManagementGroup, | ||
| Request = void, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| }, | ||
| Response = ArmResourceUpdatedResponse<SubscriptionUnderManagementGroup> | ||
| >; | ||
|
|
||
| /** | ||
| * De-associates subscription from the management group. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| delete is Extension.DeleteSync< | ||
| Extension.Tenant, | ||
| SubscriptionUnderManagementGroup, | ||
| Parameters = { | ||
| /** | ||
| * Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/casing-style" "For backward compatibility" | ||
| @header("Cache-Control") | ||
| `Cache-Control`?: string = "no-cache"; | ||
| } | ||
| >; | ||
|
|
||
| /** | ||
| * Retrieves details about all subscriptions which are associated with the management group. | ||
| * | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| getSubscriptionsUnderManagementGroup is Extension.ListByTarget< | ||
| Extension.Tenant, | ||
| SubscriptionUnderManagementGroup, | ||
| Parameters = { | ||
| /** | ||
| * Page continuation token 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 token parameter that specifies a starting point to use for subsequent calls. | ||
| * | ||
| */ | ||
| @query("$skiptoken") | ||
| $skiptoken?: string; | ||
| }, | ||
| Response = ArmResponse<ListSubscriptionUnderManagementGroup> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(SubscriptionUnderManagementGroup.name, "Subscription ID."); | ||
| @@doc(SubscriptionUnderManagementGroup.properties, | ||
| "The generic properties of subscription under a management group." | ||
| ); | ||
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.