~ubuntu-branches/ubuntu/saucy/python-novaclient/saucy

« back to all changes in this revision

Viewing changes to novaclient/v1_1/certs.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-03 10:46:49 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20120203104649-3604yixrglbsoi0g
Tags: 2012.1~e4~20120203.484-0ubuntu1
New upstream release. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2010 Jacob Kaplan-Moss
 
2
 
 
3
# Copyright 2011 OpenStack LLC.
 
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
"""
 
19
Certificate interface.
 
20
"""
 
21
 
 
22
from novaclient import base
 
23
 
 
24
 
 
25
class 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
 
 
32
class CertificateManager(base.ManagerWithFind):
 
33
    """
 
34
    Manage :class:`Certificate` resources.
 
35
    """
 
36
    resource_class = Certificate
 
37
 
 
38
    def create(self):
 
39
        """
 
40
        Create a x509 certificates 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')