From 468428dcc0d183feafca8afc5f4d25ce9e0be709 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 23 Jan 2017 19:27:31 +0800 Subject: [PATCH] [api-ref] Split instance management to states and networks As we plan to add more sub-element to states and networks, it may be more clear to split them from instance management in docs Change-Id: I341bddf1dac81309e2dced16afc64d181e9e9008 --- api-ref/source/v1/index.rst | 2 + api-ref/source/v1/instance_networks.inc | 38 ++++++++++ api-ref/source/v1/instance_states.inc | 66 +++++++++++++++++ api-ref/source/v1/instances.inc | 94 ------------------------- 4 files changed, 106 insertions(+), 94 deletions(-) create mode 100644 api-ref/source/v1/instance_networks.inc create mode 100644 api-ref/source/v1/instance_states.inc diff --git a/api-ref/source/v1/index.rst b/api-ref/source/v1/index.rst index 54399232..80987233 100644 --- a/api-ref/source/v1/index.rst +++ b/api-ref/source/v1/index.rst @@ -8,5 +8,7 @@ Baremetal Compute API V1 (CURRENT) .. include:: urls.inc .. include:: instances.inc +.. include:: instance_states.inc +.. include:: instance_networks.inc .. include:: instance_types.inc .. include:: availability_zones.inc diff --git a/api-ref/source/v1/instance_networks.inc b/api-ref/source/v1/instance_networks.inc new file mode 100644 index 00000000..10fb8bbe --- /dev/null +++ b/api-ref/source/v1/instance_networks.inc @@ -0,0 +1,38 @@ +.. -*- rst -*- + +=================== + Instance Networks +=================== + +Instances Networks can be managed through networks sub-resource. + +A Instance can be associated or dissociated with a floating IP by requesting +the floatingip sub-resource. + + +Instance Network Summary +======================== + +.. rest_method:: GET /v1/instances/{instance_uuid}/networks + +Get a summary of the Instance's networks. + +Normal response code: 200 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - instance_uuid: instance_ident + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - ports: network_info + +**Example instance network:** + +.. literalinclude:: samples/instances/instance-get-network-response.json diff --git a/api-ref/source/v1/instance_states.inc b/api-ref/source/v1/instance_states.inc new file mode 100644 index 00000000..f662d20a --- /dev/null +++ b/api-ref/source/v1/instance_states.inc @@ -0,0 +1,66 @@ +.. -*- rst -*- + +================= + Instance States +================= + +Instances States can be managed through states sub-resource. + +A Instance can be rebooted, turned on, or turned off by requesting a change to +its power state. + + +Instance State Summary +====================== + +.. rest_method:: GET /v1/instances/{instance_uuid}/states + +Get a summary of the Instance's current states. + +Normal response code: 200 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - instance_uuid: instance_ident + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - power_state: power_state + - status: instance_status + +**Example instance state:** + +.. literalinclude:: samples/instances/instance-get-state-response.json + + +Change Instance Power State +=========================== + +.. rest_method:: PUT /v1/instances/{instance_uuid}/states/power + +Request a change to the Instance's power state. + +Normal response code: 202 + +Error codes: + - 409 (ClientError) + - 400 (InvalidState) + - 406 (NotAcceptable) + +Request +------- + +.. rest_parameters:: parameters.yaml + + - instance_uuid: instance_ident + - target: power_state + +**Example request to power off a Instance:** + +.. literalinclude:: samples/instances/instance-set-power-off.json diff --git a/api-ref/source/v1/instances.inc b/api-ref/source/v1/instances.inc index fcd49fe1..26d8f204 100644 --- a/api-ref/source/v1/instances.inc +++ b/api-ref/source/v1/instances.inc @@ -288,97 +288,3 @@ Response -------- No body content is returned on a successful DELETE. - - -=============================== -Instance Management (instances) -=============================== - -Instances can be managed through several sub-resources. - -A Instance can be rebooted, turned on, or turned off by requesting a change to -its power state. This is handled asynchronously. - - -Instance State Summary -====================== - -.. rest_method:: GET /v1/instances/{instance_uuid}/states - -Get a summary of the Instance's current states. - -Normal response code: 200 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - instance_uuid: instance_ident - -Response --------- - -.. rest_parameters:: parameters.yaml - - - power_state: power_state - - status: instance_status - -**Example instance state:** - -.. literalinclude:: samples/instances/instance-get-state-response.json - - -Change Instance Power State -=========================== - -.. rest_method:: PUT /v1/instances/{instance_uuid}/states/power - -Request a change to the Instance's power state. - -Normal response code: 202 - -Error codes: - - 409 (ClientError) - - 400 (InvalidState) - - 406 (NotAcceptable) - -Request -------- - -.. rest_parameters:: parameters.yaml - - - instance_uuid: instance_ident - - target: power_state - -**Example request to power off a Instance:** - -.. literalinclude:: samples/instances/instance-set-power-off.json - - -Instance Network Summary -======================== - -.. rest_method:: GET /v1/instances/{instance_uuid}/networks - -Get a summary of the Instance's networks. - -Normal response code: 200 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - instance_uuid: instance_ident - -Response --------- - -.. rest_parameters:: parameters.yaml - - - ports: network_info - -**Example instance network:** - -.. literalinclude:: samples/instances/instance-get-network-response.json