-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Labels
design:neededA design request has been raised that needs a proposalA design request has been raised that needs a proposallib:azure-resource-managerIssues for @azure-tools/typespec-azure-core libraryIssues for @azure-tools/typespec-azure-core library
Milestone
Description
We want to define a resource whose id looks like this:
/providers/Microsoft.Management/serviceGroups/{servicegroupName}/providers/Microsoft.Edge/sites/{siteName}
and in this situation we have to use the legacy operations.
I noticed that we could define an external resource in this way:
alias ServiceGroup = Extension.ExternalResource<
Extension.Tenant,
"Microsoft.Management",
"serviceGroups",
"serviceGroupName",
NamePattern = "^[a-zA-Z0-9\\-_().]{1,90}$",
Description = "The name of the service group"
>;
and then I could use ResourceInstanceParameter<ServiceGroup>
to get its parameters so that I do not need to define them one by one, and everything looks very organized, like this:
alias SiteByServiceGroupOps = Azure.ResourceManager.Legacy.ExtensionOperations<
ResourceInstanceParameters<ServiceGroup>,
Extension.ExtensionProviderNamespace<Site>,
{
...Extension.ExtensionProviderNamespace<Site>;
...KeysOf<Site>;
}
>;
@armResourceOperations(#{ omitTags: true })
interface SitesByServiceGroup {
@doc("list Site at SG scope")
@list
listByServiceGroup is SiteByServiceGroupOps.List<Site>;
@doc("Get Site at SG scope")
get is SiteByServiceGroupOps.Read<Site>;
@doc("create or update Site at SG scope")
createOrUpdate is SiteByServiceGroupOps.CreateOrUpdateAsync<Site>;
@doc("update Site at SG scope")
@patch(#{ implicitOptionality: true })
update is SiteByServiceGroupOps.CustomPatchSync<Site, SiteUpdate>;
@doc("delete Site at SG scope")
delete is SiteByServiceGroupOps.DeleteSync<Site>;
}
But this external resource could only be defined as a resource group
resource. In this case, the service group resource is actually a tenant resource.
How could I do it? Shall we consider adding a Scope
argument in this ExternalResource template?
Metadata
Metadata
Assignees
Labels
design:neededA design request has been raised that needs a proposalA design request has been raised that needs a proposallib:azure-resource-managerIssues for @azure-tools/typespec-azure-core libraryIssues for @azure-tools/typespec-azure-core library