Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Amazon.Lambda.CloudWatchEvents.TranscribeEvents
{
/// <summary>
/// This class represents the details of a Transcribe Job State Change sent via EventBridge.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the a URL you can add to where this event type is documented?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I wasn't clear, can you add the URL as part of the NDoc here?

/// For more see - https://docs.aws.amazon.com/transcribe/latest/dg/monitoring-events.html
/// </summary>
public class TranscribeJobStateChange
{
/// <summary>
/// The transcription job name.
/// </summary>
public string TranscriptionJobName { get; set; }

/// <summary>
/// The transcription job status.
/// </summary>
public string TranscriptionJobStatus { get; set; }

/// <summary>
/// If the TranscriptionJobStatus is FAILED, this field contains information about the failure.
/// </summary>
public string FailureReason { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Amazon.Lambda.CloudWatchEvents.TranscribeEvents
{
/// <summary>
/// This class represents a Transcribe Job State Change sent via EventBridge.
/// </summary>
public class TranscribeJobStateChangeEvent : CloudWatchEvent<TranscribeJobStateChange>{ }
}
45 changes: 45 additions & 0 deletions Libraries/test/EventsTests.Shared/EventTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Amazon.Lambda.Tests
using Amazon.Lambda.CloudWatchEvents.BatchEvents;
using Amazon.Lambda.CloudWatchEvents.ECSEvents;
using Amazon.Lambda.CloudWatchEvents.ScheduledEvents;
using Amazon.Lambda.CloudWatchEvents.TranscribeEvents;
using Amazon.Lambda.CloudWatchLogsEvents;
using Amazon.Lambda.CognitoEvents;
using Amazon.Lambda.ConfigEvents;
Expand Down Expand Up @@ -3103,6 +3104,50 @@ public void CloudWatchEventsS3ObjectRestore(Type serializerType)
}
}

[Theory]
[InlineData(typeof(JsonSerializer))]
#if NETCOREAPP3_1_OR_GREATER
[InlineData(typeof(Amazon.Lambda.Serialization.SystemTextJson.LambdaJsonSerializer))]
[InlineData(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
#endif
public void CloudWatchTranscribeJobStateChangeCompleted(Type serializerType)
{
var serializer = Activator.CreateInstance(serializerType) as ILambdaSerializer;
using (var fileStream = LoadJsonTestFile("cloudwatchevents-transcribejobstatechangecompleted.json"))
{
var request = serializer.Deserialize<TranscribeJobStateChangeEvent>(fileStream);
Assert.Equal("1de9a55a-39aa-d889-84eb-22d245492319", request.Id);

var detail = request.Detail;
Assert.NotNull(detail);
Assert.Equal("51a3dfef-87fa-423a-8d3b-690ca9cae1f4", detail.TranscriptionJobName);
Assert.Equal("COMPLETED", detail.TranscriptionJobStatus);
Assert.Null(detail.FailureReason);
}
}

[Theory]
[InlineData(typeof(JsonSerializer))]
#if NETCOREAPP3_1_OR_GREATER
[InlineData(typeof(Amazon.Lambda.Serialization.SystemTextJson.LambdaJsonSerializer))]
[InlineData(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
#endif
public void CloudWatchTranscribeJobStateChangeFailed(Type serializerType)
{
var serializer = Activator.CreateInstance(serializerType) as ILambdaSerializer;
using (var fileStream = LoadJsonTestFile("cloudwatchevents-transcribejobstatechangefailed.json"))
{
var request = serializer.Deserialize<TranscribeJobStateChangeEvent>(fileStream);
Assert.Equal("5505f4fc-979b-0304-3570-8fa0e3c09525", request.Id);

var detail = request.Detail;
Assert.NotNull(detail);
Assert.Equal("d43d0b58-2129-46ba-b2e2-b53ec9d1b210", detail.TranscriptionJobName);
Assert.Equal("FAILED", detail.TranscriptionJobStatus);
Assert.Equal("The media format that you specified doesn't match the detected media format. Check the media format and try your request again.", detail.FailureReason);
}
}

class ClassUsingPascalCase
{
public int SomeValue { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0",
"id": "1de9a55a-39aa-d889-84eb-22d245492319",
"detail-type": "Transcribe Job State Change",
"source": "aws.transcribe",
"account": "694977046108",
"time": "2023-02-24T15:46:21Z",
"region": "us-east-1",
"resources": [],
"detail": {
"TranscriptionJobName": "51a3dfef-87fa-423a-8d3b-690ca9cae1f4",
"TranscriptionJobStatus": "COMPLETED"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0",
"id": "5505f4fc-979b-0304-3570-8fa0e3c09525",
"detail-type": "Transcribe Job State Change",
"source": "aws.transcribe",
"account": "694977046108",
"time": "2023-02-24T15:42:10Z",
"region": "us-east-1",
"resources": [],
"detail": {
"TranscriptionJobName": "d43d0b58-2129-46ba-b2e2-b53ec9d1b210",
"TranscriptionJobStatus": "FAILED",
"FailureReason": "The media format that you specified doesn't match the detected media format. Check the media format and try your request again."
}
}