gst-plugins-rs/net/aws
François Laignel a870d60621 aws: improve error message logs
The `Display` and `Debug` trait for the AWS error messages are not very useful.

- `Display` only prints the high level error, e.g.: "service error".
- `Debug` prints all the fields in the error stack, resulting in hard to read
  messages with redudant or unnecessary information. E.g.:

> ServiceError(ServiceError { source: BadRequestException(BadRequestException {
> message: Some("1 validation error detected: Value 'test' at 'languageCode'
> failed to satisfy constraint: Member must satisfy enum value set: [ar-AE,
> zh-HK, en-US, ar-SA, zh-CN, fi-FI, pl-PL, no-NO, nl-NL, pt-PT, es-ES, th-TH,
> de-DE, it-IT, fr-FR, ko-KR, hi-IN, en-AU, pt-BR, sv-SE, ja-JP, ca-ES, es-US,
> fr-CA, en-GB]"), meta: ErrorMetadata { code: Some("BadRequestException"),
> message: Some("1 validation error detected: Value 'test' at 'languageCode'
> failed to satisfy constraint: Member must satisfy enum value set: [ar-AE,
> zh-HK, en-US, ar-SA, zh-CN, fi-FI, pl-PL, no-NO, nl-NL, pt-PT, es-ES, th-TH,
> de-DE, it-IT, fr-FR, ko-KR, hi-IN, en-AU, pt-BR, sv-SE, ja-JP, ca-ES, es-US,
> fr-CA, en-GB]"), extras: Some({"aws_request_id": "1b8bbafd-5b71-4ba5-8676-28432381e6a9"}) } }),
> raw: Response { status: StatusCode(400), headers: Headers { headers:
> {"x-amzn-requestid": HeaderValue { _private: H0("1b8bbafd-5b71-4ba5-8676-28432381e6a9") },
> "x-amzn-errortype": HeaderValue { _private:
> H0("BadRequestException:http://internal.amazon.com/coral/com.amazonaws.transcribe.streaming/") },
> "date": HeaderValue { _private: H0("Tue, 26 Mar 2024 17:41:31 GMT") },
> "content-type": HeaderValue { _private: H0("application/x-amz-json-1.1") },
> "content-length": HeaderValue { _private: H0("315") }} }, body: SdkBody {
> inner: Once(Some(b"{\"Message\":\"1 validation error detected: Value 'test'
> at 'languageCode' failed to satisfy constraint: Member must satisfy enum value
> set: [ar-AE, zh-HK, en-US, ar-SA, zh-CN, fi-FI, pl-PL, no-NO, nl-NL, pt-PT,
> es-ES, th-TH, de-DE, it-IT, fr-FR, ko-KR, hi-IN, en-AU, pt-BR, sv-SE, ja-JP,
> ca-ES, es-US, fr-CA, en-GB]\"}")), retryable: true }, extensions: Extensions {
> extensions_02x: Extensions, extensions_1x: Extensions } } })

This commit adopts the most informative and concise solution I could come up
with to log AWS errors. With the above error case, this results in:

> service error: Error { code: "BadRequestException", message: "1 validation
> error detected: Value 'test' at 'languageCode' failed to satisfy constraint:
> Member must satisfy enum value set: [ar-AE, zh-HK, en-US, ar-SA, zh-CN, fi-FI,
> pl-PL, no-NO, nl-NL, pt-PT, es-ES, th-TH, de-DE, it-IT, fr-FR, ko-KR, hi-IN,
> en-AU, pt-BR, sv-SE, ja-JP, ca-ES, es-US, fr-CA, en-GB]",
> aws_request_id: "a40a32a8-7b0b-4228-a348-f8502087a9f0" }

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1521>
2024-03-26 20:05:32 +01:00
..
src aws: improve error message logs 2024-03-26 20:05:32 +01:00
tests aws: use fixed BehaviorVersion 2024-03-26 17:44:16 +01:00
build.rs Rename rusoto to aws 2022-06-14 08:03:49 +00:00
Cargo.toml Use workspace features for crates metadata/deps 2024-02-05 15:34:31 +01:00
LICENSE-MPL-2.0 git: replace LICENSE file symlinks with copies 2023-04-04 14:26:37 +01:00
README.md fix typos 2023-04-10 13:35:32 +02:00

gst-plugin-aws

This is a GStreamer plugin to interact with Amazon Web Services. We currently have elements to interact with S3 and Transcribe.

AWS Credentials

AWS credentials are picked up using the mechanism described by AWS SDK. At the moment, that is:

  1. Environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  2. AWS credentials file. Usually located at ~/.aws/credentials.
  3. IAM instance profile. Will only work if running on an EC2 instance with an instance profile/role.

An example credentials file might look like:

[default]
aws_access_key_id = ...
aws_secret_access_key = ...

s3src

Reads from a given S3 (region, bucket, object, version?) tuple. The version may be omitted, in which case the default behaviour of fetching the latest version applies.

$ gst-launch-1.0 \
    s3src uri=s3://ap-south-1/my-bucket/my-object-key/which-can-have-slashes?version=my-optional-version !
    filesink name=my-object.out

s3sink

Writes data to a specified S3 (region, bucket, object, version?) tuple. The version may be omitted.

$ gst-launch-1.0 \
    videotestsrc ! \
    theoraenc ! \
    oggmux ! \
    s3sink uri=s3://us-west-1/example-bucket/my/file.ogv?version=my-optional-version

s3hlssink

Writes a single variant HLS stream directly to a specified S3 (region, bucket, path prefix) tuple. Takes the encoded audio and video stream as input, and uses hlssink3 if available, else hlssink2. HLS stream parameters such as playlist length, segment duration, etc. can be tweaked by accessing the underlying sink using the hlssink property.

awstranscriber

Transcribes audio to text.