From 4af5c971ebf30dbe1c0d05d5ba59652af8720166 Mon Sep 17 00:00:00 2001 From: Ha Van Tu Date: Mon, 22 Aug 2016 11:54:20 +0700 Subject: [PATCH] Correcting Networking API v2.0 flavor extension This patch corrects Networking API v2.0 flavor extension. Change-Id: I9a72f0aaf69dcd9e7ff8841b5b4f9de5eb42617d Partially-Implements: blueprint neutron-in-tree-api-ref --- api-ref/source/v2/flavors.inc | 652 ++++++++++-------- api-ref/source/v2/parameters.yaml | 130 +++- .../service-profiles-list-response.json | 4 +- 3 files changed, 471 insertions(+), 315 deletions(-) diff --git a/api-ref/source/v2/flavors.inc b/api-ref/source/v2/flavors.inc index b7de402e5..2da2730ff 100644 --- a/api-ref/source/v2/flavors.inc +++ b/api-ref/source/v2/flavors.inc @@ -1,8 +1,4 @@ .. -*- rst -*- -.. needs:method_verification -.. needs:parameter_verification -.. needs:example_verification -.. needs:body_verification ===================================================================== Networking Flavors Framework v2.0 (CURRENT) (flavor, service_profile) @@ -11,225 +7,12 @@ Networking Flavors Framework v2.0 (CURRENT) (flavor, service_profile) Extension that allows user selection of operator-curated flavors during resource creation. -Service ``q-flavors`` must be enabled in the configuration to use -this feature. - -Disassociate a flavor. -====================== - -.. rest_method:: DELETE /v2.0/flavors/{flavor_id}/service_profiles/{profile_id} - -Disassociate a flavor from a service profile. - -Error response codes: 404,403,204,401 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - profile_id: profile_id - - flavor_id: flavor_id - -Show service profile details -============================ - -.. rest_method:: GET /v2.0/service_profiles/{profile_id} - -Shows details for a service profile. - -This operation returns a service profile object by ID. If the object is not -visible by policy, the service returns the HTTP ``Forbidden (403)`` -response code. - -Normal response codes: 200 - -Error response codes: 404,403,401 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - profile_id: profile_id - -Response Parameters -------------------- - -.. rest_parameters:: parameters.yaml - - - description: description - - driver: driver - - enabled: enabled - - metainfo: metainfo - - service_profile: service_profile - - id: id - -Response Example ----------------- - -.. literalinclude:: samples/flavors/service-profile-show-response.json - :language: javascript - -Update service profile -====================== - -.. rest_method:: PUT /v2.0/service_profiles/{profile_id} - -Updates a service profile. - -Normal response codes: 200 -Error response codes: 404,403,401,400 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - service_profile: service_profile - - enabled: enabled - - driver: driver - - description: description - - metainfo: metainfo - - profile_id: profile_id - -Request Example ---------------- - -.. literalinclude:: samples/flavors/service-profile-update-request.json - :language: javascript - -Response Parameters -------------------- - -.. rest_parameters:: parameters.yaml - - - description: description - - driver: driver - - enabled: enabled - - metainfo: metainfo - - service_profile: service_profile - - id: id - -Response Example ----------------- - -.. literalinclude:: samples/flavors/service-profile-update-response.json - :language: javascript - -Delete service profile -====================== - -.. rest_method:: DELETE /v2.0/service_profiles/{profile_id} - -Deletes a service profile. - -Attempting to delete a service profile that is currently associated -with a flavor will return a ``Conflict 409`` with a response body -containing an in use message. - -Error response codes: 409,404,403,204,401 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - profile_id: profile_id - -List service profiles -===================== - -.. rest_method:: GET /v2.0/service_profiles - -Lists all service profiles visible to the project. - -The list can be empty. - -Standard query parameters are supported on the URI. - -Normal response codes: 200 - -Error response codes: 401 - -Request -------- - -Response Parameters -------------------- - -.. rest_parameters:: parameters.yaml - - - description: description - - driver: driver - - enabled: enabled - - metainfo: metainfo - - service_profiles: service_profiles - - id: id - -Response Example ----------------- - -.. literalinclude:: samples/flavors/service-profiles-list-response.json - :language: javascript - -Create service profile -====================== - -.. rest_method:: POST /v2.0/service_profiles - -Creates a service profile. - -This operation establishes a new service profile that can be -associated with one or more flavors. - -Either metadata or a driver is required. - -If a driver is specified but does not exist, call will return a -``Not found 404`` error with the response body explaining that the -driver could not be found. - -Creation currently limited to administrators. Other users will -receive a ``Forbidden 403`` response code with a response body -NeutronError message expressing that creation is disallowed by -policy. - -If the API cannot fulfill the request due to insufficient data or -data that is not valid, the service returns the HTTP ``Bad Request -(400)`` response code with information about the failure in the -response body. Validation errors require that you correct the error -and submit the request again. - -Error response codes: 201,403,401,400 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - service_profile: service_profile - - enabled: enabled - - driver: driver - - description: description - - metainfo: metainfo - -Request Example ---------------- - -.. literalinclude:: samples/flavors/service-profile-create-request.json - :language: javascript - -Response Parameters -------------------- - -.. rest_parameters:: parameters.yaml - - - description: description - - driver: driver - - enabled: enabled - - metainfo: metainfo - - service_profile: service_profile - - id: id +Users can check if flavor available by performing a GET on the +/v2.0/extensions/flavors. If it is unavailable,there is an 404 error +response (itemNotFound). +Refer `Networking extensions `_ for more details. +for more information List flavors ============ @@ -240,15 +23,17 @@ Lists all flavors visible to the project. The list can be empty. -Standard query parameters are supported on the URI. For example, -``fields`` can be used to limit the returned response to just name -by appending ``?fields=name``. If Neutron configuration supports -pagination by overriding allow_pagination = false, the ``marker`` -query parameter can set the last element id the client has seen and -``limit`` set the maximum number of items to return. if Neutron -configuration has allow_sorting = true, ``sort_key`` and -``sort_dir`` pairs can be used where sort direction is 'asc' or -'desc'. +Standard query parameters are supported on the URI. Use the ``fields`` +query parameter to control which fields are returned in the response body. +Additionally, you can filter results by using query string parameters. +For information, see `Filtering and Column Selection +`__. If Neutron configuration supports +pagination by overriding allow_pagination = false, the ``marker`` query +parameter can set the last element id the client has seen and ``limit`` +set the maximum number of items to return. if Neutron configuration has +allow_sorting = true, ``sort_key`` and ``sort_dir`` pairs can be used +where sort direction is 'asc' or 'desc'. Normal response codes: 200 @@ -257,18 +42,22 @@ Error response codes: 401 Request ------- +.. rest_parameters:: parameters.yaml + + - fields: fields + Response Parameters ------------------- .. rest_parameters:: parameters.yaml - flavors: flavors - - description: description - - enabled: enabled - - service_profiles: service_profiles - - service_type: service_type - - id: id - - name: name + - id: flavor-id + - service_type: flavor-service_type + - name: flavor-name + - description: flavor-description + - enabled: flavor-enabled + - service_profiles: flavor-service_profiles Response Example ---------------- @@ -310,18 +99,20 @@ data that is not valid, the service returns the HTTP ``Bad Request response body. Validation errors require that you correct the error and submit the request again. -Error response codes: 201,403,401,400 +Normal response codes: 201 + +Error response codes: 404, 403, 401, 400 Request ------- .. rest_parameters:: parameters.yaml - - service_type: service_type - flavor: flavor - - enabled: enabled - - description: description - - name: name + - service_type: flavor-service_type + - enabled: flavor-enabled-request + - description: flavor-description-request + - name: flavor-name-request Request Example --------------- @@ -334,49 +125,13 @@ Response Parameters .. rest_parameters:: parameters.yaml - - description: description - - enabled: enabled - - service_profiles: service_profiles - - service_type: service_type - flavor: flavor - - id: id - - name: name - -Associate flavor -================ - -.. rest_method:: POST /v2.0/flavors/{flavor_id}/service_profiles - -Associate a flavor with a service profile. - -A flavor can be associated with more than one profile. - -Will return ``409 Conflict`` if association already exists. - -Error response codes: 201,404,403,401,400,409 - -Request -------- - -.. rest_parameters:: parameters.yaml - - - service_profile: service_profile - - id: id - - flavor_id: flavor_id - -Request Example ---------------- - -.. literalinclude:: samples/flavors/flavor-associate-request.json - :language: javascript - -Response Parameters -------------------- - -.. rest_parameters:: parameters.yaml - - - service_profile: service_profile - - id: id + - id: flavor-id + - service_type: flavor-service_type + - name: flavor-name + - description: flavor-description + - enabled: flavor-enabled + - service_profiles: flavor-service_profiles Show flavor details =================== @@ -385,8 +140,9 @@ Show flavor details Shows details for a flavor. -This operation returns a flavor object by ID. If the flavor object is not -visible by policy, the service returns the HTTP ``Forbidden (403)`` +This operation returns a flavor object by ID. If you are not an +administrative user and the flavor object is not visible to your +project account, the service returns the HTTP ``Forbidden (403)`` response code. Normal response codes: 200 @@ -405,13 +161,13 @@ Response Parameters .. rest_parameters:: parameters.yaml - - description: description - - enabled: enabled - - service_profiles: service_profiles - - service_type: service_type - flavor: flavor - - id: id - - name: name + - id: flavor-id + - service_type: flavor-service_type + - name: flavor-name + - description: flavor-description + - enabled: flavor-enabled + - service_profiles: flavor-service_profiles Response Example ---------------- @@ -438,11 +194,11 @@ Request .. rest_parameters:: parameters.yaml - - flavor: flavor - - enabled: enabled - - description: description - - name: name - flavor_id: flavor_id + - flavor: flavor + - name: flavor-name-request + - description: flavor-description-request + - enabled: flavor-enabled-request Request Example --------------- @@ -455,13 +211,13 @@ Response Parameters .. rest_parameters:: parameters.yaml - - description: description - - enabled: enabled - - service_profiles: service_profiles - - service_type: service_type - flavor: flavor - - id: id - - name: name + - id: flavor-id + - service_type: flavor-service_type + - name: flavor-name + - description: flavor-description + - enabled: flavor-enabled + - service_profiles: flavor-service_profiles Response Example ---------------- @@ -476,7 +232,9 @@ Delete flavor Deletes a flavor. -Error response codes: 404,403,204,401 +Normal response codes: 204 + +Error response codes: 404,403,401 Request ------- @@ -485,3 +243,289 @@ Request - flavor_id: flavor_id +Response +-------- + +No body content is returned on a successful DELETE. + +Associate flavor with a service profile +======================================= + +.. rest_method:: POST /v2.0/flavors/{flavor_id}/service_profiles + +Associate a flavor with a service profile. + +A flavor can be associated with more than one profile. + +Will return ``409 Conflict`` if association already exists. + +Normal response codes: 201 + +Error response codes: 404,403,401,400,409 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - flavor_id: flavor_id + - service_profile: service_profile + - id: service_profile-id + + +Request Example +--------------- + +.. literalinclude:: samples/flavors/flavor-associate-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - service_profile: service_profile + - id: id + +Disassociate a flavor. +====================== + +.. rest_method:: DELETE /v2.0/flavors/{flavor_id}/service_profiles/{profile_id} + +Disassociate a flavor from a service profile. + +Normal response codes: 204 + +Error response codes: 404,403,401 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - profile_id: profile_id + - flavor_id: flavor_id + +Response +-------- + +No body content is returned on a successful disassociation. + +List service profiles +===================== + +.. rest_method:: GET /v2.0/service_profiles + +Lists all service profiles visible for the tenant account. + +The list can be empty. + +Standard query parameters are supported on the URI. + +Normal response codes: 200 + +Error response codes: 401 + +Request +------- + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - service_profiles: service_profiles + - id: service_profile-id + - enabled: service_profile-enabled + - driver: service_profile-driver + - description: service_profile-description + - metainfo: service_profile-metainfo + +Response Example +---------------- + +.. literalinclude:: samples/flavors/service-profiles-list-response.json + :language: javascript + +Create service profile +====================== + +.. rest_method:: POST /v2.0/service_profiles + +Creates a service profile. + +This operation establishes a new service profile that can be +associated with one or more flavors. + +Either metadata or a driver is required. + +If a driver is specified but does not exist, call will return a +``Not found 404`` error with the response body explaining that the +driver could not be found. + +Creation currently limited to administrators. Other users will +receive a ``Forbidden 403`` response code with a response body +NeutronError message expressing that creation is disallowed by +policy. + +If the API cannot fulfill the request due to insufficient data or +data that is not valid, the service returns the HTTP ``Bad Request +(400)`` response code with information about the failure in the +response body. Validation errors require that you correct the error +and submit the request again. + +Normal response codes: 201 + +Error response codes: 404, 403, 401, 400 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - service_profile: service_profile + - description: service_profile-description-request + - metainfo: service_profile-metainfo-request + - enabled: service_profile-enabled-request + - driver: service_profile-driver-request + +Request Example +--------------- + +.. literalinclude:: samples/flavors/service-profile-create-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - service_profile: service_profile + - id: service_profile-id + - enabled: service_profile-enabled + - driver: service_profile-driver + - description: service_profile-description + - metainfo: service_profile-metainfo + +Response Example +---------------- + +.. literalinclude:: samples/flavors/service-profile-create-response.json + :language: javascript + +Show service profile details +============================ + +.. rest_method:: GET /v2.0/service_profiles/{profile_id} + +Shows details for a service profile. + +This operation returns a service profile object by ID. If you are +not an administrative user and the object is not visible to your +tenant account, the service returns the HTTP ``Forbidden (403)`` +response code. + +Normal response codes: 200 + +Error response codes: 404, 403, 401 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - profile_id: profile_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - service_profile: service_profile + - id: service_profile-id + - enabled: service_profile-enabled + - driver: service_profile-driver + - description: service_profile-description + - metainfo: service_profile-metainfo + +Response Example +---------------- + +.. literalinclude:: samples/flavors/service-profile-show-response.json + :language: javascript + +Update service profile +====================== + +.. rest_method:: PUT /v2.0/service_profiles/{profile_id} + +Updates a service profile. + +Normal response codes: 200 + +Error response codes: 404, 403, 401, 400 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - profile_id: profile_id + - service_profile: service_profile + - enabled: service_profile-enabled-request + - driver: service_profile-driver-request + - description: service_profile-description-request + - metainfo: service_profile-metainfo-request + +Request Example +--------------- + +.. literalinclude:: samples/flavors/service-profile-update-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - service_profile: service_profile + - id: service_profile-id + - enabled: service_profile-enabled + - driver: service_profile-driver + - description: service_profile-description + - metainfo: service_profile-metainfo + +Response Example +---------------- + +.. literalinclude:: samples/flavors/service-profile-update-response.json + :language: javascript + +Delete service profile +====================== + +.. rest_method:: DELETE /v2.0/service_profiles/{profile_id} + +Deletes a service profile. + +Attempting to delete a service profile that is currently associated +with a flavor will return a ``Conflict 409`` with a response body +containing an in use message. + +Either metadata or a driver is required. + +Normal response codes: 204 + +Error response codes: 409,404,403,401 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - profile_id: profile_id + +Response +-------- + +No body content is returned on a successful DELETE. diff --git a/api-ref/source/v2/parameters.yaml b/api-ref/source/v2/parameters.yaml index a9345eea8..7267cf646 100644 --- a/api-ref/source/v2/parameters.yaml +++ b/api-ref/source/v2/parameters.yaml @@ -41,7 +41,7 @@ flavor_id: description: | The UUID of the flavor. in: path - required: false + required: true type: string floatingip_id: description: | @@ -147,9 +147,9 @@ port_id_3: type: string profile_id: description: | - The UUID of the profile. + The UUID of the service profile. in: path - required: false + required: true type: string project_id: description: | @@ -1525,6 +1525,36 @@ flavor: in: body required: true type: object +flavor-description: + description: | + The human-readable description for the flavor. + in: body + required: true + type: string +flavor-description-request: + description: | + The human-readable description for the flavor. + in: body + required: false + type: string +flavor-enabled: + description: | + Indicates whether the flavor is enabled or not. Default is true. + in: body + required: true + type: boolean +flavor-enabled-request: + description: | + Indicates whether the flavor is enabled or not. Default is true. + in: body + required: false + type: boolean +flavor-id: + description: | + The ID of the flavor. + in: body + required: true + type: string flavor-id-request: description: | The ID of the flavor. @@ -1537,6 +1567,36 @@ flavor-id-response: in: body required: true type: string +flavor-name: + description: | + Name of the flavor. + in: body + required: true + type: string +flavor-name-request: + description: | + Name of the flavor. + in: body + required: false + type: string +flavor-service_profiles: + description: | + Service profile UUIDs associated with this flavor. + in: body + required: true + type: array +flavor-service_profiles-request: + description: | + Service profile UUIDs associated with this flavor. + in: body + required: false + type: array +flavor-service_type: + description: | + Service type for the flavor. Example: LOADBALANCERV2. + in: body + required: true + type: string flavor_1: description: | The UUID of a flavor. @@ -1761,12 +1821,6 @@ id_26: in: body required: true type: string -id_28: - description: | - The UUID of the service profile. - in: body - required: true - type: string id_3: description: | The UUID of the QoS policy rule. @@ -3616,6 +3670,64 @@ service_profile: in: body required: true type: object +service_profile-description: + description: | + The human-readable description for the service profile. + in: body + required: true + type: string +service_profile-description-request: + description: | + The human-readable description for the service profile. + in: body + required: false + type: string +service_profile-driver: + description: | + Provider driver to use for this profile. Example: + ``neutron_lbaas.drivers.octavia.driver.OctaviaDriver`` + in: body + required: true + type: string +service_profile-driver-request: + description: | + Provider driver to use for this profile. Example: + ``neutron_lbaas.drivers.octavia.driver.OctaviaDriver`` + in: body + required: false + type: string +service_profile-enabled: + description: | + Indicates whether this service profile is enabled or not. + Default is ``true``. + in: body + required: true + type: boolean +service_profile-enabled-request: + description: | + Indicates whether this service profile is enabled or not. + Default is ``true``. + in: body + required: false + type: boolean +service_profile-id: + description: | + The UUID of the service profile. + in: body + required: true + type: string +service_profile-metainfo: + description: | + JSON-formatted meta information of the service profile. + in: body + required: true + type: string +service_profile-metainfo-request: + description: | + JSON-formatted meta information of the service profile. + in: body + required: false + type: string service_profiles: description: | Service profile UUIDs associated with this diff --git a/api-ref/source/v2/samples/flavors/service-profiles-list-response.json b/api-ref/source/v2/samples/flavors/service-profiles-list-response.json index e05cfbe1f..0bb691511 100644 --- a/api-ref/source/v2/samples/flavors/service-profiles-list-response.json +++ b/api-ref/source/v2/samples/flavors/service-profiles-list-response.json @@ -5,14 +5,14 @@ "enabled": true, "driver": "neutron_lbaas.drivers.octavia.driver.OctaviaDriver", "description": "", - "metainfo": "" + "metainfo": "{}" }, { "id": "684322c5-703a-48a2-8138-34b99942a7ef", "enabled": true, "driver": "neutron_lbaas.drivers.octavia.driver.OctaviaDriver", "description": "", - "metainfo": "" + "metainfo": "{}" } ] }