Skip to content

/AWS1/IF_NWS=>PUTADMINACCOUNT()

About PutAdminAccount

Sets the AWS account that serves as an AWS Network Security Manager administrator account, and optionally configures the scope of resources that the administrator can manage.

You can't set an administrator account again immediately after you remove it, or while the service creates its service-linked role. Retry the request after a few minutes.

Method Signature

METHODS /AWS1/IF_NWS~PUTADMINACCOUNT
  IMPORTING
    !IV_ACCOUNTID TYPE /AWS1/NWSACCOUNTID OPTIONAL
    !IV_PRIORITY TYPE /AWS1/NWSADMINPRIORITY OPTIONAL
    !IO_ADMINSCOPE TYPE REF TO /AWS1/CL_NWSADMINSCOPEINPUT OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_nwsputadminaccountrsp
  RAISING
    /AWS1/CX_NWSACCESSDENIEDEX
    /AWS1/CX_NWSCONFLICTEXCEPTION
    /AWS1/CX_NWSINTERNALSERVEREX
    /AWS1/CX_NWSSERVICEQUOTAEXCDEX
    /AWS1/CX_NWSSERVICEUNAVAILEX
    /AWS1/CX_NWSTHROTTLINGEX
    /AWS1/CX_NWSVLDTNEXCEPTION
    /AWS1/CX_NWSCLIENTEXC
    /AWS1/CX_NWSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_accountid TYPE /AWS1/NWSACCOUNTID /AWS1/NWSACCOUNTID

The AWS account ID to set as the AWS Network Security Manager administrator account.

iv_priority TYPE /AWS1/NWSADMINPRIORITY /AWS1/NWSADMINPRIORITY

The priority to assign to the administrator account.

Optional arguments:

io_adminscope TYPE REF TO /AWS1/CL_NWSADMINSCOPEINPUT /AWS1/CL_NWSADMINSCOPEINPUT

The scope of accounts, organizational units, and firewall types that the administrator can manage.

RETURNING

oo_output TYPE REF TO /aws1/cl_nwsputadminaccountrsp /AWS1/CL_NWSPUTADMINACCOUNTRSP

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->putadminaccount(
  io_adminscope = new /aws1/cl_nwsadminscopeinput(
    io_firewalltypescope = new /aws1/cl_nwsadminfwalltypescop(
      it_firewalltypes = VALUE /aws1/cl_nwsfirewalltypelist_w=>tt_firewalltypelist(
        ( new /aws1/cl_nwsfirewalltypelist_w( |string| ) )
      )
      iv_allfirewalltypesenabled = ABAP_TRUE
    )
    io_scopefilter = new /aws1/cl_nwsadmncopefiltinput(
      io_excludeonly = new /aws1/cl_nwsadminscpslctninput(
        it_accounts = VALUE /aws1/cl_nwsaccountidlist_w=>tt_accountidlist(
          ( new /aws1/cl_nwsaccountidlist_w( |string| ) )
        )
        it_organizationalunits = VALUE /aws1/cl_nwsorgnlunitidlist_w=>tt_organizationalunitidlist(
          ( new /aws1/cl_nwsorgnlunitidlist_w( |string| ) )
        )
      )
      io_includeall = new /aws1/cl_nwsunit( )
      io_includeonly = new /aws1/cl_nwsadminscpslctninput(
        it_accounts = VALUE /aws1/cl_nwsaccountidlist_w=>tt_accountidlist(
          ( new /aws1/cl_nwsaccountidlist_w( |string| ) )
        )
        it_organizationalunits = VALUE /aws1/cl_nwsorgnlunitidlist_w=>tt_organizationalunitidlist(
          ( new /aws1/cl_nwsorgnlunitidlist_w( |string| ) )
        )
      )
    )
  )
  iv_accountid = |string|
  iv_priority = 123
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_adminaccountdetails = lo_result->get_adminaccountdetails( ).
  IF lo_adminaccountdetails IS NOT INITIAL.
    lv_accountid = lo_adminaccountdetails->get_adminaccount( ).
    lv_adminpriority = lo_adminaccountdetails->get_priority( ).
    lo_adminscope = lo_adminaccountdetails->get_adminscope( ).
    IF lo_adminscope IS NOT INITIAL.
      lo_adminscopefilter = lo_adminscope->get_scopefilter( ).
      IF lo_adminscopefilter IS NOT INITIAL.
        lo_unit = lo_adminscopefilter->get_includeall( ).
        IF lo_unit IS NOT INITIAL.
        ENDIF.
        lo_adminscopeselection = lo_adminscopefilter->get_includeonly( ).
        IF lo_adminscopeselection IS NOT INITIAL.
          LOOP AT lo_adminscopeselection->get_accounts( ) into lo_row.
            lo_row_1 = lo_row.
            IF lo_row_1 IS NOT INITIAL.
              lv_accountid = lo_row_1->get_accountid( ).
              lv_sensitiveaccountname = lo_row_1->get_name( ).
              lv_sensitiveaccountemail = lo_row_1->get_email( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_adminscopeselection->get_organizationalunits( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_organizationalunitid = lo_row_3->get_ouid( ).
              lv_string = lo_row_3->get_name( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lo_adminscopeselection = lo_adminscopefilter->get_excludeonly( ).
        IF lo_adminscopeselection IS NOT INITIAL.
          LOOP AT lo_adminscopeselection->get_accounts( ) into lo_row.
            lo_row_1 = lo_row.
            IF lo_row_1 IS NOT INITIAL.
              lv_accountid = lo_row_1->get_accountid( ).
              lv_sensitiveaccountname = lo_row_1->get_name( ).
              lv_sensitiveaccountemail = lo_row_1->get_email( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_adminscopeselection->get_organizationalunits( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_organizationalunitid = lo_row_3->get_ouid( ).
              lv_string = lo_row_3->get_name( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      lo_adminfirewalltypescope = lo_adminscope->get_firewalltypescope( ).
      IF lo_adminfirewalltypescope IS NOT INITIAL.
        lv_boolean = lo_adminfirewalltypescope->get_allfirewalltypesenabled( ).
        LOOP AT lo_adminfirewalltypescope->get_firewalltypes( ) into lo_row_4.
          lo_row_5 = lo_row_4.
          IF lo_row_5 IS NOT INITIAL.
            lv_policyfirewalltype = lo_row_5->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
    lv_adminaccountstatus = lo_adminaccountdetails->get_status( ).
  ENDIF.
ENDIF.

Designate an administrator account

Designates an account as a Network Security Manager administrator, scoped to a specific organizational unit and the WAF firewall type.

DATA(lo_result) = lo_client->putadminaccount(
  io_adminscope = new /aws1/cl_nwsadminscopeinput(
    io_firewalltypescope = new /aws1/cl_nwsadminfwalltypescop(
      it_firewalltypes = VALUE /aws1/cl_nwsfirewalltypelist_w=>tt_firewalltypelist(
        ( new /aws1/cl_nwsfirewalltypelist_w( |WAF| ) )
      )
      iv_allfirewalltypesenabled = ABAP_FALSE
    )
    io_scopefilter = new /aws1/cl_nwsadmncopefiltinput(
      io_includeonly = new /aws1/cl_nwsadminscpslctninput(
        it_organizationalunits = VALUE /aws1/cl_nwsorgnlunitidlist_w=>tt_organizationalunitidlist(
          ( new /aws1/cl_nwsorgnlunitidlist_w( |ou-abcd-12345678| ) )
        )
      )
    )
  )
  iv_accountid = |234567890123|
  iv_priority = 2
).