From ba19bd4b60f1f8a50b62fafc900781b658f2c587 Mon Sep 17 00:00:00 2001 From: Hieu LE Date: Thu, 25 Aug 2016 16:08:59 +0700 Subject: [PATCH] Create certificates api reference Add details for certificates API of Magnum. Change-Id: Iabf72dc4387d086d2d9b25963a0413ccf2372514 Implements: blueprint magnum-doc-rest-api --- api-ref/source/certificates.inc | 100 ++++++++++++++++++ api-ref/source/parameters.yaml | 26 ++++- .../samples/certificates-ca-show-resp.json | 14 +++ .../samples/certificates-ca-sign-req.json | 4 + .../samples/certificates-ca-sign-resp.json | 15 +++ 5 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 api-ref/source/samples/certificates-ca-show-resp.json create mode 100644 api-ref/source/samples/certificates-ca-sign-req.json create mode 100644 api-ref/source/samples/certificates-ca-sign-resp.json diff --git a/api-ref/source/certificates.inc b/api-ref/source/certificates.inc index e69de29bb2..9eb89acd2a 100644 --- a/api-ref/source/certificates.inc +++ b/api-ref/source/certificates.inc @@ -0,0 +1,100 @@ +.. -*- rst -*- + +===================================== + Manage certificates for bay/cluster +===================================== + +Generates and show CA certificates for bay/cluster. + +Show details about the CA certificate for a bay/cluster +======================================================= + +.. rest_method:: GET /v1/certificates/{bay_uuid/cluster_uuid} + +Show CA certificate details that are associated with the created bay/cluster. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bay_uuid: bay_cluster_id + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - X-Openstack-Request-Id: request_id + - pem: pem + - bay_uuid: bay_cluster_id + - links: links + +Response Example +---------------- + +.. literalinclude:: samples/certificates-ca-show-resp.json + :language: javascript + +Generate the CA certificate for a bay/cluster +============================================= + +.. rest_method:: POST /v1/certificates/ + +Sign client key and generate the CA certificate for a bay/cluster + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - bay_uuid: bay_cluster_id + - csr: csr + +Request Example +---------------- + +.. literalinclude:: samples/certificates-ca-sign-req.json + :language: javascript + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - X-Openstack-Request-Id: request_id + - pem: pem + - bay_uuid: bay_cluster_id + - links: links + - csr: csr + +Response Example +---------------- + +.. literalinclude:: samples/certificates-ca-sign-resp.json + :language: javascript diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 6a81903a44..8f0d23cebb 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -5,6 +5,12 @@ request_id: description: | A unique ID for tracking service request. The request ID associated with the request by default appears in the service logs. +bay_cluster_id: + type: UUID + in: body + required: true + description: | + The UUID of the bay/cluster. binary: type: string in: body @@ -29,6 +35,15 @@ created_at: in: body required: true type: string +csr: + description: | + Certificate Signing Request (CSR) for authenticating client key. + + The CSR will be used by Magnum to generate a signed certificate + that client will use to communicate with the Bay/Cluster. + in: body + required: true + type: string description: description: | Descriptive text about the Magnum service. @@ -56,10 +71,7 @@ id_s: type: string links: description: | - Links to the resources in question. See `API Guide / Links and - References - `_ - for more info. + Links to the resources in question. in: body required: true type: array @@ -75,6 +87,12 @@ name: in: body required: true type: string +pem: + description: | + CA certificate for the bay/cluster. + in: body + required: true + type: string report_count: description: | The total number of report. diff --git a/api-ref/source/samples/certificates-ca-show-resp.json b/api-ref/source/samples/certificates-ca-show-resp.json new file mode 100644 index 0000000000..409846dbcb --- /dev/null +++ b/api-ref/source/samples/certificates-ca-show-resp.json @@ -0,0 +1,14 @@ +{ + "pem":"-----BEGIN CERTIFICATE-----\nMIICzDCCAbSgAwIBAgIQOOkVcEN7TNa9E80GoUs4xDANBgkqhkiG9w0BAQsFADAO\n-----END CERTIFICATE-----\n", + "bay_uuid":"0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "links":[ + { + "href":"http://10.164.180.104:9511/v1/certificates/0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "rel":"self" + }, + { + "href":"http://10.164.180.104:9511/certificates/0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "rel":"bookmark" + } + ] +} \ No newline at end of file diff --git a/api-ref/source/samples/certificates-ca-sign-req.json b/api-ref/source/samples/certificates-ca-sign-req.json new file mode 100644 index 0000000000..b2ff96c22c --- /dev/null +++ b/api-ref/source/samples/certificates-ca-sign-req.json @@ -0,0 +1,4 @@ +{ + "bay_uuid":"0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "csr":"-----BEGIN CERTIFICATE REQUEST-----\nMIIEfzCCAmcCAQAwFDESMBAGA1UEAxMJWW91ciBOYW1lMIICIjANBgkqhkiG9w0B\n-----END CERTIFICATE REQUEST-----\n" +} \ No newline at end of file diff --git a/api-ref/source/samples/certificates-ca-sign-resp.json b/api-ref/source/samples/certificates-ca-sign-resp.json new file mode 100644 index 0000000000..9858da7e2d --- /dev/null +++ b/api-ref/source/samples/certificates-ca-sign-resp.json @@ -0,0 +1,15 @@ +{ + "pem":"-----BEGIN CERTIFICATE-----\nMIIDxDCCAqygAwIBAgIRALgUbIjdKUy8lqErJmCxVfkwDQYJKoZIhvcNAQELBQAw\n-----END CERTIFICATE-----\n", + "bay_uuid":"0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "links":[ + { + "href":"http://10.164.180.104:9511/v1/certificates/0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "rel":"self" + }, + { + "href":"http://10.164.180.104:9511/certificates/0b4b766f-1500-44b3-9804-5a6e12fe6df4", + "rel":"bookmark" + } + ], + "csr":"-----BEGIN CERTIFICATE REQUEST-----\nMIIEfzCCAmcCAQAwFDESMBAGA1UEAxMJWW91ciBOYW1lMIICIjANBgkqhkiG9w0B\n-----END CERTIFICATE REQUEST-----\n" +} \ No newline at end of file