Skip to content

Commit ad24d5f

Browse files
msyycv-jiaodiweidongxu-microsoftPan Shaomelina5656
authored
[Support] tsp migration (#35579)
* update default tag * init tsp * init swagger * add suppression for warning * fix body name * fix breaking * Fix for nextlink * fix for return type name of list operations * fix body name * fix for azure-async-operation * fix for azure-async-operation * fix for azure-async-operation * fix for azure-async-operation * temp files * add @clientLocation and remove @operationid * use @clientLocation to replace @operationid * format * format * format * fix Swagger ModelValidation error INVALID_FORMAT * make value optional to keep compatibility with swagger * add tspconfig.yaml * customize for no body common op * customize for no body common op * format * fix cspell * fix ci * fix ci * fix ci * resolve breaking * update for empty union * fix missing final result for lro * update for @pageItems * fix for pattern * service-name * remove legacy operation * Add emit-lro-options: "all" * remove csharp config --------- Co-authored-by: Jiao Di (MSFT) <[email protected]> Co-authored-by: Weidong Xu <[email protected]> Co-authored-by: Pan Shao <[email protected]> Co-authored-by: melina5656 <[email protected]>
1 parent be56046 commit ad24d5f

File tree

172 files changed

+11265
-3853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+11265
-3853
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
import "./SupportTicketDetails.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.Core;
10+
using Azure.ResourceManager;
11+
using TypeSpec.Http;
12+
using TypeSpec.OpenAPI;
13+
14+
namespace Microsoft.Support;
15+
/**
16+
* Object that represents a Chat Transcript resource.
17+
*/
18+
@parentResource(SupportTicketDetails)
19+
model ChatTranscriptDetails
20+
is Azure.ResourceManager.ProxyResource<ChatTranscriptDetailsProperties> {
21+
...ResourceNameParameter<
22+
Resource = ChatTranscriptDetails,
23+
KeyName = "chatTranscriptName",
24+
SegmentName = "chatTranscripts",
25+
NamePattern = ""
26+
>;
27+
}
28+
29+
/**
30+
* [Placeholder] Description for page model
31+
*/
32+
model ChatTranscriptsListResult {
33+
/**
34+
* [Placeholder] Description for nextLink property
35+
*/
36+
@nextLink
37+
nextLink?: string;
38+
39+
/**
40+
* [Placeholder] Description for value property
41+
*/
42+
@pageItems
43+
value?: ChatTranscriptDetails[];
44+
}
45+
46+
@armResourceOperations
47+
interface ChatTranscriptOps
48+
extends Azure.ResourceManager.Legacy.LegacyOperations<
49+
{
50+
...ApiVersionParameter,
51+
...SubscriptionIdParameter,
52+
...Azure.ResourceManager.Legacy.Provider,
53+
...KeysOf<ResourceNameParameter<
54+
Resource = SupportTicketDetails,
55+
KeyName = "supportTicketName",
56+
SegmentName = "supportTickets",
57+
NamePattern = ""
58+
>>,
59+
},
60+
KeysOf<ResourceNameParameter<
61+
Resource = ChatTranscriptDetails,
62+
KeyName = "chatTranscriptName",
63+
SegmentName = "chatTranscripts",
64+
NamePattern = ""
65+
>>
66+
> {}
67+
68+
@armResourceOperations
69+
interface ChatTranscripts {
70+
/**
71+
* Returns chatTranscript details for a support ticket under a subscription.
72+
*/
73+
get is ChatTranscriptOps.Read<ChatTranscriptDetails>;
74+
75+
/**
76+
* Lists all chat transcripts for a support ticket under subscription
77+
*/
78+
list is ChatTranscriptOps.List<
79+
ChatTranscriptDetails,
80+
Response = ChatTranscriptsListResult
81+
>;
82+
}
83+
@armResourceOperations
84+
interface ChatTranscriptsNoSubscriptionOps
85+
extends Azure.ResourceManager.Legacy.LegacyOperations<
86+
{
87+
...ApiVersionParameter,
88+
...Azure.ResourceManager.Legacy.Provider,
89+
...KeysOf<ResourceNameParameter<
90+
Resource = SupportTicketDetails,
91+
KeyName = "supportTicketName",
92+
SegmentName = "supportTickets",
93+
NamePattern = ""
94+
>>,
95+
},
96+
KeysOf<ResourceNameParameter<
97+
Resource = ChatTranscriptDetails,
98+
KeyName = "chatTranscriptName",
99+
SegmentName = "chatTranscripts",
100+
NamePattern = ""
101+
>>
102+
> {}
103+
104+
@armResourceOperations
105+
interface ChatTranscriptsNoSubscription {
106+
/**
107+
* Returns chatTranscript details for a no subscription support ticket.
108+
*/
109+
get is ChatTranscriptsNoSubscriptionOps.Read<ChatTranscriptDetails>;
110+
111+
/**
112+
* Lists all chat transcripts for a support ticket
113+
*/
114+
list is ChatTranscriptsNoSubscriptionOps.List<
115+
ChatTranscriptDetails,
116+
Response = ChatTranscriptsListResult
117+
>;
118+
}
119+
120+
@@doc(ChatTranscriptDetails.name, "ChatTranscript name.");
121+
@@doc(ChatTranscriptDetails.properties, "Properties of the resource.");
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+
import "./SupportTicketDetails.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.Core;
10+
using Azure.ResourceManager;
11+
using TypeSpec.Http;
12+
using TypeSpec.OpenAPI;
13+
14+
namespace Microsoft.Support;
15+
/**
16+
* Object that represents a Communication resource.
17+
*/
18+
@parentResource(SupportTicketDetails)
19+
model CommunicationDetails
20+
is Azure.ResourceManager.ProxyResource<
21+
CommunicationDetailsProperties,
22+
false
23+
> {
24+
...ResourceNameParameter<
25+
Resource = CommunicationDetails,
26+
KeyName = "communicationName",
27+
SegmentName = "communications",
28+
NamePattern = ""
29+
>;
30+
}
31+
32+
/**
33+
* [Placeholder] Description for page model
34+
*/
35+
model CommunicationsListResult {
36+
/**
37+
* [Placeholder] Description for nextLink property
38+
*/
39+
@nextLink
40+
nextLink?: string;
41+
42+
/**
43+
* [Placeholder] Description for value property
44+
*/
45+
@pageItems
46+
value?: CommunicationDetails[];
47+
}
48+
49+
@armResourceOperations
50+
interface CommunicationOps
51+
extends Azure.ResourceManager.Legacy.LegacyOperations<
52+
{
53+
...ApiVersionParameter,
54+
...SubscriptionIdParameter,
55+
...Azure.ResourceManager.Legacy.Provider,
56+
...KeysOf<ResourceNameParameter<
57+
Resource = SupportTicketDetails,
58+
KeyName = "supportTicketName",
59+
SegmentName = "supportTickets",
60+
NamePattern = ""
61+
>>,
62+
},
63+
KeysOf<ResourceNameParameter<
64+
Resource = CommunicationDetails,
65+
KeyName = "communicationName",
66+
SegmentName = "communications",
67+
NamePattern = ""
68+
>>
69+
> {}
70+
71+
@armResourceOperations
72+
interface Communications {
73+
/**
74+
* Returns communication details for a support ticket.
75+
*/
76+
get is CommunicationOps.Read<CommunicationDetails>;
77+
78+
/**
79+
* Adds a new customer communication to an Azure support ticket.
80+
*/
81+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
82+
#suppress "@azure-tools/typespec-azure-core/invalid-final-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
83+
@Azure.Core.useFinalStateVia("azure-async-operation")
84+
create is CommunicationOps.CreateOrUpdateAsync<
85+
CommunicationDetails,
86+
Response = ArmResourceUpdatedResponse<CommunicationDetails> | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = CommunicationDetails> &
87+
Azure.Core.Foundations.RetryAfterHeader>
88+
>;
89+
90+
/**
91+
* Lists all communications (attachments not included) for a support ticket. <br/></br> You can also filter support ticket communications by _CreatedDate_ or _CommunicationType_ using the $filter parameter. The only type of communication supported today is _Web_. Output will be a paged result with _nextLink_, using which you can retrieve the next set of Communication results. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error.
92+
*/
93+
list is CommunicationOps.List<
94+
CommunicationDetails,
95+
Parameters = {
96+
/**
97+
* The number of values to return in the collection. Default is 10 and max is 10.
98+
*/
99+
@query("$top")
100+
$top?: int32;
101+
102+
/**
103+
* The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the CommunicationType and CreatedDate filters by Logical And ('and') operator.
104+
*/
105+
@query("$filter")
106+
$filter?: string;
107+
},
108+
Response = CommunicationsListResult
109+
>;
110+
}
111+
@armResourceOperations
112+
interface CommunicationsNoSubscriptionOps
113+
extends Azure.ResourceManager.Legacy.LegacyOperations<
114+
{
115+
...ApiVersionParameter,
116+
...Azure.ResourceManager.Legacy.Provider,
117+
...KeysOf<ResourceNameParameter<
118+
Resource = SupportTicketDetails,
119+
KeyName = "supportTicketName",
120+
SegmentName = "supportTickets",
121+
NamePattern = ""
122+
>>,
123+
},
124+
KeysOf<ResourceNameParameter<
125+
Resource = CommunicationDetails,
126+
KeyName = "communicationName",
127+
SegmentName = "communications",
128+
NamePattern = ""
129+
>>
130+
> {}
131+
132+
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "For backward compatibility"
133+
@armResourceOperations
134+
interface CommunicationsNoSubscription {
135+
/**
136+
* Returns communication details for a support ticket.
137+
*/
138+
get is CommunicationsNoSubscriptionOps.Read<CommunicationDetails>;
139+
140+
/**
141+
* Adds a new customer communication to an Azure support ticket.
142+
*/
143+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
144+
#suppress "@azure-tools/typespec-azure-core/invalid-final-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
145+
@Azure.Core.useFinalStateVia("azure-async-operation")
146+
create is CommunicationsNoSubscriptionOps.CreateOrUpdateAsync<
147+
CommunicationDetails,
148+
Response = ArmResourceUpdatedResponse<CommunicationDetails> | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = CommunicationDetails> &
149+
Azure.Core.Foundations.RetryAfterHeader>
150+
>;
151+
152+
/**
153+
* Lists all communications (attachments not included) for a support ticket. <br/></br> You can also filter support ticket communications by _CreatedDate_ or _CommunicationType_ using the $filter parameter. The only type of communication supported today is _Web_. Output will be a paged result with _nextLink_, using which you can retrieve the next set of Communication results. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error.
154+
*/
155+
list is CommunicationsNoSubscriptionOps.List<
156+
CommunicationDetails,
157+
Parameters = {
158+
/**
159+
* The number of values to return in the collection. Default is 10 and max is 10.
160+
*/
161+
@query("$top")
162+
$top?: int32;
163+
164+
/**
165+
* The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the CommunicationType and CreatedDate filters by Logical And ('and') operator.
166+
*/
167+
@query("$filter")
168+
$filter?: string;
169+
},
170+
Response = CommunicationsListResult
171+
>;
172+
}
173+
174+
@@doc(CommunicationDetails.name, "Communication name.");
175+
@@doc(CommunicationDetails.properties, "Properties of the resource.");
176+
@@doc(Communications.create::parameters.resource, "Communication object.");
177+
@@doc(CommunicationsNoSubscription.create::parameters.resource,
178+
"Communication object."
179+
);

0 commit comments

Comments
 (0)