def _association(
        self,
        main_type,
        sub_type,
        unique_id,
        target_type,
        target_sub_type,
        target_unique_id,
        action='ADD',
        owner=None,
    ):
        """

        Args:
            main_type:
            sub_type:
            unique_id:
            target_type:
            target_sub_type:
            target_unique_id:
            action:

        Return:

        """
        action = action.upper()
        params = {'owner': owner} if owner else {}
        # Typically if victim to victim but other endpoints that are not
        # groups/indicators can exist in the future
        if not sub_type and not target_sub_type:
            url = '/v2/{}/{}/{}/{}'.format(main_type, unique_id, target_type, target_unique_id)
        # Typically if victim to anything else
        elif not sub_type:
            url = '/v2/{}/{}/{}/{}/{}'.format(
                main_type, unique_id, target_type, target_sub_type, target_unique_id
            )
        # If anything else to victim
        elif not target_sub_type:
            url = '/v2/{}/{}/{}/{}/{}'.format(
                main_type, sub_type, unique_id, target_type, target_unique_id
            )
        else:
            # Everything else
            url = '/v2/{}/{}/{}/{}/{}/{}'.format(
                main_type, sub_type, unique_id, target_type, target_sub_type, target_unique_id
            )

        response = None
        if action == 'ADD':
            response = self.tcex.session.post(url, params=params)
        elif action == 'DELETE':
            response = self.tcex.session.delete(url, params=params)
        else:
            self.tcex.log.error('associations error')
        return response
def _association ( self , main_type , sub_type , unique_id , target_type , target_sub_type , target_unique_id , action = 'ADD' , owner = None , ) : action = action . upper ( ) params = { 'owner' : owner } if owner else { } if not sub_type and not target_sub_type : url = '/v2/{}/{}/{}/{}' . format ( main_type , unique_id , target_type , target_unique_id ) elif not sub_type : url = '/v2/{}/{}/{}/{}/{}' . format ( main_type , unique_id , target_type , target_sub_type , target_unique_id ) elif not target_sub_type : url = '/v2/{}/{}/{}/{}/{}' . format ( main_type , sub_type , unique_id , target_type , target_unique_id ) else : url = '/v2/{}/{}/{}/{}/{}/{}' . format ( main_type , sub_type , unique_id , target_type , target_sub_type , target_unique_id ) response = None if action == 'ADD' : response = self . tcex . session . post ( url , params = params ) elif action == 'DELETE' : response = self . tcex . session . delete ( url , params = params ) else : self . tcex . log . error ( 'associations error' ) return response
Args:
            main_type:
            sub_type:
            unique_id:
            target_type:
            target_sub_type:
            target_unique_id:
            action:

        Return: