blob: 822756c78210dde8a0267e3fc8bd713ca9ec04f6 [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# Copyright 2013 IBM Corp
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from oslo_serialization import jsonutils as json
17
18from tempest.lib.api_schema.response.compute.v2_1 import certificates as schema
19from tempest.lib.common import rest_client
Ghanshyamee9af302016-02-25 06:12:43 +090020from tempest.lib.services.compute import base_compute_client
Matthew Treinish9e26ca82016-02-23 11:43:20 -050021
22
Ghanshyamee9af302016-02-25 06:12:43 +090023class CertificatesClient(base_compute_client.BaseComputeClient):
Matthew Treinish9e26ca82016-02-23 11:43:20 -050024
25 def show_certificate(self, certificate_id):
26 url = "os-certificates/%s" % certificate_id
27 resp, body = self.get(url)
28 body = json.loads(body)
29 self.validate_response(schema.get_certificate, resp, body)
30 return rest_client.ResponseBody(resp, body)
31
32 def create_certificate(self):
33 """Create a certificate."""
34 url = "os-certificates"
35 resp, body = self.post(url, None)
36 body = json.loads(body)
37 self.validate_response(schema.create_certificate, resp, body)
38 return rest_client.ResponseBody(resp, body)