diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins b/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins new file mode 100644 index 00000000000..45b348ac281 --- /dev/null +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins @@ -0,0 +1,6 @@ +# This is a generated file; do not edit or check into version control. +path_provider=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider-2.1.1/ +path_provider_android=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_android-2.2.0/ +path_provider_foundation=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/ +path_provider_linux=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ +path_provider_windows=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins-dependencies b/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins-dependencies new file mode 100644 index 00000000000..92da5165468 --- /dev/null +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_android-2.2.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-09-07 15:25:43.661957","version":"3.10.6"} \ No newline at end of file diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins b/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins new file mode 100644 index 00000000000..45b348ac281 --- /dev/null +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins @@ -0,0 +1,6 @@ +# This is a generated file; do not edit or check into version control. +path_provider=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider-2.1.1/ +path_provider_android=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_android-2.2.0/ +path_provider_foundation=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/ +path_provider_linux=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ +path_provider_windows=/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins-dependencies b/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins-dependencies new file mode 100644 index 00000000000..bca0185956d --- /dev/null +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_android-2.2.0/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ktruon/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-09-07 15:25:43.712619","version":"3.10.6"} \ No newline at end of file diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/remote_constraint_provider.dart b/packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/remote_constraint_provider.dart index 56129deec37..9a9491e0715 100644 --- a/packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/remote_constraint_provider.dart +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/lib/src/remote_constraint_provider.dart @@ -14,7 +14,6 @@ import 'package:aws_logging_cloudwatch/src/file_storage/file_storage.vm.dart' if (dart.library.html) 'package:aws_logging_cloudwatch/src/file_storage/file_storage.web.dart' as storage; import 'package:aws_signature_v4/aws_signature_v4.dart'; -import 'package:http/http.dart' as http; /// {@template aws_logging_cloudwatch.remote_logging_constraint_provider} /// An Interface to provide custom implementation for @@ -51,6 +50,8 @@ class DefaultRemoteLoggingConstraintProvider /// The signer to sign the request. static const _signer = AWSSigV4Signer(); + final AWSHttpClient _awsHttpClient = AWSHttpClient(); + // The timer to refresh the constraint periodically. Timer? _timer; @@ -91,7 +92,13 @@ class DefaultRemoteLoggingConstraintProvider Future _fetchConstraintFromEndpoint() async { final uri = Uri.parse(_config.endpoint); - final request = AWSHttpRequest.get(uri); + final request = AWSHttpRequest( + method: AWSHttpMethod.get, + uri: uri, + headers: { + AWSHeaders.host: uri.host, + }, + ); final scope = AWSCredentialScope( region: _config.region, @@ -103,21 +110,24 @@ class DefaultRemoteLoggingConstraintProvider credentialScope: scope, ); - final headers = signedRequest.headers.map( - MapEntry.new, - ); - - final response = await http.get( - uri, + final newRequest = AWSHttpRequest( + method: signedRequest.method, + uri: signedRequest.uri, headers: { - ...headers, + ...signedRequest.headers, AWSHeaders.accept: 'application/json; charset=utf-8', }, ); + final operation = _awsHttpClient.send(newRequest); + + final response = await operation.response; + + final body = await response.decodeBody(); + if (response.statusCode == 200) { final fetchedConstraint = LoggingConstraint.fromJson( - jsonDecode(response.body) as Map, + jsonDecode(body) as Map, ); return fetchedConstraint; } diff --git a/packages/logging_cloudwatch/aws_logging_cloudwatch/pubspec.yaml b/packages/logging_cloudwatch/aws_logging_cloudwatch/pubspec.yaml index 233241cecbe..df00842c671 100644 --- a/packages/logging_cloudwatch/aws_logging_cloudwatch/pubspec.yaml +++ b/packages/logging_cloudwatch/aws_logging_cloudwatch/pubspec.yaml @@ -17,7 +17,6 @@ dependencies: fixnum: ^1.1.0 flutter: sdk: flutter - http: ^1.0.0 intl: ">=0.18.0 <1.0.0" json_annotation: ^4.8.1 meta: ^1.9.1