Active S3 destination plugin (#433)
* Activate the AWS S3 destination plugin Add the AWS S3 destination plugin to the list of available Lemur plugins. Update the S3 destination plugin's "accountNumber" option to be of type 'str' to handle account numbers starting with zeros. Update Lemur's utils for parsing certificates to correctly encode the X509 certificates before loading for python3. * Add S3 destination plugin test Added simple test to verify S3 destination plugin is available.
This commit is contained in:
parent
3ad7a37f95
commit
5cbf5365c5
|
@ -40,4 +40,4 @@ def parse_certificate(body):
|
||||||
if isinstance(body, bytes):
|
if isinstance(body, bytes):
|
||||||
return x509.load_pem_x509_certificate(body, default_backend())
|
return x509.load_pem_x509_certificate(body, default_backend())
|
||||||
return x509.load_pem_x509_certificate(bytes(body, 'utf8'), default_backend())
|
return x509.load_pem_x509_certificate(bytes(body, 'utf8'), default_backend())
|
||||||
return x509.load_pem_x509_certificate(str(body), default_backend())
|
return x509.load_pem_x509_certificate(body.encode('utf-8'), default_backend())
|
||||||
|
|
|
@ -210,7 +210,7 @@ class S3DestinationPlugin(DestinationPlugin):
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'accountNumber',
|
'name': 'accountNumber',
|
||||||
'type': 'int',
|
'type': 'str',
|
||||||
'required': True,
|
'required': True,
|
||||||
'validation': '/^[0-9]{12,12}$/',
|
'validation': '/^[0-9]{12,12}$/',
|
||||||
'helpMessage': 'A valid AWS account number with permission to access S3',
|
'helpMessage': 'A valid AWS account number with permission to access S3',
|
||||||
|
@ -257,7 +257,7 @@ class S3DestinationPlugin(DestinationPlugin):
|
||||||
super(S3DestinationPlugin, self).__init__(*args, **kwargs)
|
super(S3DestinationPlugin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def upload(self, name, body, private_key, cert_chain, options, **kwargs):
|
def upload(self, name, body, private_key, cert_chain, options, **kwargs):
|
||||||
account_number = self.get_option('accountId', options)
|
account_number = self.get_option('accountNumber', options)
|
||||||
encrypt = self.get_option('encrypt', options)
|
encrypt = self.get_option('encrypt', options)
|
||||||
bucket = self.get_option('bucket', options)
|
bucket = self.get_option('bucket', options)
|
||||||
key = self.get_option('key', options)
|
key = self.get_option('key', options)
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
def test_get_certificates(app):
|
||||||
|
from lemur.plugins.base import plugins
|
||||||
|
|
||||||
|
p = plugins.get('aws-s3')
|
||||||
|
assert p
|
1
setup.py
1
setup.py
|
@ -174,6 +174,7 @@ setup(
|
||||||
'acme_issuer = lemur.plugins.lemur_acme.plugin:ACMEIssuerPlugin',
|
'acme_issuer = lemur.plugins.lemur_acme.plugin:ACMEIssuerPlugin',
|
||||||
'aws_destination = lemur.plugins.lemur_aws.plugin:AWSDestinationPlugin',
|
'aws_destination = lemur.plugins.lemur_aws.plugin:AWSDestinationPlugin',
|
||||||
'aws_source = lemur.plugins.lemur_aws.plugin:AWSSourcePlugin',
|
'aws_source = lemur.plugins.lemur_aws.plugin:AWSSourcePlugin',
|
||||||
|
'aws_s3 = lemur.plugins.lemur_aws.plugin:S3DestinationPlugin',
|
||||||
'email_notification = lemur.plugins.lemur_email.plugin:EmailNotificationPlugin',
|
'email_notification = lemur.plugins.lemur_email.plugin:EmailNotificationPlugin',
|
||||||
'slack_notification = lemur.plugins.lemur_slack.plugin:SlackNotificationPlugin',
|
'slack_notification = lemur.plugins.lemur_slack.plugin:SlackNotificationPlugin',
|
||||||
'java_truststore_export = lemur.plugins.lemur_java.plugin:JavaTruststoreExportPlugin',
|
'java_truststore_export = lemur.plugins.lemur_java.plugin:JavaTruststoreExportPlugin',
|
||||||
|
|
Loading…
Reference in New Issue