/AWS1/IF_OWC=>RESTORESERVER()¶
About RestoreServer¶
Restores a backup to a server that is in a CONNECTION_LOST, HEALTHY, RUNNING, UNHEALTHY, or TERMINATED state.
When you run RestoreServer, the server's EC2 instance is deleted, and a new EC2 instance is configured. RestoreServer maintains
the existing server endpoint, so configuration management of the server's client devices (nodes) should continue to work.
Restoring from a backup is performed by creating a new EC2 instance. If restoration is successful, and the server is in a HEALTHY state,
OpsWorks CM switches traffic over to the new instance. After restoration is finished, the old EC2 instance is maintained in a
Running or Stopped state, but is eventually terminated.
This operation is asynchronous.
An InvalidStateException is thrown when the server is not in a valid state. A ResourceNotFoundException is thrown
when the server does not exist. A ValidationException is raised when parameters of the request are not valid.
Method Signature¶
METHODS /AWS1/IF_OWC~RESTORESERVER
IMPORTING
!IV_BACKUPID TYPE /AWS1/OWCBACKUPID OPTIONAL
!IV_SERVERNAME TYPE /AWS1/OWCSERVERNAME OPTIONAL
!IV_INSTANCETYPE TYPE /AWS1/OWCSTRING OPTIONAL
!IV_KEYPAIR TYPE /AWS1/OWCKEYPAIR OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_owcrestoreserverrsp
RAISING
/AWS1/CX_OWCINVALIDSTATEEX
/AWS1/CX_OWCRESOURCENOTFOUNDEX
/AWS1/CX_OWCVALIDATIONEX
/AWS1/CX_OWCCLIENTEXC
/AWS1/CX_OWCSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_backupid TYPE /AWS1/OWCBACKUPID /AWS1/OWCBACKUPID¶
The ID of the backup that you want to use to restore a server.
iv_servername TYPE /AWS1/OWCSERVERNAME /AWS1/OWCSERVERNAME¶
The name of the server that you want to restore.
Optional arguments:¶
iv_instancetype TYPE /AWS1/OWCSTRING /AWS1/OWCSTRING¶
The type of instance to restore. Valid values must be specified in the following format:
^([cm][34]|t2).*For example,m5.large. Valid values arem5.large,r5.xlarge, andr5.2xlarge. If you do not specify this parameter, RestoreServer uses the instance type from the specified backup.
iv_keypair TYPE /AWS1/OWCKEYPAIR /AWS1/OWCKEYPAIR¶
The name of the key pair to set on the new EC2 instance. This can be helpful if the administrator no longer has the SSH key.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_owcrestoreserverrsp /AWS1/CL_OWCRESTORESERVERRSP¶
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->restoreserver(
iv_backupid = |string|
iv_instancetype = |string|
iv_keypair = |string|
iv_servername = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lo_server = lo_result->get_server( ).
IF lo_server IS NOT INITIAL.
lv_boolean = lo_server->get_associatepublicipaddress( ).
lv_integer = lo_server->get_backupretentioncount( ).
lv_string = lo_server->get_servername( ).
lv_timestamp = lo_server->get_createdat( ).
lv_string = lo_server->get_cloudformationstackarn( ).
lv_customdomain = lo_server->get_customdomain( ).
lv_boolean = lo_server->get_disableautomatedbackup( ).
lv_string = lo_server->get_endpoint( ).
lv_string = lo_server->get_engine( ).
lv_string = lo_server->get_enginemodel( ).
LOOP AT lo_server->get_engineattributes( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_engineattributename = lo_row_1->get_name( ).
lv_engineattributevalue = lo_row_1->get_value( ).
ENDIF.
ENDLOOP.
lv_string = lo_server->get_engineversion( ).
lv_string = lo_server->get_instanceprofilearn( ).
lv_string = lo_server->get_instancetype( ).
lv_string = lo_server->get_keypair( ).
lv_maintenancestatus = lo_server->get_maintenancestatus( ).
lv_timewindowdefinition = lo_server->get_preferredmaintenancewi00( ).
lv_timewindowdefinition = lo_server->get_preferredbackupwindow( ).
LOOP AT lo_server->get_securitygroupids( ) 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_string = lo_server->get_servicerolearn( ).
lv_serverstatus = lo_server->get_status( ).
lv_string = lo_server->get_statusreason( ).
LOOP AT lo_server->get_subnetids( ) 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_string = lo_server->get_serverarn( ).
ENDIF.
ENDIF.