66// client used by an Amazon Web Services (AWS) service client.
77
88import  ArgumentParser
9- import  AWSClientRuntime 
9+ // snippet-start:[swift.http-config.imports] 
1010import  ClientRuntime
1111import  AWSS3
12- import  Foundation
1312import  SmithyHTTPAPI
1413import  AwsCommonRuntimeKit
14+ // snippet-end:[swift.http-config.imports]
1515
1616struct  ExampleCommand :  ParsableCommand  { 
1717    @Option ( help:  " Name of the Amazon Region to use " )  
@@ -28,14 +28,10 @@ struct ExampleCommand: ParsableCommand {
2828
2929    /// Called by ``main()`` to run the bulk of the example.
3030    func  runAsync( )  async  throws  { 
31-         //await SDKLoggingSystem().initialize(logLevel: .trace)
32-         //SDKDefaultIO.setLogLevel(level: .trace)
33-         // snippet-start:[swift.http-config.configure]
31+         // snippet-start:[swift.http-config.headers]
3432        let  config  =  try await  S3Client . S3ClientConfiguration ( 
3533            region:  region, 
3634            httpClientConfiguration:  HttpClientConfiguration ( 
37-                 connectTimeout:  2 , 
38-                 socketTimeout:  5 , 
3935                defaultHeaders:  Headers ( 
4036                    [ 
4137                        " X-My-Custom-Header " :  " CustomHeaderValue " , 
@@ -45,28 +41,30 @@ struct ExampleCommand: ParsableCommand {
4541            ) 
4642        ) 
4743        let  s3Client  =  S3Client ( config:  config) 
48-         // snippet-end:[swift.http-config.configure ]
44+         // snippet-end:[swift.http-config.headers ]
4945
50-         print ( " *** Getting list of buckets *** " ) 
51-         let  output :  ListBucketsOutput  =  try await  s3Client. listBuckets ( input:  ListBucketsInput ( ) ) 
46+         print ( " *** Getting list of buckets... " ) 
47+         _ =  try await  s3Client. listBuckets ( input:  ListBucketsInput ( ) ) 
48+         print ( " *** Success! \n " ) 
5249
53-         print ( " *** Getting bucket list with very short timeout ***  " ) 
50+         print ( " *** Getting bucket list with custom timeouts...  " ) 
5451
5552        // snippet-start: [swift.http-config.timeouts]
5653        do  { 
5754            let  config  =  try await  S3Client . S3ClientConfiguration ( 
5855                region:  region, 
5956                httpClientConfiguration:  HttpClientConfiguration ( 
60-                     connectTimeout:  0.001 , 
61-                     socketTimeout:  0.005 
57+                     connectTimeout:  2 , 
58+                     socketTimeout:  5 
6259                ) 
6360            ) 
6461            let  s3Client  =  S3Client ( config:  config) 
65-             let  output :  ListBucketsOutput  =  try await  s3Client. listBuckets ( input:  ListBucketsInput ( ) ) 
62+             _ =  try await  s3Client. listBuckets ( input:  ListBucketsInput ( ) ) 
63+             print ( " *** Success! " ) 
6664        }  catch  CommonRunTimeError . crtError( let  crtError)  { 
6765            print ( " *** An error occurred accessing the bucket list:  \( crtError. message) " ) 
6866        }  catch  { 
69-             print ( " *** Unexpected error requesting bucket list. " ) 
67+             print ( " *** Unexpected error occurred  requesting the  bucket list. " ) 
7068        } 
7169        // snippet-end: [swift.http-config.timeouts]
7270
0 commit comments