(self, bundle, **kwargs)
Handles creating Indicators through the API.

        :param bundle: Bundle containing the information to create the Indicator.
        :type bundle: Tastypie Bundle object.
        :returns: HttpResponse.
Handles creating Indicators through the API.
Handles creating Indicators through the API .
def obj_create(self, bundle, **kwargs):
        """
        Handles creating Indicators through the API.

        :param bundle: Bundle containing the information to create the Indicator.
        :type bundle: Tastypie Bundle object.
        :returns: HttpResponse.
        """

        user = bundle.request.user
        value = bundle.data.get('value', None)
        ctype = bundle.data.get('type', None)
        threat_type = bundle.data.get('threat_type', None)
        attack_type = bundle.data.get('attack_type', None)
        source = bundle.data.get('source', None)
        status = bundle.data.get('status', None)
        reference = bundle.data.get('reference', None)
        method = bundle.data.get('method', None)
        tlp = bundle.data.get('tlp', 'amber')
        add_domain = bundle.data.get('add_domain', False)
        add_relationship = bundle.data.get('add_relationship', False)
        campaign = bundle.data.get('campaign', None)
        campaign_confidence = bundle.data.get('confidence', None)
        confidence = bundle.data.get('indicator_confidence', None)
        description = bundle.data.get('description', None)
        impact = bundle.data.get('indicator_impact', None)
        bucket_list = bundle.data.get('bucket_list', None)
        ticket = bundle.data.get('ticket', None)

        if user.has_access_to(IndicatorACL.WRITE):
            result =  handle_indicator_ind(value,
                                           source,
                                           ctype,
                                           threat_type,
                                           attack_type,
                                           user,
                                           status=status,
                                           source_method=method,
                                           source_reference=reference,
                                           source_tlp=tlp,
                                           add_domain=add_domain,
                                           add_relationship=add_relationship,
                                           campaign=campaign,
                                           campaign_confidence=campaign_confidence,
                                           confidence=confidence,
                                           description=description,
                                           impact=impact,
                                           bucket_list=bucket_list,
                                           ticket=ticket)
        else:
            result = {'success':False,
                      'message':'User does not have permission to create Object.'}

        content = {'return_code': 0,
                   'type': 'Indicator'}
        if result.get('message'):
            content['message'] = result.get('message')
        if result.get('objectid'):
            url = reverse('api_dispatch_detail',
                          kwargs={'resource_name': 'indicators',
                                  'api_name': 'v1',
                                  'pk': result.get('objectid')})
            content['id'] = result.get('objectid')
            content['url'] = url
        if not result['success']:
            content['return_code'] = 1
        self.crits_response(content)
def obj_create ( self , bundle , * * kwargs ) : user = bundle . request . user value = bundle . data . get ( 'value' , None ) ctype = bundle . data . get ( 'type' , None ) threat_type = bundle . data . get ( 'threat_type' , None ) attack_type = bundle . data . get ( 'attack_type' , None ) source = bundle . data . get ( 'source' , None ) status = bundle . data . get ( 'status' , None ) reference = bundle . data . get ( 'reference' , None ) method = bundle . data . get ( 'method' , None ) tlp = bundle . data . get ( 'tlp' , 'amber' ) add_domain = bundle . data . get ( 'add_domain' , False ) add_relationship = bundle . data . get ( 'add_relationship' , False ) campaign = bundle . data . get ( 'campaign' , None ) campaign_confidence = bundle . data . get ( 'confidence' , None ) confidence = bundle . data . get ( 'indicator_confidence' , None ) description = bundle . data . get ( 'description' , None ) impact = bundle . data . get ( 'indicator_impact' , None ) bucket_list = bundle . data . get ( 'bucket_list' , None ) ticket = bundle . data . get ( 'ticket' , None ) if user . has_access_to ( IndicatorACL . WRITE ) : result = handle_indicator_ind ( value , source , ctype , threat_type , attack_type , user , status = status , source_method = method , source_reference = reference , source_tlp = tlp , add_domain = add_domain , add_relationship = add_relationship , campaign = campaign , campaign_confidence = campaign_confidence , confidence = confidence , description = description , impact = impact , bucket_list = bucket_list , ticket = ticket ) else : result = { 'success' : False , 'message' : 'User does not have permission to create Object.' } content = { 'return_code' : 0 , 'type' : 'Indicator' } if result . get ( 'message' ) : content [ 'message' ] = result . get ( 'message' ) if result . get ( 'objectid' ) : url = reverse ( 'api_dispatch_detail' , kwargs = { 'resource_name' : 'indicators' , 'api_name' : 'v1' , 'pk' : result . get ( 'objectid' ) } ) content [ 'id' ] = result . get ( 'objectid' ) content [ 'url' ] = url if not result [ 'success' ] : content [ 'return_code' ] = 1 self . crits_response ( content )