CreateResourcePolicy - Amazon Lex

CreateResourcePolicy

Creates a new resource policy with the specified policy statements.

Request Syntax

POST /policy/resourceArn/ HTTP/1.1 Content-type: application/json { "policy": "string" }

URI Request Parameters

The request uses the following URI parameters.

resourceArn

The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy is attached to.

Length Constraints: Minimum length of 1. Maximum length of 1011.

Required: Yes

Request Body

The request accepts the following data in JSON format.

policy

A resource policy to add to the resource. The policy is a JSON structure that contains one or more statements that define the policy. The policy must follow the IAM syntax. For more information about the contents of a JSON policy document, see IAM JSON policy reference .

If the policy isn't valid, Amazon Lex returns a validation exception.

Type: String

Length Constraints: Minimum length of 2.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "resourceArn": "string", "revisionId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

resourceArn

The Amazon Resource Name (ARN) of the bot or bot alias that the resource policy was attached to.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1011.

revisionId

The current revision of the resource policy. Use the revision ID to make sure that you are updating the most current version of a resource policy when you add a policy statement to a resource, delete a resource, or update a resource.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 5.

Pattern: ^[0-9]+$

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerException

HTTP Status Code: 500

PreconditionFailedException

HTTP Status Code: 412

ResourceNotFoundException

HTTP Status Code: 404

ServiceQuotaExceededException

HTTP Status Code: 402

ThrottlingException

HTTP Status Code: 429

ValidationException

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: