/AWS1/IF_AAN=>CHECKNOPUBLICACCESS()¶
About CheckNoPublicAccess¶
Checks whether a resource policy can grant public access to the specified resource type.
Method Signature¶
METHODS /AWS1/IF_AAN~CHECKNOPUBLICACCESS
IMPORTING
!IV_POLICYDOCUMENT TYPE /AWS1/AANACCESSCHECKPOLICYDOC OPTIONAL
!IV_RESOURCETYPE TYPE /AWS1/AANACCCHECKRESOURCETYPE OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_aanchecknopubaccrsp
RAISING
/AWS1/CX_AANACCESSDENIEDEX
/AWS1/CX_AANINTERNALSERVEREX
/AWS1/CX_AANINVALIDPARAMETEREX
/AWS1/CX_AANTHROTTLINGEX
/AWS1/CX_AANUNPROCABLEENTITYEX
/AWS1/CX_AANVALIDATIONEX
/AWS1/CX_AANCLIENTEXC
/AWS1/CX_AANSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_policydocument TYPE /AWS1/AANACCESSCHECKPOLICYDOC /AWS1/AANACCESSCHECKPOLICYDOC¶
The JSON policy document to evaluate for public access.
iv_resourcetype TYPE /AWS1/AANACCCHECKRESOURCETYPE /AWS1/AANACCCHECKRESOURCETYPE¶
The type of resource to evaluate for public access. For example, to check for public access to Amazon S3 buckets, you can choose
AWS::S3::Bucketfor the resource type.For resource types not supported as valid values, IAM Access Analyzer will return an error.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_aanchecknopubaccrsp /AWS1/CL_AANCHECKNOPUBACCRSP¶
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->checknopublicaccess(
iv_policydocument = |string|
iv_resourcetype = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_checknopublicaccessresu = lo_result->get_result( ).
lv_string = lo_result->get_message( ).
LOOP AT lo_result->get_reasons( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_description( ).
lv_integer = lo_row_1->get_statementindex( ).
lv_string = lo_row_1->get_statementid( ).
ENDIF.
ENDLOOP.
ENDIF.
Passing check. S3 Bucket policy without public access.¶
Passing check. S3 Bucket policy without public access.
DATA(lo_result) = lo_client->checknopublicaccess(
iv_policydocument = |{"Version":"2012-10-17","Statement":[{"Sid":"Bob","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::111122223333:user/JohnDoe"},"Action":["s3:GetObject"]}]}|
iv_resourcetype = |AWS::S3::Bucket|
).
Failing check. S3 Bucket policy with public access.¶
Failing check. S3 Bucket policy with public access.
DATA(lo_result) = lo_client->checknopublicaccess(
iv_policydocument = |{"Version":"2012-10-17","Statement":[{"Sid":"Bob","Effect":"Allow","Principal":"*","Action":["s3:GetObject"]}]}|
iv_resourcetype = |AWS::S3::Bucket|
).