Remote API resource implementations.
PUT or POST?
According to RFC2616 the main difference between PUT and POST is that POST can create new resources but PUT can only create the resource the URI was pointing to on the PUT request.
In the context of this module POST on ``/2/instances`` to change an existing entity is legitimate, while PUT would not be. PUT creates a new entity (e.g. a new instance) with a name specified in the request.
Quoting from RFC2616, section 9.6:
The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.
So when adding new methods, if they are operating on the URI entity itself, PUT should be prefered over POST.
Class | R |
/2 resource. |
Class |
|
/2/modify resource. |
Class |
|
/2/features resource. |
Class |
|
/2/filters resource. |
Class |
|
/2/filters/[filter_uuid] resource. |
Class |
|
/2/groups resource. |
Class |
|
/2/groups/[group_name] resource. |
Class |
|
/2/groups/[group_name]/assign-nodes resource. |
Class |
|
/2/groups/[group_name]/modify resource. |
Class |
|
/2/groups/[group_name]/rename resource. |
Class |
|
/2/groups/[group_name]/tags resource. |
Class |
|
/2/info resource. |
Class |
|
/2/instances resource. |
Class |
|
/2/instances-multi-alloc resource. |
Class |
|
/2/instances/[instance_name] resource. |
Class |
|
/2/instances/[instance_name]/activate-disks resource. |
Class |
|
/2/instances/[instance_name]/console resource. |
Class |
|
/2/instances/[instance_name]/deactivate-disks resource. |
Class |
|
/2/instances/[instance_name]/disk/[disk_index]/grow resource. |
Class |
|
/2/instances/[instance_name]/export resource. |
Class |
|
/2/instances/[instance_name]/failover resource. |
Class |
|
/2/instances/[instance_name]/info resource. |
Class |
|
/2/instances/[instance_name]/migrate resource. |
Class |
|
/2/instances/[instance_name]/modify resource. |
Class |
|
/2/instances/[instance_name]/prepare-export resource. |
Class |
|
/2/instances/[instance_name]/reboot resource. |
Class |
|
/2/instances/[instance_name]/recreate-disks resource. |
Class |
|
/2/instances/[instance_name]/reinstall resource. |
Class |
|
/2/instances/[instance_name]/rename resource. |
Class |
|
/2/instances/[instance_name]/replace-disks resource. |
Class |
|
/2/instances/[instance_name]/shutdown resource. |
Class |
|
/2/instances/[instance_name]/startup resource. |
Class |
|
/2/instances/[instance_name]/tags resource. |
Class |
|
/2/jobs resource. |
Class |
|
/2/jobs/[job_id] resource. |
Class |
|
/2/jobs/[job_id]/wait resource. |
Class |
|
/2/networks resource. |
Class |
|
/2/networks/[network_name] resource. |
Class |
|
/2/networks/[network_name]/connect resource. |
Class |
|
/2/networks/[network_name]/disconnect resource. |
Class |
|
/2/networks/[network_name]/modify resource. |
Class |
|
/2/networks/[network_name]/rename resource. |
Class |
|
/2/networks/[network_name]/tags resource. |
Class |
|
/2/nodes resource. |
Class |
|
/2/nodes/[node_name] resource. |
Class |
|
/2/nodes/[node_name]/evacuate resource. |
Class |
|
/2/nodes/[node_name]/migrate resource. |
Class |
|
/2/nodes/[node_name]/modify resource. |
Class |
|
/2/nodes/[node_name]/powercycle resource. |
Class |
|
/2/nodes/[node_name]/role resource. |
Class |
|
/2/nodes/[node_name]/storage resource. |
Class |
|
/2/nodes/[node_name]/storage/modify resource. |
Class |
|
/2/nodes/[node_name]/storage/repair resource. |
Class |
|
/2/nodes/[node_name]/tags resource. |
Class |
|
/2/os resource. |
Class |
|
/2/query/[resource] resource. |
Class |
|
/2/query/[resource]/fields resource. |
Class |
|
/2/redistribute-config resource. |
Class |
|
/2/tags resource. |
Class |
|
/ resource. |
Class |
|
/version resource. |
Function | check |
Checks and extracts filter rule parameters from a request body. |
Constant | ALL |
Undocumented |
Constant | FILTER |
Undocumented |
Constant | G |
Undocumented |
Constant | I |
Undocumented |
Constant | J |
Undocumented |
Constant | J |
Undocumented |
Constant | N |
Undocumented |
Constant | NET |
Undocumented |
Class | _ |
Quasiclass for tagging resources. |
Function | _ |
Utility function to monitor the state of an open connection. |
Function | _ |
Convert in place the usb_devices string to the proper format. |
Function | _ |
Tries to extract fields query parameter. |
Function | _ |
Parses a request for reinstalling an instance. |
Function | _ |
Splits fields as given for a query request. |
Function | _ |
Updates the beparams dict of inst to support the memory field. |
Constant | _COMMON |
Undocumented |
Constant | _INST |
Undocumented |
Constant | _INST |
Undocumented |
Constant | _NODE |
Undocumented |
Constant | _NODE |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _NR |
Undocumented |
Constant | _REQ |
Undocumented |
Constant | _WFJC |
Undocumented |
Checks and extracts filter rule parameters from a request body.
Returns | |
the checked parameters: (priority, predicates, action). |
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Utility function to monitor the state of an open connection.
Parameters | |
sock | Connection's open socket |
Returns | |
True if the connection was remotely closed, otherwise False |
Convert in place the usb_devices string to the proper format.
In Ganeti 2.8.4 the separator for the usb_devices hvparam was changed from comma to space because commas cannot be accepted on the command line (they already act as the separator between different hvparams). RAPI should be able to accept commas for backwards compatibility, but we want it to also accept the new space separator. Therefore, we convert spaces into commas here and keep the old parsing logic elsewhere.
Tries to extract fields query parameter.
Parameters | |
args:dictionary | Undocumented |
Returns | |
list of string | Undocumented |
Raises | |
http.HttpBadRequest | When parameter can't be found |
Splits fields as given for a query request.
Parameters | |
fields:string | Undocumented |
Returns | |
list of string | Undocumented |
Updates the beparams dict of inst to support the memory field.
Parameters | |
inst | Inst dict |
Returns | |
Updated inst dict |