def create_event_type()

in frauddetector/frauddetector.py [0:0]


    def create_event_type(self, variables, labels):
        """Create Amazon FraudDetector event. Wraps the boto3 SDK API to allow bulk operations.
        https://docs.aws.amazon.com/frauddetector/latest/ug/create-event-type.html
        https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/frauddetector.html#FraudDetector.Client.put_event_type

        Args:
            :variables: (list)  List object containing variables to instantiate with associated Amazon Fraud Detector types
                                [
                                    {
                                        "name": "email_address",
                                        "variableType": "EMAIL_ADDRESS",
                                        "dataType": "STRING",
                                        "defaultValue": "unknown",
                                        "description": "email address",
                                        "tags": [{"VariableName": "email_address"}, }]
                                    },
                                    ...
                                ]
            :labels: (list)    List object containing labels to instantiate with associated Amazon Fraud Detector
                                        [
                                            {
                                                "name": "legit"
                                            },
                                            {
                                                "name": "fraud"
                                            }
                                        ]
            
        Returns:
            :response_all:      {variable_name: API-response-status, variable_name: API-response-status} dict
        """

        existing_names = [e['name'] for e in self.events['eventTypes']]
        response_all = []

        if self.event_type not in existing_names:

            lh.debug("create_event_type: {}".format(self.event_type))
            # create event via Boto3 SDK fd instance
            response = self.fd.put_event_type(
                name = self.event_type,
                eventVariables = [v["name"] for v in variables],
                labels = [l["name"] for l in labels],
                entityTypes = [self.entity_type]
            )
            lh.info("create_event_type: event {} created".format(self.event_type))
            status = {self.event_type: response['ResponseMetadata']['HTTPStatusCode']}
            response_all.append(status)
        else:
            lh.warning("create_event_type: event {} already exists, skipping".format(self.event_type))
            status = {self.event_type: "skipped"}
            response_all.append(status)

        # update myself
        self.events = self.fd.get_event_types()

        # convert list of dicts to single dict
        response_all = {k: v for d in response_all for k, v in d.items()}
        return response_all