/AWS1/IF_EC2=>MODIFYHOSTS()¶
About ModifyHosts¶
Modify the auto-placement setting of a Dedicated Host. When auto-placement is enabled,
any instances that you launch with a tenancy of host but without a specific
host ID are placed onto any available Dedicated Host in your account that has
auto-placement enabled. When auto-placement is disabled, you need to provide a host ID
to have the instance launch onto a specific host. If no host ID is provided, the
instance is launched onto a suitable host with auto-placement enabled.
You can also use this API action to modify a Dedicated Host to support either multiple instance types in an instance family, or to support a specific instance type only.
Method Signature¶
METHODS /AWS1/IF_EC2~MODIFYHOSTS
  IMPORTING
    !IV_HOSTRECOVERY TYPE /AWS1/EC2HOSTRECOVERY OPTIONAL
    !IV_INSTANCETYPE TYPE /AWS1/EC2STRING OPTIONAL
    !IV_INSTANCEFAMILY TYPE /AWS1/EC2STRING OPTIONAL
    !IV_HOSTMAINTENANCE TYPE /AWS1/EC2HOSTMAINTENANCE OPTIONAL
    !IT_HOSTIDS TYPE /AWS1/CL_EC2REQHOSTIDLIST_W=>TT_REQUESTHOSTIDLIST OPTIONAL
    !IV_AUTOPLACEMENT TYPE /AWS1/EC2AUTOPLACEMENT OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2modifyhostsresult
  RAISING
    /AWS1/CX_EC2CLIENTEXC
    /AWS1/CX_EC2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
it_hostids TYPE /AWS1/CL_EC2REQHOSTIDLIST_W=>TT_REQUESTHOSTIDLIST TT_REQUESTHOSTIDLIST¶
The IDs of the Dedicated Hosts to modify.
Optional arguments:¶
iv_hostrecovery TYPE /AWS1/EC2HOSTRECOVERY /AWS1/EC2HOSTRECOVERY¶
Indicates whether to enable or disable host recovery for the Dedicated Host. For more information, see Host recovery in the Amazon EC2 User Guide.
iv_instancetype TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
Specifies the instance type to be supported by the Dedicated Host. Specify this parameter to modify a Dedicated Host to support only a specific instance type.
If you want to modify a Dedicated Host to support multiple instance types in its current instance family, omit this parameter and specify InstanceFamily instead. You cannot specify InstanceType and InstanceFamily in the same request.
iv_instancefamily TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
Specifies the instance family to be supported by the Dedicated Host. Specify this parameter to modify a Dedicated Host to support multiple instance types within its current instance family.
If you want to modify a Dedicated Host to support a specific instance type only, omit this parameter and specify InstanceType instead. You cannot specify InstanceFamily and InstanceType in the same request.
iv_hostmaintenance TYPE /AWS1/EC2HOSTMAINTENANCE /AWS1/EC2HOSTMAINTENANCE¶
Indicates whether to enable or disable host maintenance for the Dedicated Host. For more information, see Host maintenance in the Amazon EC2 User Guide.
iv_autoplacement TYPE /AWS1/EC2AUTOPLACEMENT /AWS1/EC2AUTOPLACEMENT¶
Specify whether to enable or disable auto-placement.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ec2modifyhostsresult /AWS1/CL_EC2MODIFYHOSTSRESULT¶
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->modifyhosts(
  it_hostids = VALUE /aws1/cl_ec2reqhostidlist_w=>tt_requesthostidlist(
    ( new /aws1/cl_ec2reqhostidlist_w( |string| ) )
  )
  iv_autoplacement = |string|
  iv_hostmaintenance = |string|
  iv_hostrecovery = |string|
  iv_instancefamily = |string|
  iv_instancetype = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_successful( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_string = lo_row_1->get_value( ).
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_unsuccessful( ) into lo_row_2.
    lo_row_3 = lo_row_2.
    IF lo_row_3 IS NOT INITIAL.
      lo_unsuccessfulitemerror = lo_row_3->get_error( ).
      IF lo_unsuccessfulitemerror IS NOT INITIAL.
        lv_string = lo_unsuccessfulitemerror->get_code( ).
        lv_string = lo_unsuccessfulitemerror->get_message( ).
      ENDIF.
      lv_string = lo_row_3->get_resourceid( ).
    ENDIF.
  ENDLOOP.
ENDIF.