Skip to content

Commit

Permalink
Prepare mono package
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh committed May 25, 2023
1 parent 3a0e69e commit 1f1359c
Show file tree
Hide file tree
Showing 26 changed files with 905 additions and 865 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
run: dart pub get && dart analyze --fatal-infos
working-directory: document_client

- name: Analyze aws_client package
run: dart pub get && dart analyze --fatal-infos
working-directory: aws_client

- name: "check for uncommitted changes"
run: git diff --exit-code --stat -- .

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ doc/api/
*.iws

# Generated directories
**/apis/
generator/apis/
/all_apis/lib/
4 changes: 0 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ include: package:lints/recommended.yaml
analyzer:
exclude: [generated/**]
errors:
unused_element: error
unused_import: error
unused_local_variable: error
dead_code: error
deprecated_member_use_from_same_package: ignore
language:
strict-casts: true
Expand Down
4 changes: 4 additions & 0 deletions aws_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.4.0

- Generate all the APIs with version v2.1384.0 of the AWS SDK

## 0.3.0

- Repository refactoring in preparation for API code generator.
Expand Down
353 changes: 351 additions & 2 deletions aws_client/README.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions aws_client/README.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# High-level APIs for Amazon Web Services (AWS) in Dart

## Usage

A simple usage example:

````dart
import 'package:aws_client/aws_client.dart';
import 'package:http_client/console.dart';
main() async {
var httpClient = newHttpClient();
var credentials = new Credentials(accessKey: 'MY_ACCESS_KEY', secretKey: 'MY_SECRET_KEY');
var aws = new Aws(credentials: credentials, httpClient: httpClient);
var queue = aws.sqs.queue('https://my-queue-url/number/queue-name');
await queue.sendMessage('Hello from Dart client!');
httpClient.close();
}
````

## How to contribute

This library is not an official library from Amazon or Google.
It is developed by best effort, in the motto of _"Scratch your own itch!"_,
meaning we have APIs here that we care about. Looking for contributions:

- tests:

- never put AWS credentials inside the code
- read AWS credentials from environment variables in the beginning
- provide description what setup it needs upfront

- API documentation

- New API contribution:

- please open an issue ticket first about what you are planning to implement
- take a look at the implementation of the others, most of the API calls will be similar
- always include a link to AWS API docs

## Links

- [source code][source]
- contributors: [Agilord][agilord]

[source]: https://github.com/agilord/aws_client
[agilord]: https://www.agilord.com/

## Available AWS APIs

The following is a list of APIs that are currently available inside this package.

<!-- INSERT API LIST -->
19 changes: 0 additions & 19 deletions aws_client/build.yml

This file was deleted.

33 changes: 7 additions & 26 deletions aws_client/examples/lambda.example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.

import 'dart:convert';
import 'dart:io';

import 'package:aws_client/aws_client.dart';
import 'package:aws_client/lambda.dart';
import 'package:aws_client/src/credentials.dart';
import 'package:http_client/console.dart';
import 'package:aws_client/lambda_2015_03_31.dart';

Future main(List<String> args) async {
final environment = Platform.environment;
final Client httpClient = ConsoleClient();
final credentials = Credentials(
accessKey: environment['AWS_ACCESS_KEY_ID'],
secretKey: environment['AWS_SECRET_ACCESS_KEY'],
sessionToken: environment['AWS_SESSION_TOKEN'],
);
final lambda = Lambda(region: 'us-west-1');

try {
final aws = Aws(credentials: credentials, httpClient: httpClient);
final response = await aws.lambda(environment['AWS_DEFAULT_REGION']).invoke(
'my-function',
json.encode({'number': 4}),
invocationType: LambdaInvocationType.RequestResponse,
headers: {'X-Amz-Log-Type': 'Tail'},
final response = await lambda.invoke(
functionName: 'my-function',
invocationType: InvocationType.requestResponse,
);

print('StatusCode: ${response.statusCode}');
print('Headers: ${response.headers}');
final respPayloadString = await response.readAsString();
print('Payload: $respPayloadString');
} catch (e) {
print('ERROR!!! $e');
} finally {
await httpClient.close();
lambda.close();
}
}
13 changes: 13 additions & 0 deletions aws_client/examples/sqs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:aws_client/sqs_2012_11_05.dart';

void main() async {
final sqs = Sqs(
region: 'us-east-1',
credentials: AwsClientCredentials.fromProfileFile(profile: 'prod'));
final queue = await sqs.createQueue(
queueName: 'bucket2', attributes: {QueueAttributeName.delaySeconds: '5'});

print(queue.queueUrl);
await sqs.deleteQueue(queueUrl: queue.queueUrl!);
sqs.close();
}
38 changes: 0 additions & 38 deletions aws_client/lib/aws_client.dart

This file was deleted.

65 changes: 0 additions & 65 deletions aws_client/lib/lambda.dart

This file was deleted.

Loading

0 comments on commit 1f1359c

Please sign in to comment.