aws_request 0.2.0+1 copy "aws_request: ^0.2.0+1" to clipboard
aws_request: ^0.2.0+1 copied to clipboard

outdated

Easily create, sign, and send API requests to AWS services without the hassle of implimenting Signature Version 4.

aws_request

Pub Package Last Commit Pull Requests Open Issues Code size License

Easily create, sign, and send API requests to AWS.


Resources

Documentation       Pub Package       GitHub Repository

If you have feedback or have a use case that isn't covered feel free to open an issue.

Getting Started #

Create a request and send it!

import 'package:aws_request/aws_request.dart';

AwsRequest request = new AwsRequest('awsAccessKey', 'awsSecretKey', 'region');
request.send(AwsRequestType.POST);

The following parameters can be provided to the send() function:

type: request type (GET, POST, PUT, etc)
service: aws service you are sending request to
target: your instance of that service plus the operation (Logs_XXXXXXXX.PutLogEvents)
signedHeaders: a list of headers aws requires in the signature.
   Default included signed headers are: (content-type, host, x-amz-date, x-amz-target)
   (You do not need to provide these in [headers])
headers: any required headers. Any non-default headers included in the signedHeaders 
         must be added here.
jsonBody: the body of the request, formatted as json
queryPath: the aws query path
queryString: the aws query string, formatted like ('abc=123&def=456'). Must be url encoded

Supported HTTP methods are get, post, delete, patch, put.

Examples #

Here's an example of using aws_request to send a CloudWatch PutLogEvent request:

import 'package:aws_request/aws_request.dart';
import 'dart:io';

void sendCloudWatchLog(String logString) async {
  AwsRequest request = new AwsRequest('awsAccessKey', 'awsSecretKey', 'region');
  String body = """  
            {"logEvents":
              [{
                "timestamp":${DateTime
      .now()
      .toUtc()
      .millisecondsSinceEpoch},
                "message":"$logString"
              }],
              "logGroupName":"ExampleLogGroupName",
              "logStreamName":"ExampleLogStreamName"
            }""";
  HttpClientResponse result = await request.send(
    AwsRequestType.POST,
    jsonBody: body,
    target: 'Logs_20140328.PutLogEvents',
    service: 'logs',
  );
}

MIT License #

Copyright (c) Zachary Merritt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7
likes
0
pub points
59%
popularity

Publisher

unverified uploader

Easily create, sign, and send API requests to AWS services without the hassle of implimenting Signature Version 4.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

crypto, intl, universal_io

More

Packages that depend on aws_request