From c4b33165c43ba9253bb5b36a8c907dbef570bb6f Mon Sep 17 00:00:00 2001 From: Allen Zhang Date: Fri, 2 Aug 2024 00:29:01 -0700 Subject: [PATCH] Creating a sample ARM sample project based on standard template (#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 Co-authored-by: Yuchao Yan Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Co-authored-by: Renhe Li Co-authored-by: qiaozha Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> --- .../Contoso.Management/employee.tsp | 69 +++ .../Employees_CreateOrUpdate.json | 76 +++ .../2021-10-01-preview/Employees_Delete.json | 19 + .../2021-10-01-preview/Employees_Get.json | 37 ++ .../Employees_ListByResourceGroup.json | 41 ++ .../Employees_ListBySubscription.json | 40 ++ .../2021-10-01-preview/Employees_Update.json | 47 ++ .../2021-10-01-preview/Operations_List.json | 28 + .../Contoso.Management/main.tsp | 31 + .../Contoso.Management/tspconfig.yaml | 56 ++ .../preview/2021-10-01-preview/contoso.json | 560 ++++++++++++++++++ .../examples/Employees_CreateOrUpdate.json | 76 +++ .../examples/Employees_Delete.json | 19 + .../examples/Employees_Get.json | 37 ++ .../Employees_ListByResourceGroup.json | 41 ++ .../Employees_ListBySubscription.json | 40 ++ .../examples/Employees_Update.json | 47 ++ .../examples/Operations_List.json | 28 + .../resource-manager/readme.md | 38 ++ 19 files changed, 1330 insertions(+) create mode 100644 specification/contosowidgetmanager/Contoso.Management/employee.tsp create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Operations_List.json create mode 100644 specification/contosowidgetmanager/Contoso.Management/main.tsp create mode 100644 specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/contoso.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_CreateOrUpdate.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Delete.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Get.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListByResourceGroup.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListBySubscription.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Update.json create mode 100644 specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Operations_List.json create mode 100644 specification/contosowidgetmanager/resource-manager/readme.md diff --git a/specification/contosowidgetmanager/Contoso.Management/employee.tsp b/specification/contosowidgetmanager/Contoso.Management/employee.tsp new file mode 100644 index 000000000000..081564ed9236 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/employee.tsp @@ -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 { + ...ResourceNameParameter; +} + +/** 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; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + update is ArmCustomPatchSync< + Employee, + Azure.ResourceManager.Foundations.ResourceUpdateModel< + Employee, + EmployeeProperties + > + >; + delete is ArmResourceDeleteWithoutOkAsync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json new file mode 100644 index 000000000000..9b34209dcd17 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_CreateOrUpdate.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json new file mode 100644 index 000000000000..9ac7910eb3f7 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Delete.json @@ -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": {} + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json new file mode 100644 index 000000000000..3ee7ff5b9c4f --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Get.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json new file mode 100644 index 000000000000..f6512d2ba7c2 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListByResourceGroup.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json new file mode 100644 index 000000000000..ffa095dd1d66 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_ListBySubscription.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json new file mode 100644 index 000000000000..f3f85a465653 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Employees_Update.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Operations_List.json b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Operations_List.json new file mode 100644 index 000000000000..6185e205aa43 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/examples/2021-10-01-preview/Operations_List.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/Contoso.Management/main.tsp b/specification/contosowidgetmanager/Contoso.Management/main.tsp new file mode 100644 index 000000000000..4645475daca6 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/main.tsp @@ -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 {} diff --git a/specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml b/specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml new file mode 100644 index 000000000000..52a074d63aa5 --- /dev/null +++ b/specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml @@ -0,0 +1,56 @@ +parameters: + "service-dir": + default: "sdk/contoso" +emit: + - "@azure-tools/typespec-autorest" +options: + "@azure-tools/typespec-autorest": + use-read-only-status-schema: true + emitter-output-dir: "{project-root}/.." + azure-resource-provider-folder: "resource-manager" + output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contoso.json" + examples-directory: "{project-root}/examples" + emit-common-types-schema: "never" + "@azure-tools/typespec-csharp": + flavor: azure + package-dir: "Azure.ResourceManager.Contoso" + clear-output-folder: true + model-namespace: false + namespace: "{package-dir}" + "@azure-tools/typespec-python": + package-dir: "azure-mgmt-contoso" + package-name: "{package-dir}" + generate-test: true + flavor: "azure" + "@azure-tools/typespec-java": + package-dir: "azure-resourcemanager-contoso" + namespace: "com.azure.resourcemanager.contoso" + service-name: "contoso" + examples-directory: "{project-root}/examples" + flavor: azure + "@azure-tools/typespec-ts": + package-dir: "arm-contoso" + azureSdkForJs: true + isModularLibrary: true + generateMetadata: true + flavor: "azure" + hierarchyClient: false + experimentalExtensibleEnums: true + enableOperationGroup: true + packageDetails: + name: "@azure/arm-contoso" + "@azure-tools/typespec-go": + service-dir: "sdk/resourcemanager/contoso" + package-dir: "armcontoso" + module: "github.com/Azure/azure-sdk-for-go/{service-dir}/{package-dir}" + examples-directory: "{project-root}/examples" + fix-const-stuttering: true + flavor: "azure" + generate-examples: true + generate-fakes: true + head-as-boolean: true + inject-spans: true + remove-unreferenced-types: true +linter: + extends: + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/contoso.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/contoso.json new file mode 100644 index 000000000000..baa25985dfb4 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/contoso.json @@ -0,0 +1,560 @@ +{ + "swagger": "2.0", + "info": { + "title": "Microsoft.Contoso management service", + "version": "2021-10-01-preview", + "description": "Microsoft.Contoso Resource Provider management API.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "Operations" + }, + { + "name": "Employees" + } + ], + "paths": { + "/providers/Microsoft.Contoso/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Operations_List": { + "$ref": "./examples/Operations_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees": { + "get": { + "operationId": "Employees_ListBySubscription", + "tags": [ + "Employees" + ], + "description": "List Employee resources by subscription ID", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/EmployeeListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_ListBySubscription": { + "$ref": "./examples/Employees_ListBySubscription.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees": { + "get": { + "operationId": "Employees_ListByResourceGroup", + "tags": [ + "Employees" + ], + "description": "List Employee resources by resource group", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/EmployeeListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_ListByResourceGroup": { + "$ref": "./examples/Employees_ListByResourceGroup.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}": { + "get": { + "operationId": "Employees_Get", + "tags": [ + "Employees" + ], + "description": "Get a Employee", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_Get": { + "$ref": "./examples/Employees_Get.json" + } + } + }, + "put": { + "operationId": "Employees_CreateOrUpdate", + "tags": [ + "Employees" + ], + "description": "Create a Employee", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/Employee" + } + } + ], + "responses": { + "200": { + "description": "Resource 'Employee' update operation succeeded", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "201": { + "description": "Resource 'Employee' create operation succeeded", + "schema": { + "$ref": "#/definitions/Employee" + }, + "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_CreateOrUpdate": { + "$ref": "./examples/Employees_CreateOrUpdate.json" + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Employees_Update", + "tags": [ + "Employees" + ], + "description": "Update a Employee", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/EmployeeUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_Update": { + "$ref": "./examples/Employees_Update.json" + } + } + }, + "delete": { + "operationId": "Employees_Delete", + "tags": [ + "Employees" + ], + "description": "Delete a Employee", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Employees_Delete": { + "$ref": "./examples/Employees_Delete.json" + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + } + }, + "definitions": { + "Employee": { + "type": "object", + "description": "Employee resource", + "properties": { + "properties": { + "$ref": "#/definitions/EmployeeProperties", + "description": "The resource-specific properties for this resource." + } + }, + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/TrackedResource" + } + ] + }, + "EmployeeListResult": { + "type": "object", + "description": "The response of a Employee list operation.", + "properties": { + "value": { + "type": "array", + "description": "The Employee items on this page", + "items": { + "$ref": "#/definitions/Employee" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "EmployeeProperties": { + "type": "object", + "description": "Employee properties", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of employee" + }, + "city": { + "type": "string", + "description": "City of employee" + }, + "profile": { + "type": "string", + "format": "base64url", + "description": "Profile of employee" + }, + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "The status of the last operation.", + "readOnly": true + } + } + }, + "EmployeeUpdate": { + "type": "object", + "description": "The type used for update operations of the Employee.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + }, + "properties": { + "$ref": "#/definitions/EmployeeUpdateProperties", + "description": "The resource-specific properties for this resource." + } + } + }, + "EmployeeUpdateProperties": { + "type": "object", + "description": "The updatable properties of the Employee.", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of employee" + }, + "city": { + "type": "string", + "description": "City of employee" + }, + "profile": { + "type": "string", + "format": "base64url", + "description": "Profile of employee" + } + } + }, + "ProvisioningState": { + "type": "string", + "description": "The resource provisioning state.", + "enum": [ + "Succeeded", + "Failed", + "Canceled", + "Provisioning", + "Updating", + "Deleting", + "Accepted" + ], + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true, + "values": [ + { + "name": "Succeeded", + "value": "Succeeded", + "description": "Resource has been created." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Resource creation failed." + }, + { + "name": "Canceled", + "value": "Canceled", + "description": "Resource creation was canceled." + }, + { + "name": "Provisioning", + "value": "Provisioning", + "description": "The resource is being provisioned" + }, + { + "name": "Updating", + "value": "Updating", + "description": "The resource is updating" + }, + { + "name": "Deleting", + "value": "Deleting", + "description": "The resource is being deleted" + }, + { + "name": "Accepted", + "value": "Accepted", + "description": "The resource create request has been accepted" + } + ] + }, + "readOnly": true + } + }, + "parameters": {} +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_CreateOrUpdate.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_CreateOrUpdate.json new file mode 100644 index 000000000000..9b34209dcd17 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_CreateOrUpdate.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Delete.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Delete.json new file mode 100644 index 000000000000..9ac7910eb3f7 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Delete.json @@ -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": {} + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Get.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Get.json new file mode 100644 index 000000000000..3ee7ff5b9c4f --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Get.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListByResourceGroup.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListByResourceGroup.json new file mode 100644 index 000000000000..f6512d2ba7c2 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListByResourceGroup.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListBySubscription.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListBySubscription.json new file mode 100644 index 000000000000..ffa095dd1d66 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_ListBySubscription.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Update.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Update.json new file mode 100644 index 000000000000..f3f85a465653 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Employees_Update.json @@ -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" + } + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Operations_List.json b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Operations_List.json new file mode 100644 index 000000000000..6185e205aa43 --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-10-01-preview/examples/Operations_List.json @@ -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" + } + } + } +} diff --git a/specification/contosowidgetmanager/resource-manager/readme.md b/specification/contosowidgetmanager/resource-manager/readme.md new file mode 100644 index 000000000000..f06c1befc05c --- /dev/null +++ b/specification/contosowidgetmanager/resource-manager/readme.md @@ -0,0 +1,38 @@ +# containerstorage + +> see https://aka.ms/autorest +This is the AutoRest configuration file for Contoso. + +## Getting Started + +To build the SDKs for My API, simply install AutoRest via `npm` (`npm install -g autorest`) and then run: + +> `autorest readme.md` +To see additional help and options, run: + +> `autorest --help` +For other options on installation see [Installing AutoRest](https://aka.ms/autorest/install) on the AutoRest github page. + +--- + +## Configuration + +### Basic Information + +These are the global settings for the containerstorage. + +```yaml +openapi-type: arm +tag: 2021-10-01-preview +``` + +### Tag: package-2021-10-01-preview + +These settings apply only when `--tag=package-2021-10-01-preview` is specified on the command line. + +```yaml $(tag) == 'package-2023-07-01-preview' +input-file: + - Microsoft.Contoso/preview/2021-10-01-preview/contoso.json +``` + +--- \ No newline at end of file