Update disassociate fip API
1. Remove DELETE request body 2. Add API doc Change-Id: I2b86826427bd6d464f4da4c003ef6624a6a354a8
This commit is contained in:
parent
974540e456
commit
d0683bb32a
@ -66,3 +66,24 @@ Request
|
|||||||
**Example request to Add (Associate) Floating IP to an instance:**
|
**Example request to Add (Associate) Floating IP to an instance:**
|
||||||
|
|
||||||
.. literalinclude:: samples/instances/instance-associate-fip-req.json
|
.. literalinclude:: samples/instances/instance-associate-fip-req.json
|
||||||
|
|
||||||
|
|
||||||
|
Remove (Disassociate) Floating IP
|
||||||
|
=================================
|
||||||
|
|
||||||
|
.. rest_method:: DELETE /v1/instances/{instance_uuid}/networks/floatingips/{fip_address}
|
||||||
|
|
||||||
|
Removes, or disassociates, a floating IP address from an instance.
|
||||||
|
|
||||||
|
Normal response codes: 204
|
||||||
|
|
||||||
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
|
||||||
|
itemNotFound(404), conflict(409)
|
||||||
|
|
||||||
|
Request
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- instance_uuid: instance_ident
|
||||||
|
- fip_address: address_path
|
||||||
|
@ -9,6 +9,12 @@ openstack-request-id:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
# variables in path
|
# variables in path
|
||||||
|
address_path:
|
||||||
|
description: |
|
||||||
|
The floating IP address.
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
api_version:
|
api_version:
|
||||||
in: path
|
in: path
|
||||||
required: true
|
required: true
|
||||||
|
@ -207,17 +207,18 @@ class FloatingIPController(InstanceControllerBase):
|
|||||||
msg, status_code=http_client.BAD_REQUEST)
|
msg, status_code=http_client.BAD_REQUEST)
|
||||||
|
|
||||||
@policy.authorize_wsgi("mogan:instance", "disassociate_floatingip")
|
@policy.authorize_wsgi("mogan:instance", "disassociate_floatingip")
|
||||||
@expose.expose(None, types.uuid, types.jsontype,
|
@expose.expose(None, types.uuid, wtypes.text,
|
||||||
status_code=http_client.NO_CONTENT)
|
status_code=http_client.NO_CONTENT)
|
||||||
def delete(self, instance_uuid, floatingip):
|
def delete(self, instance_uuid, address):
|
||||||
"""Dissociate floating_ip from an instance.
|
"""Dissociate floating_ip from an instance.
|
||||||
|
|
||||||
:param instance_uuid: UUID of a instance.
|
:param instance_uuid: UUID of a instance.
|
||||||
:param floatingip: The floating IP within the request body.
|
:param floatingip: The floating IP within the request body.
|
||||||
"""
|
"""
|
||||||
validation.check_schema(floatingip, fip_schemas.remove_floating_ip)
|
if not netutils.is_valid_ipv4(address):
|
||||||
address = floatingip['address']
|
msg = "Invalid IP address %s" % address
|
||||||
|
raise wsme.exc.ClientSideError(
|
||||||
|
msg, status_code=http_client.BAD_REQUEST)
|
||||||
# get the floating ip object
|
# get the floating ip object
|
||||||
try:
|
try:
|
||||||
floating_ip = self.network_api.get_floating_ip_by_address(
|
floating_ip = self.network_api.get_floating_ip_by_address(
|
||||||
|
@ -26,13 +26,3 @@ add_floating_ip = {
|
|||||||
'required': ['address'],
|
'required': ['address'],
|
||||||
'additionalProperties': False
|
'additionalProperties': False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
remove_floating_ip = {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'address': parameter_types.ip_address,
|
|
||||||
},
|
|
||||||
'required': ['address'],
|
|
||||||
'additionalProperties': False
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user