def __init__(self): self.config = common.get_config() self.region_name = self.config("secret_manager_ssm_region", namespace="cis", default="us-west-2") self.boto_session = boto3.session.Session(region_name=self.region_name) self.ssm_client = self.boto_session.client("ssm")
def __init__(self, event): """[summary] Arguments: object {[type]} -- [an instance of the event class.] event {[type]} -- [the event as ingested from the kinesis stream.] subscriptions {[type]} -- [list of urls to post notifications to.] """ self.config = common.get_config() self.event = event self.secret_manager = secret.Manager() self.access_token = None
def handle(event, context): logger = setup_logging() config = common.get_config() event_mapper = cis_event.Event(event=None) results = [] for record in event.get("Records"): event_mapper.event = record notification = event_mapper.to_notification() result = event_mapper.send(notification) results.append(result) logger.info("The results of the operation is: {}".format(results)) return results
def handle(event, context): logger = setup_logging() config = common.get_config() # Subscriptions is a comma delimited string of publishers who would like to recieve notifications. subscriptions = config( "subscriptions", namespace="cis", default="https://dinopark.k8s.sso.allizom.org/beta/") results = [] for record in event.get("Records"): event_mapper = cis_event.Event(record, subscriptions) notification = event_mapper.to_notification() result = event_mapper.send(notification) results.append(result) logger.info("The results of the operation is: {}".format(results)) return results