Skip to content

Commit

Permalink
Add data-plane samples creation template (#13528)
Browse files Browse the repository at this point in the history
* Add data-plane samples

* Simplified template
  • Loading branch information
lmazuel authored Apr 15, 2021
1 parent 7a2cc29 commit 85441dc
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"swagger": "2.0",
"info": {
"version": "2019-12-01",
"title": "YourServiceName",
"description": "Description of the new service"
},
"x-ms-parameterized-host": {
"hostTemplate": "{endpoint}",
"useSchemePrefix": true,
"positionInOperation": "first",
"parameters": [
{
"name": "endpoint",
"description": "The endpoint of the service",
"required": true,
"type": "string",
"in": "path",
"x-ms-skip-url-encoding": true
}
]
},
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/service/{accountName}": {
"get": {
"tags": [
"Tag1"
],
"operationId": "OperationGroup_Get",
"x-ms-examples": {
"BatchAccountDelete": {
"$ref": "./examples/OperationGroupGet.json"
}
},
"description": "This is a sample get operation, please see guidelines in azure-rest-api-specs repository for more info",
"parameters": [
{
"name": "accountName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the storage account."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Describe the result of a successful operation.",
"schema": {
"$ref": "#/definitions/Result"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
"Result": {
"description": "Sample result definition",
"properties": {
"sampleProperty": {
"type": "string",
"description": "Sample property of type string"
}
}
},
"ErrorResponse": {
"description": "Error response.",
"properties": {
"error": {
"$ref": "#/definitions/ErrorDefinition",
"description": "The error details."
}
}
},
"ErrorDefinition": {
"description": "Error definition.",
"properties": {
"code": {
"description": "Service specific error code which serves as the substatus for the HTTP error code.",
"type": "string",
"readOnly": true
},
"message": {
"description": "Description of the error.",
"type": "string",
"readOnly": true
},
"details": {
"description": "Internal error details.",
"type": "array",
"items": {
"$ref": "#/definitions/ErrorDefinition"
},
"readOnly": true
}
}
}
},
"parameters": {
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"description": "The API version to be used with the HTTP request."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"parameters": {
"accountName": "sampleacct",
"api-version": "2019-12-01"
},
"responses": {
"200": {
"body": {
"name": "sampleacct",
"location": "uswest",
"id": "/service/sampleacct",
"type": "Microsoft.YourServiceName/YourServiceName"
}
}
}
}
39 changes: 39 additions & 0 deletions documentation/samplefiles-dp/samplereadme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# [[ServiceName]]

> see https://aka.ms/autorest
This is the AutoRest configuration file for [[ServiceName]].

## 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 [[ServiceName]].

```yaml
openapi-type: [[OpenApiType]]
tag: package-[[Version]]
```
### Tag: package-[[Version]]
These settings apply only when `--tag=package-[[Version]]` is specified on the command line.

```yaml $(tag) == 'package-[[Version]]'
input-file:
- [[ResourceProviderName]]/[[ReleaseState]]/[[Version]]/[[ServiceName]].json
```

0 comments on commit 85441dc

Please sign in to comment.