33
44namespace S3Scenarios ;
55
6- // snippet-start:[S3.dotnetv4.CreatePresignedPostScenario ]
6+ // snippet-start:[S3.dotnetv4.CreatePresignedPostBasics ]
77/// <summary>
88/// Scenario demonstrating the complete workflow for presigned POST URLs:
99/// 1. Create an S3 bucket
1010/// 2. Create a presigned POST URL
1111/// 3. Upload a file using the presigned POST URL
1212/// 4. Clean up resources
1313/// </summary>
14- public class CreatePresignedPostScenario
14+ public class CreatePresignedPostBasics
1515{
1616 private readonly S3Wrapper _s3Wrapper ;
1717 private readonly ILogger _logger ;
@@ -27,7 +27,7 @@ public class CreatePresignedPostScenario
2727 /// <param name="logger">The logger to use.</param>
2828 /// <param name="uiMethods">The UI methods to use.</param>
2929 /// <param name="isInteractive">Whether to run in interactive mode.</param>
30- public CreatePresignedPostScenario ( S3Wrapper s3Wrapper , ILogger logger , UiMethods uiMethods , bool isInteractive )
30+ public CreatePresignedPostBasics ( S3Wrapper s3Wrapper , ILogger logger , UiMethods uiMethods , bool isInteractive )
3131 {
3232 _s3Wrapper = s3Wrapper ;
3333 _logger = logger ;
@@ -120,7 +120,7 @@ private async Task<CreatePresignedPostResponse> CreatePresignedPostAsync()
120120 Console . WriteLine ( $ "Creating presigned POST URL for { _bucketName } /{ _objectKey } ") ;
121121 Console . WriteLine ( $ "Expiration: { expiration } UTC") ;
122122
123- var response = await _s3Wrapper . CreatePresignedPostAsync ( _bucketName ! , _objectKey , expiration ) ;
123+ var response = await _s3Wrapper . CreatePresignedPostWithConditionsAsync ( _bucketName ! , _objectKey , expiration ) ;
124124
125125 Console . WriteLine ( "Successfully created presigned POST URL" ) ;
126126 return response ;
@@ -251,5 +251,16 @@ private async Task CleanupAsync()
251251 }
252252 }
253253 }
254+
255+ public static void DisplayPresignedPostFields ( CreatePresignedPostResponse response )
256+ {
257+ Console . WriteLine ( $ "Presigned POST URL: { response . Url } ") ;
258+ Console . WriteLine ( "Form fields to include:" ) ;
259+
260+ foreach ( var field in response . Fields )
261+ {
262+ Console . WriteLine ( $ " { field . Key } : { field . Value } ") ;
263+ }
264+ }
254265}
255- // snippet-end:[S3.dotnetv4.CreatePresignedPostScenario ]
266+ // snippet-end:[S3.dotnetv4.CreatePresignedPostBasics ]
0 commit comments