Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
201 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Tools/LambdaTestTool/Amazon.Lambda.TestTool.ExternalCommands/PurgeQueueCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Amazon.SQS; | ||
using Amazon.SQS.Model; | ||
|
||
namespace Amazon.Lambda.TestTool.ExternalCommands | ||
{ | ||
public class PurgeQueueCommand | ||
{ | ||
|
||
string Profile { get; } | ||
string Region { get; } | ||
private string QueueUrl { get; } | ||
|
||
public PurgeQueueCommand(string profile, string region, string queueUrl) | ||
{ | ||
this.Profile = profile; | ||
this.Region = region; | ||
this.QueueUrl = queueUrl; | ||
} | ||
|
||
public async Task ExecuteAsync() | ||
{ | ||
try | ||
{ | ||
var creds = Utils.GetCredentials(this.Profile); | ||
using (var client = new AmazonSQSClient(creds, RegionEndpoint.GetBySystemName(this.Region))) | ||
{ | ||
var request = new PurgeQueueRequest() | ||
{ | ||
QueueUrl = this.QueueUrl | ||
}; | ||
await client.PurgeQueueAsync(request); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.Error.WriteLine("Error purging messages from queue: " + e.Message); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Tools/LambdaTestTool/Amazon.Lambda.TestTool/WebTester/Models/PurgeDlqModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Amazon.Lambda.TestTool.WebTester.Models | ||
{ | ||
public class PurgeDlqModel | ||
{ | ||
public string Profile { get; set; } | ||
public string Region { get; set; } | ||
public string QueueUrl { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters