/AWS1/IF_VPS=>UPDATEPOLICY()¶
About UpdatePolicy¶
Modifies a Cedar static policy in the specified policy store. You can change only certain elements of the UpdatePolicyDefinition parameter. You can directly update only static policies. To change a template-linked policy, you must update the template instead, using UpdatePolicyTemplate.
-
If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn't pass validation, the operation fails and the update isn't stored.
-
When you edit a static policy, you can change only certain elements of a static policy:
-
The action referenced by the policy.
-
A condition clause, such as when and unless.
You can't change these elements of a static policy:
-
Changing a policy from a static policy to a template-linked policy.
-
Changing the effect of a static policy from permit or forbid.
-
The principal referenced by a static policy.
-
The resource referenced by a static policy.
-
-
To update a template-linked policy, you must update the template instead.
Verified Permissions is eventually consistent . It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.
Method Signature¶
METHODS /AWS1/IF_VPS~UPDATEPOLICY
IMPORTING
!IV_POLICYSTOREID TYPE /AWS1/VPSPOLICYSTOREID OPTIONAL
!IV_POLICYID TYPE /AWS1/VPSPOLICYID OPTIONAL
!IO_DEFINITION TYPE REF TO /AWS1/CL_VPSUPDATEPOLICYDEFN OPTIONAL
!IV_NAME TYPE /AWS1/VPSPOLICYNAME OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_vpsupdatepolicyoutput
RAISING
/AWS1/CX_VPSACCESSDENIEDEX
/AWS1/CX_VPSINTERNALSERVEREX
/AWS1/CX_VPSTHROTTLINGEX
/AWS1/CX_VPSVALIDATIONEX
/AWS1/CX_VPSCONFLICTEXCEPTION
/AWS1/CX_VPSRESOURCENOTFOUNDEX
/AWS1/CX_VPSSERVICEQUOTAEXCDEX
/AWS1/CX_VPSCLIENTEXC
/AWS1/CX_VPSSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_policystoreid TYPE /AWS1/VPSPOLICYSTOREID /AWS1/VPSPOLICYSTOREID¶
Specifies the ID of the policy store that contains the policy that you want to update.
To specify a policy store, use its ID or alias name. When using an alias name, prefix it with
policy-store-alias/. For example:
ID:
PSEXAMPLEabcdefg111111Alias name:
policy-store-alias/example-policy-storeTo view aliases, use ListPolicyStoreAliases.
iv_policyid TYPE /AWS1/VPSPOLICYID /AWS1/VPSPOLICYID¶
Specifies the ID of the policy that you want to update. To find this value, you can use ListPolicies.
You can use the policy name in place of the policy ID. When using a name, prefix it with
name/. For example:
ID:
SPEXAMPLEabcdefg111111Name:
name/example-policy
Optional arguments:¶
io_definition TYPE REF TO /AWS1/CL_VPSUPDATEPOLICYDEFN /AWS1/CL_VPSUPDATEPOLICYDEFN¶
Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.
If you don't specify this parameter, the existing policy definition remains unchanged.
You can change only the following elements from the policy definition:
The
actionreferenced by the policy.Any conditional clauses, such as
whenorunlessclauses.You can't change the following elements:
Changing from
statictotemplateLinked.Changing the effect of the policy from
permitorforbid.The
principalreferenced by the policy.The
resourcereferenced by the policy.
iv_name TYPE /AWS1/VPSPOLICYNAME /AWS1/VPSPOLICYNAME¶
Specifies a name for the policy that is unique among all policies within the policy store. You can use the name in place of the policy ID in API operations that reference the policy. The name must be prefixed with
name/.If you don't include the name in an update request, the existing name is unchanged. To remove a name, set it to an empty string (
"").If you specify a name that is already associated with another policy in the policy store, you receive a
ConflictExceptionerror.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_vpsupdatepolicyoutput /AWS1/CL_VPSUPDATEPOLICYOUTPUT¶
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->updatepolicy(
io_definition = new /aws1/cl_vpsupdatepolicydefn(
io_static = new /aws1/cl_vpsupdstaticplydefn(
iv_description = |string|
iv_statement = |string|
)
)
iv_name = |string|
iv_policyid = |string|
iv_policystoreid = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_policystoreid = lo_result->get_policystoreid( ).
lv_policyid = lo_result->get_policyid( ).
lv_policytype = lo_result->get_policytype( ).
lo_entityidentifier = lo_result->get_principal( ).
IF lo_entityidentifier IS NOT INITIAL.
lv_entitytype = lo_entityidentifier->get_entitytype( ).
lv_entityid = lo_entityidentifier->get_entityid( ).
ENDIF.
lo_entityidentifier = lo_result->get_resource( ).
IF lo_entityidentifier IS NOT INITIAL.
lv_entitytype = lo_entityidentifier->get_entitytype( ).
lv_entityid = lo_entityidentifier->get_entityid( ).
ENDIF.
LOOP AT lo_result->get_actions( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_actiontype = lo_row_1->get_actiontype( ).
lv_actionid = lo_row_1->get_actionid( ).
ENDIF.
ENDLOOP.
lv_timestampformat = lo_result->get_createddate( ).
lv_timestampformat = lo_result->get_lastupdateddate( ).
lv_policyeffect = lo_result->get_effect( ).
ENDIF.
UpdatePolicy¶
The following example replaces the definition of the specified static policy with a new one.
DATA(lo_result) = lo_client->updatepolicy(
io_definition = new /aws1/cl_vpsupdatepolicydefn( new /aws1/cl_vpsupdstaticplydefn( iv_statement = |permit(principal, action, resource in Album::"public_folder");| ) )
iv_name = |name/example-policy-2|
iv_policyid = |9wYxMpljbbZQb5fcZHyJhY|
iv_policystoreid = |C7v5xMplfFH3i3e4Jrzb1a|
).