// DeleteEventSourceMappingRequest mocks base method
773324
func (m *MockLambdaAPI) DeleteEventSourceMappingRequest(arg0 *lambda.DeleteEventSourceMappingInput) (*request.Request, *lambda.EventSourceMappingConfiguration) {
	ret := m.ctrl.Call(m, "DeleteEventSourceMappingRequest", arg0)
	ret0, _ := ret[0].(*request.Request)
	ret1, _ := ret[1].(*lambda.EventSourceMappingConfiguration)
	return ret0, ret1
}
241949
func DeleteResource(tx Tx, id string) error {
	return tx.delete(tableResource, id)
}
808520
func (s *Server) ListResourceEvents(ctx context.Context, q *ApplicationResourceEventsQuery) (*v1.EventList, error) {
	a, err := s.appclientset.ArgoprojV1alpha1().Applications(s.ns).Get(*q.Name, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}
	if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionGet, appRBACName(*a)); err != nil {
		return nil, err
	}
	var (
		kubeClientset kubernetes.Interface
		fieldSelector string
		namespace     string
	)
	// There are two places where we get events. If we are getting application events, we query
	// our own cluster. If it is events on a resource on an external cluster, then we query the
	// external cluster using its rest.Config
	if q.ResourceName == "" && q.ResourceUID == "" {
		kubeClientset = s.kubeclientset
		namespace = a.Namespace
		fieldSelector = fields.SelectorFromSet(map[string]string{
			"involvedObject.name":      a.Name,
			"involvedObject.uid":       string(a.UID),
			"involvedObject.namespace": a.Namespace,
		}).String()
	} else {
		namespace = q.ResourceNamespace
		var config *rest.Config
		config, _, err = s.getApplicationClusterConfig(*q.Name)
		if err != nil {
			return nil, err
		}
		kubeClientset, err = kubernetes.NewForConfig(config)
		if err != nil {
			return nil, err
		}
		fieldSelector = fields.SelectorFromSet(map[string]string{
			"involvedObject.name":      q.ResourceName,
			"involvedObject.uid":       q.ResourceUID,
			"involvedObject.namespace": namespace,
		}).String()
	}

	log.Infof("Querying for resource events with field selector: %s", fieldSelector)
	opts := metav1.ListOptions{FieldSelector: fieldSelector}
	return kubeClientset.CoreV1().Events(namespace).List(opts)
}
830269
func (s *IGDService) DeletePortMapping(protocol nat.Protocol, externalPort int) error {
	tpl := `<u:DeletePortMapping xmlns:u="%s">
	<NewRemoteHost></NewRemoteHost>
	<NewExternalPort>%d</NewExternalPort>
	<NewProtocol>%s</NewProtocol>
	</u:DeletePortMapping>`
	body := fmt.Sprintf(tpl, s.URN, externalPort, protocol)

	_, err := soapRequest(s.URL, s.URN, "DeletePortMapping", body)
	return err
}
405612
func eventSourceMappingPoliciesForResource(resource *resourceRef,
	template *gocf.Template,
	logger *logrus.Logger) ([]spartaIAM.PolicyStatement, error) {

	policyStatements := []spartaIAM.PolicyStatement{}

	if isResolvedResourceType(resource, template, ":dynamodb:", &gocf.DynamoDBTable{}) {
		policyStatements = append(policyStatements, CommonIAMStatements.DynamoDB...)
	} else if isResolvedResourceType(resource, template, ":kinesis:", &gocf.KinesisStream{}) {
		policyStatements = append(policyStatements, CommonIAMStatements.Kinesis...)
	} else if isResolvedResourceType(resource, template, ":sqs:", &gocf.SQSQueue{}) {
		policyStatements = append(policyStatements, CommonIAMStatements.SQS...)
	} else {
		logger.WithFields(logrus.Fields{
			"Resource": resource,
		}).Debug("No additional EventSource IAM permissions found for event type")
	}
	return policyStatements, nil
}
451371
func (c *Client) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		m, err := c.findUserResourceMapping(ctx, tx, platform.UserResourceMappingFilter{
			ResourceID: resourceID,
			UserID:     userID,
		})
		if err != nil {
			return err
		}

		if err := c.deleteUserResourceMapping(ctx, tx, platform.UserResourceMappingFilter{
			ResourceID: resourceID,
			UserID:     userID,
		}); err != nil {
			return err
		}

		if m.Resource == platform.OrgsResource {
			return c.deleteOrgDependentMappings(ctx, tx, m)
		}

		return nil
	})
}
994932
func (mc MongoClient) DeleteEventById(id string) error {
	return mc.deleteById(db.EventsCollection, id)
}
654555
func resourceAwsLambdaAliasDelete(d *schema.ResourceData, meta interface{}) error {
	conn := meta.(*AWSClient).lambdaconn

	log.Printf("[INFO] Deleting Lambda alias: %s:%s", d.Get("function_name"), d.Get("name"))

	params := &lambda.DeleteAliasInput{
		FunctionName: aws.String(d.Get("function_name").(string)),
		Name:         aws.String(d.Get("name").(string)),
	}

	_, err := conn.DeleteAlias(params)
	if err != nil {
		return fmt.Errorf("Error deleting Lambda alias: %s", err)
	}

	return nil
}
165960
func (s *AddPermissionInput) SetEventSourceToken(v string) *AddPermissionInput {
	s.EventSourceToken = &v
	return s
}
368852
func (s *Service) RemoveMapping(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	id := httprouter.GetParamFromContext(ctx, "id")

	m, err := s.Store.Mappings(ctx).Get(ctx, id)
	if err == chronograf.ErrMappingNotFound {
		Error(w, http.StatusNotFound, err.Error(), s.Logger)
		return
	}

	if err != nil {
		Error(w, http.StatusInternalServerError, "failed to retrieve mapping from database", s.Logger)
		return
	}

	if err := s.Store.Mappings(ctx).Delete(ctx, m); err != nil {
		Error(w, http.StatusInternalServerError, "failed to remove mapping from database", s.Logger)
		return
	}

	w.WriteHeader(http.StatusNoContent)
}
999040
func (c *Client) DeleteEventById(id string) (err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	err = deleteEvent(conn, id)
	if err != nil {
		if err == redis.ErrNil {
			return db.ErrNotFound
		}
		return err
	}

	return nil
}
1192267
func resourceAwsLambdaEventSourceMappingCreate(d *schema.ResourceData, meta interface{}) error {
	conn := meta.(*AWSClient).lambdaconn

	functionName := d.Get("function_name").(string)
	eventSourceArn := d.Get("event_source_arn").(string)

	log.Printf("[DEBUG] Creating Lambda event source mapping: source %s to function %s", eventSourceArn, functionName)

	params := &lambda.CreateEventSourceMappingInput{
		EventSourceArn: aws.String(eventSourceArn),
		FunctionName:   aws.String(functionName),
		Enabled:        aws.Bool(d.Get("enabled").(bool)),
	}

	if batchSize, ok := d.GetOk("batch_size"); ok {
		params.BatchSize = aws.Int64(int64(batchSize.(int)))
	}

	if startingPosition, ok := d.GetOk("starting_position"); ok {
		params.StartingPosition = aws.String(startingPosition.(string))
	}

	if startingPositionTimestamp, ok := d.GetOk("starting_position_timestamp"); ok {
		t, _ := time.Parse(time.RFC3339, startingPositionTimestamp.(string))
		params.StartingPositionTimestamp = aws.Time(t)
	}

	// IAM profiles and roles can take some time to propagate in AWS:
	//  http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#launch-instance-with-role-console
	// Error creating Lambda function: InvalidParameterValueException: The
	// function defined for the task cannot be assumed by Lambda.
	//
	// The role may exist, but the permissions may not have propagated, so we
	// retry
	err := resource.Retry(5*time.Minute, func() *resource.RetryError {
		eventSourceMappingConfiguration, err := conn.CreateEventSourceMapping(params)
		if err != nil {
			if awserr, ok := err.(awserr.Error); ok {
				if awserr.Code() == "InvalidParameterValueException" {
					return resource.RetryableError(awserr)
				}
			}
			return resource.NonRetryableError(err)
		}
		// No error
		d.Set("uuid", eventSourceMappingConfiguration.UUID)
		d.SetId(*eventSourceMappingConfiguration.UUID)
		return nil
	})

	if err != nil {
		return fmt.Errorf("Error creating Lambda event source mapping: %s", err)
	}

	return resourceAwsLambdaEventSourceMappingRead(d, meta)
}
886928
func (t *Template) GetAllAWSLambdaEventSourceMappingResources() map[string]*resources.AWSLambdaEventSourceMapping {
	results := map[string]*resources.AWSLambdaEventSourceMapping{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSLambdaEventSourceMapping:
			results[name] = resource
		}
	}
	return results
}
1248586
func GetRequestEventID(r *http.Request) (*lunk.EventID, error) {
	s := r.Header.Get(HeaderEventID)
	if s == "" {
		return nil, nil
	}
	return lunk.ParseEventID(s)
}
744796
func NewRemoveEventListenerBreakpointArgs(eventName string) *RemoveEventListenerBreakpointArgs {
	args := new(RemoveEventListenerBreakpointArgs)
	args.EventName = eventName
	return args
}
361383
func formatEventSource(es api.EventSource) string {
	EventSourceString := []string{es.Component}
	if len(es.Host) > 0 {
		EventSourceString = append(EventSourceString, es.Host)
	}
	return strings.Join(EventSourceString, ", ")
}
781508
func (m *MockPKCERequestStorage) DeletePKCERequestSession(arg0 context.Context, arg1 string) error {
	ret := m.ctrl.Call(m, "DeletePKCERequestSession", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}