コード例 #1
0
 def test_update_of_existing_secret_updates_secret(self):
     with self.ExistingSecretTestFixture() as existing_secret:
         secret = AwsSecret(name=existing_secret.secret_id)
         secret.update(value='{"foo":"bar"}')
         self.assertEqual(
             self.secrets_mgr.get_secret_value(
                 SecretId=existing_secret.arn)['SecretString'],
             '{"foo":"bar"}')
コード例 #2
0
ファイル: app.py プロジェクト: mweiden/logs
"""
This AWS Lambda function allowed to delete the old Elasticsearch index
"""

import boto3
import json
import logging
import os

from dcplib.aws_secret import AwsSecret

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

config = json.loads(
    AwsSecret('logs/_/log_retention_policy_enforcer.json').value)

logs_client = boto3.client('logs')


class LogRetentionPolicyEnforcer:
    def __init__(self, client, ttls=dict(), prefix=None, default_days=1827):
        self.client = client
        self.ttls = ttls
        # users can set these by hand
        self.prefix = prefix
        self.default_days = default_days

    @staticmethod
    def from_ttl_file(client, filename):
        ttls = dict()
コード例 #3
0
import json
from dcplib.aws_secret import AwsSecret

config = json.loads(AwsSecret('logs/_/firehose_to_es_processor.json').value)