How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import * as es from '@aws-cdk/aws-elasticsearch';
    
    const user = new iam.User(this, 'User');
    const domain = new es.Domain(this, 'Domain', {
      version: es.ElasticsearchVersion.V7_1,
      removalPolicy: RemovalPolicy.DESTROY,
      fineGrainedAccessControl: { masterUserArn: user.userArn },
      encryptionAtRest: { enabled: true },
      nodeToNodeEncryption: true,
      enforceHttps: true,
    });
    
    declare const api: appsync.GraphqlApi;
    const ds = api.addElasticsearchDataSource('ds', domain);
    
    ds.createResolver({
      typeName: 'Query',
      fieldName: 'getTests',
      requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({
        version: '2017-02-28',
        operation: 'GET',
        path: '/id/post/_search',
        params: {
          headers: {},
          queryString: {},
          body: { from: 0, size: 50 },
        },
      })),
      responseMappingTemplate: appsync.MappingTemplate.fromString(`[
        #foreach($entry in $context.result.hits.hits)
        #if( $velocityCount > 1 ) , #end
        $utils.toJson($entry.get("_source"))
        #end
      ]`),
    });
    
    Docs
  • import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
    lambda.addEventSource(new SqsEventSource(sqs));
    
    Docs
  • import * as eventsources from '@aws-cdk/aws-lambda-event-sources';
    import * as sqs from '@aws-cdk/aws-sqs';
    
    declare const fn: lambda.Function;
    const queue = new sqs.Queue(this, 'Queue');
    fn.addEventSource(new eventsources.SqsEventSource(queue));
    
    Docs
  • import * as s3 from '@aws-cdk/aws-s3';
    import { S3EventSource } from '@aws-cdk/aws-lambda-event-sources';
    
    const bucket = new s3.Bucket(this, 'mybucket');
    declare const fn: lambda.Function;
    
    fn.addEventSource(new S3EventSource(bucket, {
      events: [ s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED ],
      filters: [ { prefix: 'subdir/' } ], // optional
    }));
    
    Docs
  • import * as sns from '@aws-cdk/aws-sns';
    import { SnsEventSource } from '@aws-cdk/aws-lambda-event-sources';
    
    declare const topic: sns.Topic;
    const deadLetterQueue = new sqs.Queue(this, 'deadLetterQueue');
    
    declare const fn: lambda.Function;
    fn.addEventSource(new SnsEventSource(topic, {
      filterPolicy: { },
      deadLetterQueue: deadLetterQueue,
    }));
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples