diff --git a/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/CommunicationService.json b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/CommunicationService.json index 6e840a1d9a20..33b5c40e5fef 100644 --- a/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/CommunicationService.json +++ b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/CommunicationService.json @@ -62,6 +62,60 @@ } } }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability": { + "post": { + "description": "Checks that the CommunicationService name is valid and is not already in use.", + "operationId": "CommunicationService_CheckNameAvailability", + "summary": "Check Name Availability", + "tags": [ + "CommunicationService" + ], + "parameters": [ + { + "name": "nameAvailabilityParameters", + "in": "body", + "schema": { + "$ref": "#/definitions/NameAvailabilityParameters" + }, + "description": "Parameters supplied to the operation." + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v1/types.json#/parameters/ApiVersionParameter" + } + ], + "consumes": [ + "application/json" + ], + "responses": { + "200": { + "description": "Success. The response describes the name availability.", + "schema": { + "$ref": "#/definitions/NameAvailability" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "produces": [ + "application/json" + ], + "x-ms-examples": { + "Check name availability available": { + "$ref": "./examples/checkNameAvailabilityAvailable.json" + }, + "Check name availability unavailable": { + "$ref": "./examples/checkNameAvailabilityUnavailable.json" + } + } + } + }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub": { "post": { "description": "Links an Azure Notification Hub to this communication service.", @@ -763,6 +817,42 @@ } } }, + "NameAvailabilityParameters": { + "description": "Data POST-ed to the nameAvailability action", + "required": [ + "type", + "name" + ], + "type": "object", + "properties": { + "type": { + "description": "The resource type. Should be always \"Microsoft.Communication/CommunicationServices\".", + "type": "string" + }, + "name": { + "description": "The CommunicationService name to validate. e.g.\"my-CommunicationService-name-here\"", + "type": "string" + } + } + }, + "NameAvailability": { + "description": "Result of the request to check name availability. It contains a flag and possible reason of failure.", + "type": "object", + "properties": { + "nameAvailable": { + "description": "Indicates whether the name is available or not.", + "type": "boolean" + }, + "reason": { + "description": "The reason of the availability. Required if name is not available.", + "type": "string" + }, + "message": { + "description": "The message of the operation.", + "type": "string" + } + } + }, "LinkNotificationHubParameters": { "description": "Description of an Azure Notification Hub to link to the communication service", "required": [ @@ -796,7 +886,7 @@ "type": "object", "properties": { "id": { - "description": "The operation Id.", + "description": "Fully qualified ID for the operation status.", "type": "string", "readOnly": true }, diff --git a/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityAvailable.json b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityAvailable.json new file mode 100644 index 000000000000..ed8a879a190e --- /dev/null +++ b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityAvailable.json @@ -0,0 +1,19 @@ +{ + "parameters": { + "subscriptionId": "12345", + "api-version": "2020-08-20-preview", + "nameAvailabilityParameters": { + "type": "Microsoft.Communication/CommunicationServices", + "name": "MyCommunicationService" + } + }, + "responses": { + "200": { + "body": { + "nameAvailable": true, + "reason": "NameAvailable", + "message": "Requested name is available for the requested type" + } + } + } +} diff --git a/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityUnavailable.json b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityUnavailable.json new file mode 100644 index 000000000000..a2e050f47ccc --- /dev/null +++ b/specification/communication/resource-manager/Microsoft.Communication/preview/2020-08-20-preview/examples/checkNameAvailabilityUnavailable.json @@ -0,0 +1,19 @@ +{ + "parameters": { + "subscriptionId": "12345", + "api-version": "2020-08-20-preview", + "nameAvailabilityParameters": { + "type": "Microsoft.Communication/CommunicationServices", + "name": "MyCommunicationService" + } + }, + "responses": { + "200": { + "body": { + "nameAvailable": false, + "reason": "AlreadyExists", + "message": "Requested name is unavailable for the requested type" + } + } + } +}