by

Generic Amazon API Gateway Java Client (SDK)

I’ve recently released apigateway-generic-java-sdk, a simple generic Java client for Amazon API Gateway endpoints for those that don’t necessarily want to generate a strongly-typed SDK. This is particularly useful when the API definition is changing rapidly or when you don’t want to go through the effort of generating and bundling an SDK, such as when prototyping or scripting.

It is optimized to run from a Lambda function and does not require any extra dependencies beyond the AWS SDK, which is already bundled in the Lambda runtime.

Features

  • AWS SigV4 request signing. Supports APIs authenticated with IAM auth using standard AWSCredentialsProvider interface
  • API Keys
  • Custom headers
  • Throws exceptions for non-2xx response codes
  • Compatibility with existing AWS SDK client configuration (connections, retry policies, etc)
  • Runs in AWS Lambda functions with no additional dependencies

Example

GenericApiGatewayClient client = new GenericApiGatewayClientBuilder()
        .withClientConfiguration(new ClientConfiguration())
        .withCredentials(new EnvironmentVariableCredentialsProvider())
        .withEndpoint("https://XXXXXX.execute-api.us-east-1.amazonaws.com")
        .withRegion(Region.getRegion(Regions.fromName("us-east-1")))
        .withApiKey("XXXXXXXXXXXXXXX")
        .build();

Map headers = new HashMap<>();
headers.put("Content-Type", "application/json");

try {
    GenericApiGatewayResponse response = client.execute(
            new GenericApiGatewayRequestBuilder()
                    .withBody(new ByteArrayInputStream("foo".getBytes()))
                    .withHttpMethod(HttpMethodName.POST)
                    .withHeaders(headers)
                    .withResourcePath("/stage/path").build());
    
    System.out.println("Response: " + response.getBody());
    System.out.println("Status: " + response.getHttpResponse.getStatusCode());
    
} catch (GenericApiGatewayException e) {   // exception thrown for any non-2xx response
    System.out.println(String.format("Client threw exception with message %s and status code %s", 
            e.getMessage(), e.getStatusCode()));
}

To get the code and for more examples, see the GitHub repo.

Write a Comment

Comment

Webmentions

  • cialis walmart price

    cialis otc walmart

    cialis over the counter at walmart

  • madridbet

    Generic Amazon API Gateway Java Client (SDK)

    https://gamestermuse.com/so-you-want-to-be-an-esports-athlete/

  • elexusbet

    Generic Amazon API Gateway Java Client (SDK)

    http://tekfilmindir.com/main-forum/90819-ems-film-2021-10-a-53.html

  • child porn

    Generic Amazon API Gateway Java Client (SDK)

    http://ozbilen.web.tr/urun/kisa-envelop-etek/

  • ivermectin canada

    buy ivermectin 3 mg online

    ivermectin buy

  • slot siteleri

    Generic Amazon API Gateway Java Client (SDK)

    https://www.rehaarastirma.com/hizmetler/saha-calismalarimiz/

  • meritking

    Generic Amazon API Gateway Java Client (SDK)

    https://deductionscience.com/フェルメール1/

  • meritroyalbet

    Generic Amazon API Gateway Java Client (SDK)

    https://j-pet.jp/btn01-2/

  • eurocasino

    Generic Amazon API Gateway Java Client (SDK)

    https://www.fireside.exchange/2018/12/01/open-ledger/

  • meritroyalbet

    Generic Amazon API Gateway Java Client (SDK)

    https://baobimangco.com/bot-nhua-pvc/

  • meritroyalbet

    Generic Amazon API Gateway Java Client (SDK)

    https://yemeniamerican.com/covid19/dps-closed-to-april-5-school-updates-3-15-2020/

  • meritking

    Generic Amazon API Gateway Java Client (SDK)

    https://www.nettec.fr/index.php/tag/nature/

  • sex board games

    bedroom sex games for families incest https://sex4games.com/

  • sex games for partners

    hunger games sex fanfic https://sexygamess.com/

  • mature bi sex games

    free virtual sex games https://sexgamesx.net/

  • evangelion sex games

    free no sign ul sex games https://sexgameszone.com/

  • fun sex games for couples

    real sex games https://cybersexgames.net/

  • pour on ivermectin

    ivermectin 1%

    ivermectin tablets

  • analysis essay writing

    writing expository essay https://student-essay.com/

  • write good essay

    writing an analytical essay https://dollaressays.com/

  • writing good essays

    writing an autobiography essay https://buy1essay.com/

  • free bonus slots

    bingo gamble https://casinoonlinet.com/

  • generic azithromycin without doctor prescription

    zithromax 12 mg without a doctor prescription

    generic zithromax without a doctor prescription

  • best essay writing

    write an expository essay https://onlinecasinos4me.com/

  • write and essay

    write my essay cheap https://essaytag.com/

  • best essay writing

    help me write a essay https://essaywritercentral.com/

  • writing college essays

    writing a cause and effect essay https://essayghostwriter.com/

  • gay herpes dating

    gay married dating https://gaydatinglosangeles.com/

  • buy stromectol 3 mg for covid 19

    stromectol generic of ivermectin for covid 19

    ivermectin heartworm for covid 19

  • order ivermectin 3mg for sale

    buy stromectol 6 mg for sale

    ivermectin scabies

  • ivermectin 3 mg online

    ivermectin for humans

    where to buy ivermectin for humans

  • air fryer recipes keto

    what can’t you eat on a keto diet https://ketodietplanus.com/

  • ivermectin dosage for humans

    ivermectin dose

    ivermectin otc for humans

  • order kamagra

    kamagra chewable

    best price on kamagra in stock in usa