summaryrefslogtreecommitdiff
path: root/novaclient/v2/certs.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/certs.py')
-rw-r--r--novaclient/v2/certs.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/novaclient/v2/certs.py b/novaclient/v2/certs.py
new file mode 100644
index 0000000..2c3006c
--- /dev/null
+++ b/novaclient/v2/certs.py
@@ -0,0 +1,48 @@
1# Copyright 2010 Jacob Kaplan-Moss
2
3# Copyright 2011 OpenStack Foundation
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18"""
19Certificate interface.
20"""
21
22from novaclient import base
23
24
25class Certificate(base.Resource):
26 def __repr__(self):
27 return ("<Certificate: private_key=[%s bytes] data=[%s bytes]>" %
28 (len(self.private_key) if self.private_key else 0,
29 len(self.data)))
30
31
32class CertificateManager(base.Manager):
33 """
34 Manage :class:`Certificate` resources.
35 """
36 resource_class = Certificate
37
38 def create(self):
39 """
40 Create a x509 certificate for a user in tenant.
41 """
42 return self._create('/os-certificates', {}, 'certificate')
43
44 def get(self):
45 """
46 Get root certificate.
47 """
48 return self._get("/os-certificates/root", 'certificate')