Skip to content
78 changes: 31 additions & 47 deletions specification/edge/Microsoft.Edge.Sites.Management/Site.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import "./models.tsp";
import "@typespec/versioning";
import "./main.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.Versioning;

namespace Microsoft.Edge;
Expand All @@ -30,74 +28,60 @@ alias SiteOps = Azure.ResourceManager.Legacy.LegacyOperations<

@armResourceOperations
interface Sites {
get is SiteOps.Read<Site>;
createOrUpdate is SiteOps.CreateOrUpdateAsync<Site>;
update is SiteOps.CustomPatchSync<Site, SiteUpdate>;
delete is SiteOps.DeleteSync<Site>;
listByResourceGroup is SiteOps.List<Site>;
get is Extension.Read<Extension.ResourceGroup, Site>;
createOrUpdate is Extension.CreateOrUpdateAsync<
Extension.ResourceGroup,
Site
>;
update is Extension.CustomPatchSync<
Extension.ResourceGroup,
Site,
SiteUpdate
>;
delete is Extension.DeleteSync<Extension.ResourceGroup, Site>;
/** List a Site */
listByResourceGroup is Extension.ListByTarget<Extension.ResourceGroup, Site>;
}

alias SiteBySubscriptionOps = Azure.ResourceManager.Legacy.LegacyOperations<
ResourceInstanceParameters<Extension.Subscription>,
KeysOf<Site>
>;

@armResourceOperations(#{ omitTags: true })
interface SitesBySubscription {
/** List Site resources by subscription ID */
list is SiteBySubscriptionOps.List<Site>;
get is SiteBySubscriptionOps.Read<Site>;
createOrUpdate is SiteBySubscriptionOps.CreateOrUpdateAsync<Site>;
update is SiteBySubscriptionOps.CustomPatchSync<Site, SiteUpdate>;
delete is SiteBySubscriptionOps.DeleteSync<Site>;
list is Extension.ListByTarget<Extension.Subscription, Site>;
get is Extension.Read<Extension.Subscription, Site>;
createOrUpdate is Extension.CreateOrUpdateAsync<Extension.Subscription, Site>;
update is Extension.CustomPatchSync<Extension.Subscription, Site, SiteUpdate>;
delete is Extension.DeleteSync<Extension.Subscription, Site>;
}

alias SiteByServiceGroupOps = Azure.ResourceManager.Legacy.ExtensionOperations<
{
...ApiVersionParameter;

/** the provider namespace */
@path
@segment("providers")
@key
providerNamespace: "Microsoft.Management";

/**
* The name of the service group
*/
@segment("serviceGroups")
@pattern("^[a-zA-Z0-9\\-_().]{1,90}$")
@key
@path
servicegroupName: string;
},
Extension.ExtensionProviderNamespace<Site>,
{
...Extension.ExtensionProviderNamespace<Site>;
...KeysOf<Site>;
}
>;
/** A service group */
@tenantResource
model ServiceGroup
is Extension.ExternalResource<
"Microsoft.Management",
"serviceGroups",
"servicegroupName"
>;

@armResourceOperations(#{ omitTags: true })
interface SitesByServiceGroup {
@doc("list Site at SG scope")
@added(Versions.v2025_03_01_preview)
@list
listByServiceGroup is SiteByServiceGroupOps.List<Site>;
listByServiceGroup is Extension.ListByTarget<ServiceGroup, Site>;

@doc("Get Site at SG scope")
@added(Versions.v2025_03_01_preview)
get is SiteByServiceGroupOps.Read<Site>;
get is Extension.Read<ServiceGroup, Site>;

@doc("create or update Site at SG scope")
@added(Versions.v2025_03_01_preview)
createOrUpdate is SiteByServiceGroupOps.CreateOrUpdateAsync<Site>;
createOrUpdate is Extension.CreateOrUpdateAsync<ServiceGroup, Site>;

@doc("update Site at SG scope")
@added(Versions.v2025_03_01_preview)
update is SiteByServiceGroupOps.CustomPatchSync<Site, SiteUpdate>;
update is Extension.CustomPatchSync<ServiceGroup, Site, SiteUpdate>;

@doc("delete Site at SG scope")
@added(Versions.v2025_03_01_preview)
delete is SiteByServiceGroupOps.DeleteSync<Site>;
delete is Extension.DeleteSync<ServiceGroup, Site>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -467,7 +467,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -597,6 +597,10 @@
},
"readOnly": true
},
"ServiceGroup": {
"type": "object",
"description": "A service group"
},
Comment on lines +600 to +603
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once we get the hot fix version for azure-tools/typespec-azure-resource-manager, we will update the typespec to remove this model.

"Site": {
"type": "object",
"description": "Site as ARM Resource",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
}
],
"responses": {
Expand Down Expand Up @@ -96,10 +95,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -140,10 +138,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -214,10 +211,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand All @@ -230,7 +226,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -267,10 +263,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -468,7 +463,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -725,7 +720,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -855,6 +850,10 @@
},
"readOnly": true
},
"ServiceGroup": {
"type": "object",
"description": "A service group"
},
"Site": {
"type": "object",
"description": "Site as ARM Resource",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
}
],
"responses": {
Expand Down Expand Up @@ -96,10 +95,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -140,10 +138,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -214,10 +211,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand All @@ -230,7 +226,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -267,10 +263,9 @@
{
"name": "servicegroupName",
"in": "path",
"description": "The name of the service group",
"description": "The name of the resource",
"required": true,
"type": "string",
"pattern": "^[a-zA-Z0-9\\-_().]{1,90}$"
"type": "string"
},
{
"name": "siteName",
Expand Down Expand Up @@ -468,7 +463,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -725,7 +720,7 @@
{
"name": "properties",
"in": "body",
"description": "Resource create parameters.",
"description": "The resource properties to be updated.",
"required": true,
"schema": {
"$ref": "#/definitions/SiteUpdate"
Expand Down Expand Up @@ -855,6 +850,10 @@
},
"readOnly": true
},
"ServiceGroup": {
"type": "object",
"description": "A service group"
},
"Site": {
"type": "object",
"description": "Site as ARM Resource",
Expand Down
Loading