OpenStack Compute (Nova) Client
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

certs.py 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2010 Jacob Kaplan-Moss
  2. # Copyright 2011 OpenStack Foundation
  3. # All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. # not use this file except in compliance with the License. You may obtain
  7. # a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. # License for the specific language governing permissions and limitations
  15. # under the License.
  16. """
  17. Certificate interface.
  18. """
  19. from novaclient import base
  20. class Certificate(base.Resource):
  21. def __repr__(self):
  22. return "<Certificate: private_key=[%s bytes] data=[%s bytes]>" % \
  23. (len(self.private_key) if self.private_key else 0,
  24. len(self.data))
  25. class CertificateManager(base.ManagerWithFind):
  26. """
  27. Manage :class:`Certificate` resources.
  28. """
  29. resource_class = Certificate
  30. def create(self):
  31. """
  32. Create a x509 certificates for a user in tenant.
  33. """
  34. return self._create('/os-certificates', {}, 'certificate')
  35. def get(self):
  36. """
  37. Get root certificate.
  38. """
  39. return self._get("/os-certificates/root", 'certificate')