Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Resource Name added to swagger #9185

Merged
merged 17 commits into from
Jul 11, 2020
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parameters": {
"body": [
{
"Name": "isxbox",
"Type": "ResourceProviderTestHost/TestResourceType"
}
],
"api-version": "2015-11-01"
},
"responses": {
"200": {
"body": {
"name": "isxbox",
"type": "ResourceProviderTestHost/TestResourceType",
"status": "Allowed"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,46 @@
"nextLinkName": "nextLink"
}
}
},
"/providers/Microsoft.Resources/checkResourceName": {
"post": {
"tags": [
"Tenants"
],
"operationId": "checkResourceName",
"description": "A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word",
"summary": "Checks resource name validity",
"consumes": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/CheckResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "default" response

"200": {
"description": "OK - Returns status as allowed or not.",
"schema": {
"$ref": "#/definitions/CheckResourceNameResult"
}
},
"default": {
"description": "Error response saying resource name is invalid",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Check validity for a resource name.": {
"$ref": "./examples/CheckResourceName.json"
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -277,9 +317,82 @@
"nextLink"
],
"description": "Tenant Ids information."
},
"ResourceName": {
"description": "Name and Type of the Resource",
"required": [
"name",
"type"
],
"properties": {
"name": {
"description": "Name of the resource",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the resource"
}
}
},
"ErrorResponse": {
"description": "Error response.",
"properties": {
"error": {
"$ref": "#/definitions/ErrorDefinition",
"description": "The error details."
}
}
},
"ErrorDefinition": {
"description": "Error description and code explaining why resource name is invalid.",
"properties": {
"message": {
"type": "string",
"description": "Description of the error."
},
"code": {
"type": "string",
"description": "Code of the error."
}
}
},
"CheckResourceNameResult": {
"properties": {
"name": {
"description": "Name of Resource",
"type": "string"
},
"type": {
"description": "Type of Resource",
"type": "string"
},
"status": {
"description": "Is the resource name Allowed or Reserved",
"type": "string",
"enum": [
"Allowed",
"Reserved"
],
"x-ms-enum": {
"name": "ResourceNameStatus",
"modelAsString": true
}
}
},
"description": "Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word"
}
},
"parameters": {
"CheckResourceNameParameter": {
"description": "Resource object with values for resource name and resource type",
"in": "body",
"name": "Resource Name Definition",
"schema": {
"$ref": "#/definitions/ResourceName"
},
"x-ms-parameter-location": "method"
},
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parameters": {
"body": [
{
"Name": "isxbox",
"Type": "ResourceProviderTestHost/TestResourceType"
}
],
"api-version": "2016-06-01"
},
"responses": {
"200": {
"body": {
"name": "isxbox",
"type": "ResourceProviderTestHost/TestResourceType",
"status": "Allowed"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,46 @@
"nextLinkName": "nextLink"
}
}
},
"/providers/Microsoft.Resources/checkResourceName": {
"post": {
"tags": [
"Tenants"
],
"operationId": "checkResourceName",
"description": "A resource name is valid if it is not a reserved word, does not contains a reserved word and does not start with a reserved word",
"summary": "Checks resource name validity",
"consumes": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/CheckResourceNameParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing default response

"description": "OK - Returns status as allowed or not.",
"schema": {
"$ref": "#/definitions/CheckResourceNameResult"
}
},
"default": {
"description": "Error response saying resource name is invalid",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Check validity for a resource name.": {
"$ref": "./examples/CheckResourceName.json"
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -338,6 +378,70 @@
],
"description": "Tenant Ids information."
},
"ResourceName": {
"description": "Name and Type of the Resource",
"required": [
"name",
"type"
],
"properties": {
"name": {
"description": "Name of the resource",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the resource"
}
}
},
"CheckResourceNameResult": {
"properties": {
"name": {
"description": "Name of Resource",
"type": "string"
},
"type": {
"description": "Type of Resource",
"type": "string"
},
"status": {
"description": "Is the resource name Allowed or Reserved",
"type": "string",
"enum": [
"Allowed",
"Reserved"
],
"x-ms-enum": {
"name": "ResourceNameStatus",
"modelAsString": true
}
}
},
"description": "Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word"
},
"ErrorResponse": {
"description": "Error response.",
"properties": {
"error": {
"$ref": "#/definitions/ErrorDefinition",
"description": "The error details."
}
}
},
"ErrorDefinition": {
"description": "Error description and code explaining why resource name is invalid.",
"properties": {
"message": {
"type": "string",
"description": "Description of the error."
},
"code": {
"type": "string",
"description": "Code of the error."
}
}
},
"Operation": {
"description": "Microsoft.Resources operation",
"type": "object",
Expand Down Expand Up @@ -395,6 +499,15 @@
"description": "The ID of the target subscription.",
"x-ms-parameter-location": "method"
},
"CheckResourceNameParameter": {
"description": "Resource object with values for resource name and resource type",
"in": "body",
"name": "Resource Name Definition",
"schema": {
"$ref": "#/definitions/ResourceName"
},
"x-ms-parameter-location": "method"
},
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parameters": {
"body": [
{
"Name": "isxbox",
"Type": "ResourceProviderTestHost/TestResourceType"
}
],
"api-version": "2018-06-01"
},
"responses": {
"200": {
"body": {
"name": "isxbox",
"type": "ResourceProviderTestHost/TestResourceType",
"status": "Allowed"
}
}
}
}
Loading