IoT / Client / create_policy
create_policy#
- IoT.Client.create_policy(**kwargs)#
Creates an IoT policy.
The created policy is the default version for the policy. This operation creates a policy version with a version identifier of 1 and sets 1 as the policy’s default version.
Requires permission to access the CreatePolicy action.
See also: AWS API Documentation
Request Syntax
response = client.create_policy( policyName='string', policyDocument='string', tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
- Parameters:
policyName (string) –
[REQUIRED]
The policy name.
policyDocument (string) –
[REQUIRED]
The JSON document that describes the policy. policyDocument must have a minimum length of 1, with a maximum length of 2048, excluding whitespace.
tags (list) –
Metadata which can be used to manage the policy.
Note
For URI Request parameters use format: …key1=value1&key2=value2…
For the CLI command-line parameter use format: &&tags “key1=value1&key2=value2…”
For the cli-input-json file use format: “tags”: “key1=value1&key2=value2…”
(dict) –
A set of key/value pairs that are used to manage the resource.
Key (string) – [REQUIRED]
The tag’s key.
Value (string) –
The tag’s value.
- Return type:
dict
- Returns:
Response Syntax
{ 'policyName': 'string', 'policyArn': 'string', 'policyDocument': 'string', 'policyVersionId': 'string' }
Response Structure
(dict) –
The output from the CreatePolicy operation.
policyName (string) –
The policy name.
policyArn (string) –
The policy ARN.
policyDocument (string) –
The JSON document that describes the policy.
policyVersionId (string) –
The policy version ID.
Exceptions
IoT.Client.exceptions.ResourceAlreadyExistsException
IoT.Client.exceptions.MalformedPolicyException
IoT.Client.exceptions.InvalidRequestException
IoT.Client.exceptions.ThrottlingException
IoT.Client.exceptions.UnauthorizedException
IoT.Client.exceptions.ServiceUnavailableException
IoT.Client.exceptions.InternalFailureException