import abc

import six


@six.add_metaclass(abc.ABCMeta)
class CertGenerator(object):
    """Base Cert Generator Interface

    A Certificate Generator is responsible for signing TLS certificates.
    """

    @abc.abstractmethod
    def sign_cert(self, csr, validity):
        """Generates a signed certificate from the provided CSR

        This call is designed to block until a signed certificate can be
        returned.

        :param csr: A Certificate Signing Request
        :param validity: Valid for <validity> seconds from the current time

        :return: Signed certificate
        :raises Exception: If certificate signing fails
        """
        pass

import abc

import six


@six.add_metaclass(abc.ABCMeta)
class CertGenerator(object):
    """Base Cert Generator Interface

    A Certificate Generator is responsible for generating private keys,
    generating CSRs, and signing TLS certificates.
    """

    @abc.abstractmethod
    def sign_cert(self, csr, validity):
        """Generates a signed certificate from the provided CSR

        This call is designed to block until a signed certificate can be
        returned.

        :param csr: A Certificate Signing Request
        :param validity: Valid for <validity> seconds from the current time

        :return: PEM Encoded Signed certificate
        :raises Exception: If certificate signing fails
        """
        pass

    @abc.abstractmethod
    def generate_cert_key_pair(self, cn, validity, bit_length, passphrase):
        """Generates a private key and certificate pair

        :param cn: Common name to use for the Certificate
        :param validity: Validity period for the Certificate
        :param bit_length: Private key bit length
        :param passphrase: Passphrase to use for encrypting the private key

        :return: octavia.certificates.common.Cert representation of the
                 certificate data
        :raises Exception: If generation fails
        """
        pass

Add Cert+PK generation to Certificate Interface
Add Cert+PK generation to Certificate Interface

Change-Id: I82aa573c7db13c7a491b18540379b234c1023eb9

  import abc
  
  import six
  
  
  @six.add_metaclass(abc.ABCMeta)
  class CertGenerator(object):
      """Base Cert Generator Interface
  
-     A Certificate Generator is responsible for signing TLS certificates.
+     A Certificate Generator is responsible for generating private keys,
+     generating CSRs, and signing TLS certificates.
      """
  
      @abc.abstractmethod
      def sign_cert(self, csr, validity):
          """Generates a signed certificate from the provided CSR
  
          This call is designed to block until a signed certificate can be
          returned.
  
          :param csr: A Certificate Signing Request
          :param validity: Valid for <validity> seconds from the current time
  
-         :return: Signed certificate
+         :return: PEM Encoded Signed certificate
          :raises Exception: If certificate signing fails
          """
          pass
  
+     @abc.abstractmethod
+     def generate_cert_key_pair(self, cn, validity, bit_length, passphrase):
+         """Generates a private key and certificate pair
+ 
+         :param cn: Common name to use for the Certificate
+         :param validity: Validity period for the Certificate
+         :param bit_length: Private key bit length
+         :param passphrase: Passphrase to use for encrypting the private key
+ 
+         :return: octavia.certificates.common.Cert representation of the
+                  certificate data
+         :raises Exception: If generation fails
+         """
+         pass
+ 
Add Cert+PK generation to Certificate Interface
## Code Before:
import abc

import six


@six.add_metaclass(abc.ABCMeta)
class CertGenerator(object):
    """Base Cert Generator Interface

    A Certificate Generator is responsible for signing TLS certificates.
    """

    @abc.abstractmethod
    def sign_cert(self, csr, validity):
        """Generates a signed certificate from the provided CSR

        This call is designed to block until a signed certificate can be
        returned.

        :param csr: A Certificate Signing Request
        :param validity: Valid for <validity> seconds from the current time

        :return: Signed certificate
        :raises Exception: If certificate signing fails
        """
        pass

## Instruction:
Add Cert+PK generation to Certificate Interface
## Code After:
import abc

import six


@six.add_metaclass(abc.ABCMeta)
class CertGenerator(object):
    """Base Cert Generator Interface

    A Certificate Generator is responsible for generating private keys,
    generating CSRs, and signing TLS certificates.
    """

    @abc.abstractmethod
    def sign_cert(self, csr, validity):
        """Generates a signed certificate from the provided CSR

        This call is designed to block until a signed certificate can be
        returned.

        :param csr: A Certificate Signing Request
        :param validity: Valid for <validity> seconds from the current time

        :return: PEM Encoded Signed certificate
        :raises Exception: If certificate signing fails
        """
        pass

    @abc.abstractmethod
    def generate_cert_key_pair(self, cn, validity, bit_length, passphrase):
        """Generates a private key and certificate pair

        :param cn: Common name to use for the Certificate
        :param validity: Validity period for the Certificate
        :param bit_length: Private key bit length
        :param passphrase: Passphrase to use for encrypting the private key

        :return: octavia.certificates.common.Cert representation of the
                 certificate data
        :raises Exception: If generation fails
        """
        pass
