diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/CommunicationIdentity.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/CommunicationIdentity.json new file mode 100644 index 000000000000..3a1d05a954ca --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/CommunicationIdentity.json @@ -0,0 +1,313 @@ +{ + "swagger": "2.0", + "info": { + "title": "CommunicationIdentityClient", + "description": "Azure Communication Identity Service", + "version": "2021-02-22-preview1" + }, + "paths": { + "/identities": { + "post": { + "tags": [ + "Identity" + ], + "summary": "Create a new identity.", + "operationId": "CommunicationIdentity_Create", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "schema": { + "$ref": "#/definitions/CommunicationIdentityCreateRequest" + } + } + ], + "responses": { + "default": { + "description": "Error", + "schema": { + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" + } + }, + "201": { + "description": "Created - Returns the created identity.", + "schema": { + "$ref": "#/definitions/CommunicationIdentityAccessTokenResult" + } + } + }, + "x-ms-examples": { + "Create an Identity": { + "$ref": "./examples/CreateIdentity.json" + } + } + } + }, + "/identities/{id}": { + "delete": { + "tags": [ + "Identity" + ], + "summary": "Delete the identity, revoke all tokens for the identity and delete all associated data.", + "operationId": "CommunicationIdentity_Delete", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "description": "Identifier of the identity to be deleted.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "default": { + "description": "Error", + "schema": { + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" + } + }, + "204": { + "description": "Success" + } + }, + "x-ms-examples": { + "Delete an identity": { + "$ref": "./examples/DeleteIdentity.json" + } + } + } + }, + "/identities/{id}/:revokeAccessTokens": { + "post": { + "tags": [ + "Identity" + ], + "summary": "Revoke all access tokens for the specific identity.", + "operationId": "CommunicationIdentity_RevokeAccessTokens", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "description": "Identifier of the identity.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "default": { + "description": "Error", + "schema": { + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" + } + }, + "204": { + "description": "Success" + } + }, + "x-ms-examples": { + "Revoke access tokens": { + "$ref": "./examples/RevokeAccessTokens.json" + } + } + } + }, + "/identities/{id}/:issueAccessToken": { + "post": { + "tags": [ + "Token" + ], + "summary": "Issue a new token for an identity.", + "operationId": "CommunicationIdentity_IssueAccessToken", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "description": "Identifier of the identity to issue token for.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Requesting scopes for the new token.", + "required": true, + "schema": { + "$ref": "#/definitions/CommunicationIdentityAccessTokenRequest" + } + } + ], + "responses": { + "default": { + "description": "Error", + "schema": { + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" + } + }, + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/CommunicationIdentityAccessToken" + } + } + }, + "x-ms-examples": { + "Issue an access token": { + "$ref": "./examples/IssueAccessToken.json" + } + } + } + } + }, + "definitions": { + "CommunicationIdentityTokenScope": { + "description": "List of scopes for an access token.", + "enum": [ + "chat", + "voip" + ], + "type": "string", + "x-ms-enum": { + "name": "CommunicationIdentityTokenScope", + "modelAsString": true + } + }, + "CommunicationIdentityCreateRequest": { + "type": "object", + "properties": { + "createTokenWithScopes": { + "description": "Also create access token for the created identity.", + "type": "array", + "items": { + "$ref": "#/definitions/CommunicationIdentityTokenScope" + } + } + } + }, + "CommunicationIdentity": { + "description": "A communication identity.", + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "description": "Identifier of the identity.", + "type": "string" + } + } + }, + "CommunicationIdentityAccessToken": { + "description": "An access token.", + "required": [ + "expiresOn", + "token" + ], + "type": "object", + "properties": { + "token": { + "description": "The access token issued for the identity.", + "type": "string" + }, + "expiresOn": { + "format": "date-time", + "description": "The expiry time of the token.", + "type": "string" + } + } + }, + "CommunicationIdentityAccessTokenResult": { + "description": "A communication identity with access token.", + "required": [ + "identity" + ], + "type": "object", + "properties": { + "identity": { + "$ref": "#/definitions/CommunicationIdentity" + }, + "accessToken": { + "$ref": "#/definitions/CommunicationIdentityAccessToken" + } + } + }, + "CommunicationIdentityAccessTokenRequest": { + "required": [ + "scopes" + ], + "type": "object", + "properties": { + "scopes": { + "description": "List of scopes attached to the token.", + "type": "array", + "items": { + "$ref": "#/definitions/CommunicationIdentityTokenScope" + } + } + } + } + }, + "parameters": { + "ApiVersionParameter": { + "in": "query", + "name": "api-version", + "description": "Version of API to invoke.", + "required": true, + "type": "string" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "name": "endpoint", + "description": "The communication resource, for example https://my-resource.communication.azure.com", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + } + ] + } +} diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/CreateIdentity.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/CreateIdentity.json new file mode 100644 index 000000000000..84fa1a0fbdfb --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/CreateIdentity.json @@ -0,0 +1,25 @@ +{ + "parameters": { + "api-version": "2021-03-07", + "content-type": "application/json", + "endpoint": "https://my-resource.communication.azure.com", + "body": { + "createTokenWithScopes": [ + "chat" + ] + } + }, + "responses": { + "201": { + "body": { + "identity": { + "id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081" + }, + "accessToken": { + "token": "token", + "expiresOn": "2020-09-10T21:39:39.3244584+00:00" + } + } + } + } +} diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/DeleteIdentity.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/DeleteIdentity.json new file mode 100644 index 000000000000..993d441f2f85 --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/DeleteIdentity.json @@ -0,0 +1,11 @@ +{ + "parameters": { + "api-version": "2021-03-07", + "content-type": "application/json", + "id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081", + "endpoint": "https://my-resource.communication.azure.com" + }, + "responses": { + "204": {} + } +} diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/IssueAccessToken.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/IssueAccessToken.json new file mode 100644 index 000000000000..2e65b9f6a994 --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/IssueAccessToken.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2021-03-07", + "content-type": "application/merge-patch+json", + "id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081", + "body": { + "scopes": [ + "chat" + ] + }, + "endpoint": "https://my-resource.communication.azure.com" + }, + "responses": { + "200": { + "body": { + "token": "token", + "expiresOn": "2020-09-10T21:39:39.3244584+00:00" + } + } + } +} diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/RevokeAccessTokens.json b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/RevokeAccessTokens.json new file mode 100644 index 000000000000..993d441f2f85 --- /dev/null +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/examples/RevokeAccessTokens.json @@ -0,0 +1,11 @@ +{ + "parameters": { + "api-version": "2021-03-07", + "content-type": "application/json", + "id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081", + "endpoint": "https://my-resource.communication.azure.com" + }, + "responses": { + "204": {} + } +} diff --git a/specification/communication/data-plane/Microsoft.CommunicationServicesTurn/preview/2021-02-22-preview1/CommunicationTurn.json b/specification/communication/data-plane/Microsoft.CommunicationServicesTurn/preview/2021-02-22-preview1/CommunicationTurn.json index 98b462771b22..35affa23fbdd 100644 --- a/specification/communication/data-plane/Microsoft.CommunicationServicesTurn/preview/2021-02-22-preview1/CommunicationTurn.json +++ b/specification/communication/data-plane/Microsoft.CommunicationServicesTurn/preview/2021-02-22-preview1/CommunicationTurn.json @@ -32,13 +32,13 @@ "default": { "description": "Error", "schema": { - "$ref": "#/definitions/CommunicationErrorResponse" + "$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse" } }, "200": { "description": "Success", "schema": { - "$ref": "#/definitions/TurnCredentialsResponse" + "$ref": "#/definitions/CommunicationTurnCredentialsResponse" } } }, @@ -51,53 +51,7 @@ } }, "definitions": { - "CommunicationError": { - "description": "The Communication Services error.", - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "description": "The error code.", - "type": "string" - }, - "message": { - "description": "The error message.", - "type": "string" - }, - "target": { - "description": "The error target.", - "type": "string", - "readOnly": true - }, - "details": { - "description": "Further details about specific errors that led to this error.", - "type": "array", - "items": { - "$ref": "#/definitions/CommunicationError" - }, - "readOnly": true - }, - "innerError": { - "$ref": "#/definitions/CommunicationError" - } - } - }, - "CommunicationErrorResponse": { - "description": "The Communication Services error.", - "required": [ - "error" - ], - "type": "object", - "properties": { - "error": { - "$ref": "#/definitions/CommunicationError" - } - } - }, - "TurnServer": { + "CommunicationTurnServer": { "description": "An instance of a TURN server with credentials.", "required": [ "credential", @@ -120,7 +74,7 @@ } } }, - "TurnCredentialsResponse": { + "CommunicationTurnCredentialsResponse": { "description": "A TURN credentials response.", "required": [ "expiresOn", @@ -137,7 +91,7 @@ "description": "An array representing the credentials and the TURN server URL.", "type": "array", "items": { - "$ref": "#/definitions/TurnServer" + "$ref": "#/definitions/CommunicationTurnServer" } } } diff --git a/specification/communication/data-plane/readme.md b/specification/communication/data-plane/readme.md index e90b4e6e29b9..932dcabce405 100644 --- a/specification/communication/data-plane/readme.md +++ b/specification/communication/data-plane/readme.md @@ -96,6 +96,7 @@ These settings apply only when `--tag=package-2021-02-22-preview1` is specified ```yaml $(tag) == 'package-2021-02-22-preview1' input-file: - Microsoft.CommunicationServicesTurn/preview/2021-02-22-preview1/CommunicationTurn.json + - Microsoft.CommunicationServicesIdentity/preview/2021-02-22-preview1/CommunicationIdentity.json ``` ### Tag: package-2020-11-19-preview1