forked from Azure/azure-rest-api-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating a sample ARM sample project based on standard template (Azur…
…e#30040) * tsp init ARM sample project * Update readme.md & output file name * Adding sample SDK config * Added SDK emitter configs * Removed arm schema from SDK automation config * Update tspconfig.yaml * Update readme.python.md * Update readme.python.md * Update tspconfig.yaml * Remove the optional options for TS emitter * Update tspconfig.yaml * use custom patch * remove swagger to sdk section and config --------- Co-authored-by: Ray Chen <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: kazrael2119 <[email protected]> Co-authored-by: Renhe Li <[email protected]> Co-authored-by: qiaozha <[email protected]> Co-authored-by: Qiaoqiao Zhang <[email protected]>
- Loading branch information
1 parent
ad73e42
commit c4b3316
Showing
19 changed files
with
1,330 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
specification/contosowidgetmanager/Contoso.Management/employee.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/http"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
|
||
using TypeSpec.Rest; | ||
using TypeSpec.Http; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
|
||
namespace Microsoft.Contoso; | ||
|
||
/** Employee resource */ | ||
model Employee is TrackedResource<EmployeeProperties> { | ||
...ResourceNameParameter<Employee>; | ||
} | ||
|
||
/** Employee properties */ | ||
model EmployeeProperties { | ||
/** Age of employee */ | ||
age?: int32; | ||
|
||
/** City of employee */ | ||
city?: string; | ||
|
||
/** Profile of employee */ | ||
@encode("base64url") | ||
profile?: bytes; | ||
|
||
/** The status of the last operation. */ | ||
@visibility("read") | ||
provisioningState?: ProvisioningState; | ||
} | ||
|
||
/** The resource provisioning state. */ | ||
@lroStatus | ||
union ProvisioningState { | ||
ResourceProvisioningState, | ||
|
||
/** The resource is being provisioned */ | ||
Provisioning: "Provisioning", | ||
|
||
/** The resource is updating */ | ||
Updating: "Updating", | ||
|
||
/** The resource is being deleted */ | ||
Deleting: "Deleting", | ||
|
||
/** The resource create request has been accepted */ | ||
Accepted: "Accepted", | ||
|
||
string, | ||
} | ||
|
||
@armResourceOperations | ||
interface Employees { | ||
get is ArmResourceRead<Employee>; | ||
createOrUpdate is ArmResourceCreateOrReplaceAsync<Employee>; | ||
update is ArmCustomPatchSync< | ||
Employee, | ||
Azure.ResourceManager.Foundations.ResourceUpdateModel< | ||
Employee, | ||
EmployeeProperties | ||
> | ||
>; | ||
delete is ArmResourceDeleteWithoutOkAsync<Employee>; | ||
listByResourceGroup is ArmResourceListByParent<Employee>; | ||
listBySubscription is ArmListBySubscription<Employee>; | ||
} |
76 changes: 76 additions & 0 deletions
76
...idgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"title": "Employees_CreateOrUpdate", | ||
"operationId": "Employees_CreateOrUpdate", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", | ||
"resourceGroupName": "rgopenapi", | ||
"employeeName": "9KF-f-8b", | ||
"resource": { | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl" | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
}, | ||
"201": { | ||
"headers": { | ||
"Azure-AsyncOperation": "https://contoso.com/operationstatus" | ||
}, | ||
"body": { | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/9KF-f-8b", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"title": "Employees_Delete", | ||
"operationId": "Employees_Delete", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", | ||
"resourceGroupName": "rgopenapi", | ||
"employeeName": "5vX--BxSu3ux48rI4O9OQ569" | ||
}, | ||
"responses": { | ||
"202": { | ||
"headers": { | ||
"Retry-After": 30, | ||
"location": "https://contoso.com/operationstatus" | ||
} | ||
}, | ||
"204": {} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...on/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"title": "Employees_Get", | ||
"operationId": "Employees_Get", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", | ||
"resourceGroupName": "rgopenapi", | ||
"employeeName": "le-8MU--J3W6q8D386p3-iT3" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...manager/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"title": "Employees_ListByResourceGroup", | ||
"operationId": "Employees_ListByResourceGroup", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", | ||
"resourceGroupName": "rgopenapi" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
], | ||
"nextLink": "https://microsoft.com/a" | ||
} | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...tmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"title": "Employees_ListBySubscription", | ||
"operationId": "Employees_ListBySubscription", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
], | ||
"nextLink": "https://microsoft.com/a" | ||
} | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"title": "Employees_Update", | ||
"operationId": "Employees_Update", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview", | ||
"subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", | ||
"resourceGroupName": "rgopenapi", | ||
"employeeName": "-XhyNJ--", | ||
"properties": { | ||
"tags": { | ||
"key7952": "no" | ||
}, | ||
"properties": { | ||
"age": 24, | ||
"city": "uyfg", | ||
"profile": "oapgijcswfkruiuuzbwco" | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"properties": { | ||
"age": 30, | ||
"city": "gydhnntudughbmxlkyzrskcdkotrxn", | ||
"profile": "ms", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"tags": { | ||
"key2913": "urperxmkkhhkp" | ||
}, | ||
"location": "itajgxyqozseoygnl", | ||
"id": "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/contoso/providers/Microsoft.Contoso/employees/test", | ||
"name": "xepyxhpb", | ||
"type": "svvamxrdnnv", | ||
"systemData": { | ||
"createdBy": "iewyxsnriqktsvp", | ||
"createdByType": "User", | ||
"createdAt": "2023-05-19T00:28:48.610Z", | ||
"lastModifiedBy": "xrchbnnuzierzpxw", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2023-05-19T00:28:48.610Z" | ||
} | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Operations_List.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"title": "Operations_List", | ||
"operationId": "Operations_List", | ||
"parameters": { | ||
"api-version": "2021-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"name": "ymeow", | ||
"isDataAction": true, | ||
"display": { | ||
"provider": "qxyznq", | ||
"resource": "bqfwkox", | ||
"operation": "td", | ||
"description": "yvgkhsuwartgxb" | ||
}, | ||
"origin": "user", | ||
"actionType": "Internal" | ||
} | ||
], | ||
"nextLink": "https://sample.com/nextLink" | ||
} | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
specification/contosowidgetmanager/Contoso.Management/main.tsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "./employee.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
|
||
/** Microsoft.Contoso Resource Provider management API. */ | ||
@armProviderNamespace | ||
@service({ | ||
title: "Microsoft.Contoso management service", | ||
}) | ||
@versioned(Microsoft.Contoso.Versions) | ||
namespace Microsoft.Contoso; | ||
|
||
/** The available API versions. */ | ||
enum Versions { | ||
/** 2021-10-01-preview version */ | ||
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_2) | ||
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) | ||
v2021_10_01_preview: "2021-10-01-preview", | ||
} | ||
|
||
interface Operations extends Azure.ResourceManager.Operations {} |
Oops, something went wrong.