-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Migrate trafficmanager TypeSpec #37328
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
base: main
Are you sure you want to change the base?
Changes from 17 commits
dc4f237
72c96f1
f2794bc
ec27915
ffa4f81
dd6f0fd
ceb9907
2e08069
4e9042c
dabf693
2106ef4
8bcd5e6
5847f42
9b4f8ef
7c5613a
fcff2eb
d1ea925
eb1d626
65ad756
4952e26
5ddcd24
d3c0f2e
c8d02e6
3fb0f7e
ca39f26
08d6738
9b5f229
44b86ed
810902f
2aa83c0
8ff33fc
d62d31d
e2f5ed3
95ea933
48d5ac9
2ac729e
a86febc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Profile.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.Network; | ||
/** | ||
* Class representing a Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility" | ||
@parentResource(Profile) | ||
model Endpoint extends ProxyResource { | ||
properties?: EndpointProperties; | ||
} | ||
|
||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}") | ||
interface Endpoints { | ||
/** | ||
* Gets a Traffic Manager endpoint. | ||
*/ | ||
@get | ||
@armResourceRead(Endpoint) | ||
|
||
get( | ||
...ApiVersionParameter, | ||
...SubscriptionIdParameter, | ||
...ResourceGroupParameter, | ||
|
||
/** | ||
* The name of the Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
profileName?: string, | ||
|
||
/** | ||
* The type of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointType?: EndpointType, | ||
|
||
/** | ||
* The name of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointName?: string, | ||
): ArmResponse<Endpoint> | CloudError; | ||
|
||
/** | ||
* Create or update a Traffic Manager endpoint. | ||
*/ | ||
@put | ||
@armResourceCreateOrUpdate(Endpoint) | ||
createOrUpdate( | ||
...ApiVersionParameter, | ||
...SubscriptionIdParameter, | ||
...ResourceGroupParameter, | ||
|
||
/** | ||
* The name of the Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
profileName?: string, | ||
|
||
/** | ||
* The type of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointType?: EndpointType, | ||
|
||
/** | ||
* The name of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointName?: string, | ||
|
||
/** | ||
* The properties of the Traffic Manager endpoint. | ||
*/ | ||
@bodyRoot | ||
resource: Endpoint, | ||
): ArmResponse<Endpoint> | ArmCreatedResponse<Endpoint> | CloudError; | ||
|
||
/** | ||
* Update a Traffic Manager endpoint. | ||
*/ | ||
@patch(#{ implicitOptionality: false }) | ||
@armResourceUpdate(Endpoint) | ||
update( | ||
...ApiVersionParameter, | ||
...SubscriptionIdParameter, | ||
...ResourceGroupParameter, | ||
|
||
/** | ||
* The name of the Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
profileName?: string, | ||
|
||
/** | ||
* The type of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointType?: EndpointType, | ||
|
||
/** | ||
* The name of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointName?: string, | ||
|
||
/** | ||
* The properties of the Traffic Manager endpoint. | ||
*/ | ||
@bodyRoot | ||
properties: Endpoint, | ||
): ArmResponse<Endpoint> | CloudError; | ||
|
||
/** | ||
* Deletes a Traffic Manager endpoint. | ||
*/ | ||
@delete | ||
@armResourceDelete(Endpoint) | ||
delete( | ||
...ApiVersionParameter, | ||
...SubscriptionIdParameter, | ||
...ResourceGroupParameter, | ||
|
||
/** | ||
* The name of the Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
profileName?: string, | ||
|
||
/** | ||
* The type of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointType?: EndpointType, | ||
|
||
/** | ||
* The name of the Traffic Manager endpoint. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
endpointName?: string, | ||
): ArmResponse<DeleteOperationResult> | ArmDeletedNoContentResponse | CloudError; | ||
} | ||
|
||
@@doc(Endpoint.name, "The name of the Traffic Manager endpoint."); | ||
@@doc(Endpoint.properties, "The properties of the Traffic Manager endpoint."); | ||
@@doc(Endpoints.createOrUpdate::parameters.resource, | ||
"The Traffic Manager endpoint parameters supplied to the CreateOrUpdate operation." | ||
); | ||
@@doc(Endpoints.update::parameters.properties, | ||
"The Traffic Manager endpoint parameters supplied to the Update operation." | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./Profile.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.Network; | ||
/** | ||
* Class representing a Traffic Manager HeatMap. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility" | ||
@parentResource(Profile) | ||
model HeatMapModel extends ProxyResource { | ||
properties?: HeatMapProperties; | ||
} | ||
|
||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}") | ||
interface HeatMapModels { | ||
/** | ||
* Gets latest heatmap for Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
@get | ||
@armResourceRead(HeatMapModel) | ||
get( | ||
...ApiVersionParameter, | ||
...SubscriptionIdParameter, | ||
...ResourceGroupParameter, | ||
|
||
/** | ||
* The name of the Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
profileName?: string, | ||
|
||
/** | ||
* The type of the heatmap. | ||
*/ | ||
#suppress "@azure-tools/typespec-autorest/unsupported-optional-path-param" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@path | ||
heatMapType?: HeatMapType, | ||
|
||
/** | ||
* The top left latitude,longitude pair of the rectangular viewport to query for. | ||
*/ | ||
@query("topLeft") | ||
@minItems(2) | ||
@maxItems(2) | ||
topLeft?: float64[], | ||
|
||
/** | ||
* The bottom right latitude,longitude pair of the rectangular viewport to query for. | ||
*/ | ||
@query("botRight") | ||
@minItems(2) | ||
@maxItems(2) | ||
botRight?: float64[], | ||
): ArmResponse<HeatMapModel> | CloudError; | ||
} | ||
|
||
@@doc(HeatMapModel.name, ""); | ||
@@doc(HeatMapModel.properties, | ||
"The properties of the Traffic Manager HeatMap." | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
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.Network; | ||
/** | ||
* Class representing a Traffic Manager profile. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility" | ||
model Profile extends TrackedResource { | ||
properties?: ProfileProperties; | ||
} | ||
|
||
alias ProfileOps = Azure.ResourceManager.Legacy.LegacyOperations< | ||
{ | ||
...ApiVersionParameter; | ||
...SubscriptionIdParameter; | ||
...ResourceGroupParameter; | ||
...Azure.ResourceManager.Legacy.Provider<Profile>; | ||
}, | ||
KeysOf<ResourceNameParameter< | ||
Resource = Profile, | ||
KeyName = "profileName", | ||
SegmentName = "trafficmanagerprofiles", | ||
NamePattern = "" | ||
>>, | ||
ErrorType = CloudError | ||
>; | ||
|
||
alias ProfileSubscriptionOps = Azure.ResourceManager.Legacy.LegacyOperations< | ||
{ | ||
...ApiVersionParameter; | ||
...SubscriptionIdParameter; | ||
...Azure.ResourceManager.Legacy.Provider<Profile>; | ||
}, | ||
KeysOf<ResourceNameParameter< | ||
Resource = Profile, | ||
KeyName = "profileName", | ||
SegmentName = "trafficmanagerprofiles", | ||
NamePattern = "" | ||
>>, | ||
ErrorType = CloudError | ||
>; | ||
|
||
@armResourceOperations | ||
interface Profiles { | ||
/** | ||
* Gets a Traffic Manager profile. | ||
*/ | ||
get is ProfileOps.Read<Profile>; | ||
|
||
/** | ||
* Create or update a Traffic Manager profile. | ||
*/ | ||
createOrUpdate is ProfileOps.CreateOrUpdateSync<Profile>; | ||
|
||
/** | ||
* Update a Traffic Manager profile. | ||
*/ | ||
@patch(#{ implicitOptionality: false }) | ||
update is ProfileOps.CustomPatchSync<Profile, PatchModel = Profile>; | ||
|
||
/** | ||
* Deletes a Traffic Manager profile. | ||
*/ | ||
delete is ProfileOps.DeleteSync< | ||
Profile, | ||
Response = ArmResponse<DeleteOperationResult> | ArmDeletedNoContentResponse | ||
>; | ||
|
||
/** | ||
* Lists all Traffic Manager profiles within a resource group. | ||
*/ | ||
listByResourceGroup is ProfileOps.List<Profile>; | ||
|
||
/** | ||
* Lists all Traffic Manager profiles within a subscription. | ||
*/ | ||
listBySubscription is ProfileSubscriptionOps.List<Profile>; | ||
} | ||
|
||
@@doc(Profile.name, "The name of the Traffic Manager profile."); | ||
@@doc(Profile.properties, "The properties of the Traffic Manager profile."); | ||
@@doc(Profiles.createOrUpdate::parameters.resource, | ||
"The Traffic Manager profile parameters supplied to the CreateOrUpdate operation." | ||
); | ||
@@doc(Profiles.update::parameters.properties, | ||
"The Traffic Manager profile parameters supplied to the Update operation." | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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.Network; | ||
/** | ||
* Class representing the Geographic hierarchy used with the Geographic traffic routing method. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key" "For backward compatibility" | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility" | ||
@singleton("default") | ||
@tenantResource | ||
model TrafficManagerGeographicHierarchy extends ProxyResource { | ||
properties?: GeographicHierarchyProperties; | ||
} | ||
|
||
@armResourceOperations | ||
interface TrafficManagerGeographicHierarchies { | ||
/** | ||
* Gets the default Geographic Hierarchy used by the Geographic traffic routing method. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
|
||
getDefault is ArmResourceRead< | ||
TrafficManagerGeographicHierarchy, | ||
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters, | ||
Parameters = { | ||
#suppress "@azure-tools/typespec-azure-core/documentation-required" "For backward compatibility" | ||
@path | ||
@segment("trafficManagerGeographicHierarchies") | ||
trafficManagerGeographicHierarchy: "default"; | ||
}, | ||
Error = CloudError | ||
>; | ||
} | ||
|
||
@@doc(TrafficManagerGeographicHierarchy.name, ""); | ||
@@doc(TrafficManagerGeographicHierarchy.properties, | ||
"The properties of the Geographic Hierarchy resource." | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the name?