Skip to content

/AWS1/CL_IOT=>CREATEPOLICYVERSION()

About CreatePolicyVersion

Creates a new version of the specified IoT policy. To update a policy, create a new policy version. A managed policy can have up to five versions. If the policy has five versions, you must use DeletePolicyVersion to delete an existing version before you create a new one.

Optionally, you can set the new version as the policy's default version. The default version is the operative version (that is, the version that is in effect for the certificates to which the policy is attached).

Requires permission to access the CreatePolicyVersion action.

Method Signature

IMPORTING

Required arguments:

iv_policyname TYPE /AWS1/IOTPOLICYNAME /AWS1/IOTPOLICYNAME

The policy name.

iv_policydocument TYPE /AWS1/IOTPOLICYDOCUMENT /AWS1/IOTPOLICYDOCUMENT

The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.

Optional arguments:

iv_setasdefault TYPE /AWS1/IOTSETASDEFAULT /AWS1/IOTSETASDEFAULT

Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).

RETURNING

oo_output TYPE REF TO /aws1/cl_iotcreatepolicyvrsrsp /AWS1/CL_IOTCREATEPOLICYVRSRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_iot~createpolicyversion(
  iv_policydocument = |string|
  iv_policyname = |string|
  iv_setasdefault = ABAP_TRUE
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_policyarn = lo_result->get_policyarn( ).
  lv_policydocument = lo_result->get_policydocument( ).
  lv_policyversionid = lo_result->get_policyversionid( ).
  lv_isdefaultversion = lo_result->get_isdefaultversion( ).
ENDIF.