<commit_before>"""
    SoftLayer.ssl
    ~~~~~~~~~~~~~
    SSL Manager/helpers

    :license: MIT, see LICENSE for more details.
"""


class SSLManager(object):
    """Manages SSL certificates in SoftLayer.

    See product information here: http://www.softlayer.com/ssl-certificates

    Example::

       # Initialize the Manager.
       # env variables. These can also be specified in ~/.softlayer,
       # or passed directly to SoftLayer.Client()
       # SL_USERNAME = YOUR_USERNAME
       # SL_API_KEY = YOUR_API_KEY
       import SoftLayer
       client = SoftLayer.Client()
       mgr = SoftLayer.SSLManager(client)

    :param SoftLayer.API.BaseClient client: the client instance

    """

    def __init__(self, client):
        self.client = client
        self.ssl = self.client['Security_Certificate']

    def list_certs(self, method='all'):
        """List all certificates.

        :param string method: The type of certificates to list. Options are
                              'all', 'expired', and 'valid'.
        :returns: A list of dictionaries representing the requested SSL certs.

        Example::

            # Get all valid SSL certs
            certs = mgr.list_certs(method='valid')
            print certs

        """
        ssl = self.client['Account']
        methods = {
            'all': 'getSecurityCertificates',
            'expired': 'getExpiredSecurityCertificates',
            'valid': 'getValidSecurityCertificates'
        }

        mask = "mask[id, commonName, validityDays, notes]"
        func = getattr(ssl, methods[method])
        return func(mask=mask)

    def add_certificate(self, certificate):
        """Creates a new certificate.

        :param dict certificate: A dictionary representing the parts of the
                                 certificate.
                                 See developer.softlayer.com for more info.

        Example::

            cert = ??
            result = mgr.add_certificate(certificate=cert)

        """
        return self.ssl.createObject(certificate)

    def remove_certificate(self, cert_id):
        """Removes a certificate.

        :param integer cert_id: a certificate ID to remove

        Example::

            # Removes certificate with id 1234
            result = mgr.remove_certificate(cert_id = 1234)<commit_msg>replace developer links with sldn links<commit_after>"""
    SoftLayer.ssl
    ~~~~~~~~~~~~~
    SSL Manager/helpers

    :license: MIT, see LICENSE for more details.
"""


class SSLManager(object):
    """Manages SSL certificates in SoftLayer.

    See product information here: http://www.softlayer.com/ssl-certificates

    Example::

       # Initialize the Manager.
       # env variables. These can also be specified in ~/.softlayer,
       # or passed directly to SoftLayer.Client()
       # SL_USERNAME = YOUR_USERNAME
       # SL_API_KEY = YOUR_API_KEY
       import SoftLayer
       client = SoftLayer.Client()
       mgr = SoftLayer.SSLManager(client)

    :param SoftLayer.API.BaseClient client: the client instance

    """

    def __init__(self, client):
        self.client = client
        self.ssl = self.client['Security_Certificate']

    def list_certs(self, method='all'):
        """List all certificates.

        :param string method: The type of certificates to list. Options are
                              'all', 'expired', and 'valid'.
        :returns: A list of dictionaries representing the requested SSL certs.

        Example::

            # Get all valid SSL certs
            certs = mgr.list_certs(method='valid')
            print certs

        """
        ssl = self.client['Account']
        methods = {
            'all': 'getSecurityCertificates',
            'expired': 'getExpiredSecurityCertificates',
            'valid': 'getValidSecurityCertificates'
        }

        mask = "mask[id, commonName, validityDays, notes]"
        func = getattr(ssl, methods[method])
        return func(mask=mask)

    def add_certificate(self, certificate):
        """Creates a new certificate.

        :param dict certificate: A dictionary representing the parts of the
                                 certificate.
                                 See sldn.softlayer.com for more info.

        Example::

            cert = ??
            result = mgr.add_certificate(certificate=cert)

        """
        return self.ssl.createObject(certificate)

    def remove_certificate(self, cert_id):
        """Removes a certificate.

        :param integer cert_id: a certificate ID to remove

        Example::

            # Removes certificate with id 1234
            result = mgr.remove_certificate(cert_id = 1234)
{'fraction_non_alphanumeric': 0.09383663894220516, 'fraction_numerical': 0.0034122414160801876, 'mean_word_length': 2.07742782152231, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4118123', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1188, 'n_words': 356}