Skip to content
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
dc4f237
convert
v-hongli1 Sep 11, 2025
72c96f1
compile
v-hongli1 Sep 11, 2025
f2794bc
fix diff
v-hongli1 Sep 11, 2025
ec27915
remove operationId
v-hongli1 Sep 11, 2025
ffa4f81
prettier
v-hongli1 Sep 11, 2025
dd6f0fd
fix swagger model validation
v-hongli1 Sep 11, 2025
ceb9907
fix tspconfig
v-hongli1 Sep 11, 2025
2e08069
fix model validation
v-hongli1 Sep 12, 2025
4e9042c
fix tspconfig
v-hongli1 Sep 12, 2025
dabf693
fix tspconfig for java
v-hongli1 Sep 12, 2025
2106ef4
fix @@flattenProperty
v-hongli1 Sep 12, 2025
8bcd5e6
Merge branch 'main' into convert-trafficmanager-20250911
v-hongli1 Sep 12, 2025
5847f42
fix warming
v-hongli1 Sep 12, 2025
9b4f8ef
format
mcgallan Sep 12, 2025
7c5613a
update tspconfig
mcgallan Sep 12, 2025
fcff2eb
fix tspconfig for java
v-hongli1 Sep 15, 2025
d1ea925
rollback typespec-go
v-hongli1 Sep 15, 2025
eb1d626
fix comments
v-hongli1 Sep 24, 2025
65ad756
fix comments
v-hongli1 Sep 24, 2025
4952e26
fix comments
v-hongli1 Sep 24, 2025
5ddcd24
Merge branch 'main' into convert-trafficmanager-20250911
v-hongli1 Sep 24, 2025
d3c0f2e
Try add ResourceNameParameter
v-hongli1 Sep 24, 2025
c8d02e6
Try add ResourceNameParameter
v-hongli1 Sep 24, 2025
3fb0f7e
remove ResourceNameParameter
v-hongli1 Sep 25, 2025
ca39f26
Change model resource
v-hongli1 Sep 25, 2025
08d6738
fix OBJECT_MISSING_REQUIRED_PROPERTY
v-hongli1 Sep 25, 2025
9b5f229
tsp format
v-hongli1 Sep 25, 2025
44b86ed
Change model extends resource
v-hongli1 Sep 26, 2025
810902f
Change model extends resource
v-hongli1 Sep 26, 2025
2aa83c0
Change model extends resource
v-hongli1 Sep 26, 2025
8ff33fc
Change model extends resource
v-hongli1 Sep 26, 2025
d62d31d
Change model extends resource
v-hongli1 Sep 26, 2025
e2f5ed3
Change model extends resource
v-hongli1 Sep 28, 2025
95ea933
Change model extends resource
v-hongli1 Sep 28, 2025
48d5ac9
fix tspconfig
v-hongli1 Sep 28, 2025
2ac729e
remove useless suppress
v-hongli1 Sep 28, 2025
a86febc
Merge branch 'main' into convert-trafficmanager-20250911
v-hongli1 Sep 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions specification/trafficmanager/TrafficManager.Management/Endpoint.tsp
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 {
Copy link
Member

Choose a reason for hiding this comment

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

Where is the name?

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)
Copy link
Member

Choose a reason for hiding this comment

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

You should use legacy templates.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed by 3fb0f7e

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."
);
98 changes: 98 additions & 0 deletions specification/trafficmanager/TrafficManager.Management/Profile.tsp
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"
Copy link
Member

Choose a reason for hiding this comment

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

Remove useless suppressions

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed by 3fb0f7e

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."
);
Loading
Loading