Thanks to visit codestin.com
Credit goes to lib.haxe.org

hxAwsSdk

Provides interface to make calls to the AWS SDK
https://gitlab.com/ianxm/hxAwsSdk

To install, run:

haxelib install hxAwsSdk 0.0.8 

See using Haxelib in Haxelib documentation for more information.

README.md

hxAwsSdk

Overview

This is a cross platform haxe library that provides access to AWS.

Goals

  • wide SDK coverage
  • minimal client code
  • strongly typed requests and responses
  • consistent interface across JSON and XML services

Usage

Setup

The following steps will get this library installed and configured to generate aws clients for your project as part of your build.

  1. install this library

    haxelib install hxAwsSdk
    
  2. create a config file in your project directory containing one entry per line formatted as serviceName:operation. where serviceName matches a directory in botocore, and operation matches the operation name from that service's service.json file. For example this is where cognito-idp:ListUsers comes from, and this is what a config file might look like:

    cognito-idp:ListUsers
    dynamodb:ListTables
    dynamodb:Query
    s3:GetObject
    s3:GetBucketVersioning
    ssm:GetParameter
    
  3. add a command to the top of your build to generate the aws clients. the arguments are described in the Generator Args section below.

    -cmd haxelib run hxAwsSdk ../../python/botocore config/awssdk.conf src-gen
    --next
    
  4. add the generated files to your build

    -cp src-gen
    

    note that src-gen was the generator output directory from the command in step 2.

  5. add this library to your build

    -lib hxAwsSdk
    
  6. Generator Args

    There are three arguments that must be passed to the generator. This is the command:

    haxelib run hxAwsSdk [path-to-botocore] [config-file] [output-dir]
    

    where

    • path-to-botocore: absolute or relative path to these files on your local filesystem
    • config-file: the relative path to the file you created in Usage Step 1
    • output-dir: the relative path to where you want the generator to write to

Workflow

The docs for the AWS APIs and boto3 are relevant but in order to see the exact naming and capitalization of the haxe request and response types it is best to generate the types for your project and refer to the generated client sources. All needed types are added to the client file for the respective AWS service.

API Coverage

Since this library generates the client code from API definitions the actual API coverage should be much more than what I've tested and it's hard to know how much of the total API is covered. Some of the APIs I've tested are listed in awssdk.conf I'm not aware of any APIs that aren't covered.

Examples

The following code examples show how to use the generated clients to access AWS. Examine the generated client files to see the exact method names, input names, and output types for each operation.

  1. Dynamo DB

    List tables in the account:

    import awssdk.DynamoDBClient;
    ...
    var dynamodb = new DynamoDBClient(REGION);
    var ret :ListUsersResponse = dynamodb.listTables({});
    
  2. S3

    List objects in a bucket:

    import awssdk.S3Client;
    ...
    var s3 = new S3Client(REGION);
    var ret :ListObjectsV2Output = s3.listObjectsV2({
        "OptionalObjectAttributes": [],
        "Bucket": "my-bucket"
    });
    

    Presign a URL:

    import awssdk.AwsSdk;
    ...
    var presignedUrl = awsSdk.presignUrl({
        "protocol": "rest-xml",
        "serviceName": "S3",
        "httpMethod": "GET",
        "region": "us-east-1",
        "hostPrefix": "s3",
        "requestUri": "/my-bucket/my-key",
    });
    
  3. Systems Manager

    Get a parameter:

    import awssdk.SSMClient;
    ...
    var ssm = new SSMClient(REGION);
    var ret : = ssm.getParameter({
        "Name": "/scope/parametername"
    });
    

API References

Contributors
ianxm
Version
0.0.8
Published
2 months ago
Dependencies
License
BSD

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub