Skip to content

Commit e6c8c3d

Browse files
authored
tsp conversion (#44451)
1 parent b781b94 commit e6c8c3d

75 files changed

Lines changed: 6859 additions & 2074 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
using TypeSpec.OpenAPI;
11+
12+
namespace Microsoft.Solutions;
13+
/**
14+
* Information about managed application.
15+
*/
16+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
17+
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
18+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
19+
@Http.Private.includeInapplicableMetadataInPayload(false)
20+
model Application extends GenericResource {
21+
@visibility(Lifecycle.Read)
22+
@path
23+
@key("applicationName")
24+
@minLength(3)
25+
@maxLength(64)
26+
@segment("applications")
27+
name: string;
28+
29+
/**
30+
* The managed application properties.
31+
*/
32+
properties: ApplicationProperties;
33+
34+
/**
35+
* The plan information.
36+
*/
37+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
38+
plan?: Plan;
39+
40+
/**
41+
* The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog.
42+
*/
43+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
44+
@pattern("^[-\\w\\._,\\(\\)]+$")
45+
kind: string;
46+
47+
/**
48+
* The identity of the resource.
49+
*/
50+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
51+
identity?: Identity;
52+
}
53+
54+
@armResourceOperations
55+
interface Applications {
56+
/**
57+
* Gets the managed application.
58+
*/
59+
get is ArmResourceRead<
60+
Application,
61+
Response = ArmResponse<Application> | NotFoundResponse
62+
>;
63+
64+
/**
65+
* Creates or updates a managed application.
66+
*/
67+
createOrUpdate is ArmResourceCreateOrReplaceAsync<Application>;
68+
69+
/**
70+
* Updates an existing managed application.
71+
*/
72+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
73+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
74+
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
75+
@patch(#{ implicitOptionality: false })
76+
update is Azure.ResourceManager.Legacy.CustomPatchAsync<
77+
Application,
78+
PatchModel = ApplicationPatchable,
79+
Response =
80+
| ArmResponse<Application>
81+
| (ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = Application> &
82+
Azure.Core.Foundations.RetryAfterHeader> & {
83+
@bodyRoot
84+
_: Application;
85+
}),
86+
OptionalRequestBody = true
87+
>;
88+
89+
/**
90+
* Deletes the managed application.
91+
*/
92+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
93+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
94+
delete is ArmResourceDeleteWithoutOkAsync<
95+
Application,
96+
Response =
97+
| ArmDeletedResponse
98+
| ArmDeleteAcceptedLroResponse<ArmAsyncOperationHeader &
99+
Azure.Core.Foundations.RetryAfterHeader>
100+
| ArmDeletedNoContentResponse
101+
>;
102+
103+
/**
104+
* Lists all the applications within a resource group.
105+
*/
106+
listByResourceGroup is ArmResourceListByParent<Application>;
107+
108+
/**
109+
* Lists all the applications within a subscription.
110+
*/
111+
listBySubscription is ArmListBySubscription<Application>;
112+
113+
/**
114+
* Refresh Permissions for application.
115+
*/
116+
refreshPermissions is ArmResourceActionAsyncBase<
117+
Application,
118+
void,
119+
OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader>,
120+
Azure.ResourceManager.Foundations.BaseParameters<Application>
121+
>;
122+
123+
/**
124+
* List allowed upgrade plans for application.
125+
*/
126+
listAllowedUpgradePlans is ArmResourceActionSync<
127+
Application,
128+
void,
129+
ArmResponse<AllowedUpgradePlansResult>
130+
>;
131+
132+
/**
133+
* Update access for application.
134+
*/
135+
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
136+
updateAccess is ArmResourceActionAsyncBase<
137+
Application,
138+
UpdateAccessDefinition,
139+
140+
| OkResponse
141+
| (ArmAcceptedLroResponse<
142+
"Resource operation accepted.",
143+
ArmLroLocationHeader<FinalResult = UpdateAccessDefinition> &
144+
Azure.Core.Foundations.RetryAfterHeader
145+
> &
146+
Body<UpdateAccessDefinition>),
147+
BaseParameters = Azure.ResourceManager.Foundations.BaseParameters<Application>
148+
>;
149+
150+
/**
151+
* List tokens for application.
152+
*/
153+
listTokens is ArmResourceActionSync<
154+
Application,
155+
ListTokenRequest,
156+
ArmResponse<ManagedIdentityTokenResult>
157+
>;
158+
}
159+
160+
@@maxLength(Application.name, 64);
161+
@@minLength(Application.name, 3);
162+
@@doc(Application.name, "The name of the managed application.");
163+
@@doc(Application.properties, "The managed application properties.");
164+
@@doc(
165+
Applications.createOrUpdate::parameters.resource,
166+
"Parameters supplied to the create or update a managed application."
167+
);
168+
@@doc(
169+
Applications.update::parameters.properties,
170+
"Parameters supplied to update an existing managed application."
171+
);
172+
@@doc(
173+
Applications.updateAccess::parameters.body,
174+
"Request body parameters to update access."
175+
);
176+
@@doc(
177+
Applications.listTokens::parameters.body,
178+
"Request body parameters to list tokens."
179+
);
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
using TypeSpec.OpenAPI;
11+
12+
namespace Microsoft.Solutions;
13+
/**
14+
* Information about managed application definition.
15+
*/
16+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
17+
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
18+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
19+
@Http.Private.includeInapplicableMetadataInPayload(false)
20+
model ApplicationDefinition extends GenericResource {
21+
@visibility(Lifecycle.Read)
22+
@path
23+
@key("applicationDefinitionName")
24+
@minLength(2)
25+
@maxLength(10)
26+
@segment("applicationDefinitions")
27+
name: string;
28+
29+
/**
30+
* The managed application definition properties that can be updated.
31+
*/
32+
properties: ApplicationDefinitionProperties;
33+
}
34+
35+
alias ApplicationDefinitionOps = Azure.ResourceManager.Legacy.RoutedOperations<
36+
{
37+
...ApiVersionParameter;
38+
...SubscriptionIdParameter;
39+
...ResourceGroupParameter;
40+
},
41+
{
42+
/** The name of the managed application definition. */
43+
@path
44+
@key
45+
@minLength(3)
46+
@maxLength(64)
47+
@segment("applicationDefinitions")
48+
applicationDefinitionName: string;
49+
},
50+
ResourceRoute = #{ useStaticRoute: true }
51+
>;
52+
53+
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}")
54+
@armResourceOperations(#{ allowStaticRoutes: true })
55+
interface ApplicationDefinitions {
56+
/**
57+
* Gets the managed application definition.
58+
*/
59+
@sharedRoute
60+
get is ApplicationDefinitionOps.Read<
61+
ApplicationDefinition,
62+
Response = ArmResponse<ApplicationDefinition> | NotFoundResponse
63+
>;
64+
65+
/**
66+
* Creates or updates a managed application definition.
67+
*/
68+
@sharedRoute
69+
createOrUpdate is ApplicationDefinitionOps.CreateOrUpdateSync<ApplicationDefinition>;
70+
71+
/**
72+
* Updates the managed application definition.
73+
*/
74+
@sharedRoute
75+
@patch(#{ implicitOptionality: false })
76+
update is ApplicationDefinitionOps.CustomPatchSync<
77+
ApplicationDefinition,
78+
PatchModel = ApplicationDefinitionPatchable
79+
>;
80+
81+
/**
82+
* Deletes the managed application definition.
83+
*/
84+
@sharedRoute
85+
delete is ApplicationDefinitionOps.DeleteSync<ApplicationDefinition>;
86+
}
87+
88+
@tag("ApplicationDefinitions")
89+
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}?disambiguation_dummy")
90+
@armResourceOperations(#{ allowStaticRoutes: true, omitTags: true })
91+
interface ApplicationDefinitionOpsById {
92+
/**
93+
* Gets the managed application definition.
94+
*/
95+
@sharedRoute
96+
getById is ApplicationDefinitionOps.Read<
97+
ApplicationDefinition,
98+
Response = ArmResponse<ApplicationDefinition> | NotFoundResponse
99+
>;
100+
101+
/**
102+
* Creates or updates a managed application definition.
103+
*/
104+
@sharedRoute
105+
createOrUpdateById is ApplicationDefinitionOps.CreateOrUpdateSync<ApplicationDefinition>;
106+
107+
/**
108+
* Updates the managed application definition.
109+
*/
110+
@sharedRoute
111+
@patch(#{ implicitOptionality: false })
112+
updateById is ApplicationDefinitionOps.CustomPatchSync<
113+
ApplicationDefinition,
114+
PatchModel = ApplicationDefinitionPatchable
115+
>;
116+
117+
/**
118+
* Deletes the managed application definition.
119+
*/
120+
@sharedRoute
121+
deleteById is ApplicationDefinitionOps.DeleteSync<ApplicationDefinition>;
122+
}
123+
124+
@armResourceOperations(#{ omitTags: true })
125+
@tag("ApplicationDefinitions")
126+
interface ApplicationDefinitionListOperationGroup {
127+
/**
128+
* Lists the managed application definitions in a resource group.
129+
*/
130+
listByResourceGroup is ArmResourceListByParent<ApplicationDefinition>;
131+
132+
/**
133+
* Lists all the application definitions within a subscription.
134+
*/
135+
listBySubscription is ArmListBySubscription<ApplicationDefinition>;
136+
}
137+
138+
@@maxLength(ApplicationDefinition.name, 64);
139+
@@minLength(ApplicationDefinition.name, 3);
140+
@@doc(
141+
ApplicationDefinition.name,
142+
"The name of the managed application definition."
143+
);
144+
@@doc(
145+
ApplicationDefinition.properties,
146+
"The managed application definition properties."
147+
);
148+
@@doc(
149+
ApplicationDefinitions.createOrUpdate::parameters.resource,
150+
"Parameters supplied to the create or update an managed application definition."
151+
);
152+
@@doc(
153+
ApplicationDefinitions.update::parameters.properties,
154+
"Parameters supplied to the update a managed application definition."
155+
);

0 commit comments

Comments
 (0)