/AWS1/IF_EC2=>PURCHASEHOSTRESERVATION()¶
About PurchaseHostReservation¶
Purchase a reservation with configurations that match those of your Dedicated Host. You must have active Dedicated Hosts in your account before you purchase a reservation. This action results in the specified reservation being purchased and charged to your account.
Method Signature¶
METHODS /AWS1/IF_EC2~PURCHASEHOSTRESERVATION
IMPORTING
!IV_CLIENTTOKEN TYPE /AWS1/EC2STRING OPTIONAL
!IV_CURRENCYCODE TYPE /AWS1/EC2CURRENCYCODEVALUES OPTIONAL
!IT_HOSTIDSET TYPE /AWS1/CL_EC2REQUESTHOSTIDSET_W=>TT_REQUESTHOSTIDSET OPTIONAL
!IV_LIMITPRICE TYPE /AWS1/EC2STRING OPTIONAL
!IV_OFFERINGID TYPE /AWS1/EC2OFFERINGID OPTIONAL
!IT_TAGSPECIFICATIONS TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2purchasehostrese01
RAISING
/AWS1/CX_EC2CLIENTEXC
/AWS1/CX_EC2SERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
it_hostidset TYPE /AWS1/CL_EC2REQUESTHOSTIDSET_W=>TT_REQUESTHOSTIDSET TT_REQUESTHOSTIDSET¶
The IDs of the Dedicated Hosts with which the reservation will be associated.
iv_offeringid TYPE /AWS1/EC2OFFERINGID /AWS1/EC2OFFERINGID¶
The ID of the offering.
Optional arguments:¶
iv_clienttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.
iv_currencycode TYPE /AWS1/EC2CURRENCYCODEVALUES /AWS1/EC2CURRENCYCODEVALUES¶
The currency in which the
totalUpfrontPrice,LimitPrice, andtotalHourlyPriceamounts are specified. At this time, the only supported currency isUSD.
iv_limitprice TYPE /AWS1/EC2STRING /AWS1/EC2STRING¶
The specified limit is checked against the total upfront cost of the reservation (calculated as the offering's upfront cost multiplied by the host count). If the total upfront cost is greater than the specified price limit, the request fails. This is used to ensure that the purchase does not exceed the expected upfront cost of the purchase. At this time, the only supported currency is
USD. For example, to indicate a limit price of USD 100, specify 100.00.
it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST¶
The tags to apply to the Dedicated Host Reservation during purchase.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ec2purchasehostrese01 /AWS1/CL_EC2PURCHASEHOSTRESE01¶
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->purchasehostreservation(
it_hostidset = VALUE /aws1/cl_ec2requesthostidset_w=>tt_requesthostidset(
( new /aws1/cl_ec2requesthostidset_w( |string| ) )
)
it_tagspecifications = VALUE /aws1/cl_ec2tagspecification=>tt_tagspecificationlist(
(
new /aws1/cl_ec2tagspecification(
it_tags = VALUE /aws1/cl_ec2tag=>tt_taglist(
(
new /aws1/cl_ec2tag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_resourcetype = |string|
)
)
)
iv_clienttoken = |string|
iv_currencycode = |string|
iv_limitprice = |string|
iv_offeringid = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_string = lo_result->get_clienttoken( ).
lv_currencycodevalues = lo_result->get_currencycode( ).
LOOP AT lo_result->get_purchase( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_currencycodevalues = lo_row_1->get_currencycode( ).
lv_integer = lo_row_1->get_duration( ).
LOOP AT lo_row_1->get_hostidset( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_string = lo_row_3->get_value( ).
ENDIF.
ENDLOOP.
lv_hostreservationid = lo_row_1->get_hostreservationid( ).
lv_string = lo_row_1->get_hourlyprice( ).
lv_string = lo_row_1->get_instancefamily( ).
lv_paymentoption = lo_row_1->get_paymentoption( ).
lv_string = lo_row_1->get_upfrontprice( ).
ENDIF.
ENDLOOP.
lv_string = lo_result->get_totalhourlyprice( ).
lv_string = lo_result->get_totalupfrontprice( ).
ENDIF.