Skip to content

Commit

Permalink
Make presign to return URLRequest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sichan Yoo committed Oct 31, 2023
1 parent 75f363b commit 54b01c6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Sources/Services/AWSPolly/PollyClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ extension PollyClient {
}

extension PollyClient {
public func presignRequestForSynthesizeSpeech(input: SynthesizeSpeechInput, expiration: Foundation.TimeInterval) async throws -> ClientRuntime.SdkHttpRequest {
public func presignRequestForSynthesizeSpeech(input: SynthesizeSpeechInput, expiration: Foundation.TimeInterval) async throws -> URLRequest {
guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {
throw ClientError.unknownError("Returned request from input.presign() was nil for the operation SynthesizeSpeech.")
}
return presignedRequest
return try await presignedRequest.toURLRequest()
}
}
12 changes: 6 additions & 6 deletions Sources/Services/AWSS3/S3Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5043,28 +5043,28 @@ extension S3Client {
}

extension S3Client {
public func presignRequestForGetObject(input: GetObjectInput, expiration: Foundation.TimeInterval) async throws -> ClientRuntime.SdkHttpRequest {
public func presignRequestForGetObject(input: GetObjectInput, expiration: Foundation.TimeInterval) async throws -> URLRequest {
guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {
throw ClientError.unknownError("Returned request from input.presign() was nil for the operation GetObject.")
}
return presignedRequest
return try await presignedRequest.toURLRequest()
}
}

extension S3Client {
public func presignRequestForPutObject(input: PutObjectInput, expiration: Foundation.TimeInterval) async throws -> ClientRuntime.SdkHttpRequest {
public func presignRequestForPutObject(input: PutObjectInput, expiration: Foundation.TimeInterval) async throws -> URLRequest {
guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {
throw ClientError.unknownError("Returned request from input.presign() was nil for the operation PutObject.")
}
return presignedRequest
return try await presignedRequest.toURLRequest()
}
}

extension S3Client {
public func presignRequestForUploadPart(input: UploadPartInput, expiration: Foundation.TimeInterval) async throws -> ClientRuntime.SdkHttpRequest {
public func presignRequestForUploadPart(input: UploadPartInput, expiration: Foundation.TimeInterval) async throws -> URLRequest {
guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {
throw ClientError.unknownError("Returned request from input.presign() was nil for the operation UploadPart.")
}
return presignedRequest
return try await presignedRequest.toURLRequest()
}
}
4 changes: 2 additions & 2 deletions Sources/Services/AWSSTS/STSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ extension STSClient: STSClientProtocol {
}

extension STSClient {
public func presignRequestForGetCallerIdentity(input: GetCallerIdentityInput, expiration: Foundation.TimeInterval) async throws -> ClientRuntime.SdkHttpRequest {
public func presignRequestForGetCallerIdentity(input: GetCallerIdentityInput, expiration: Foundation.TimeInterval) async throws -> URLRequest {
guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {
throw ClientError.unknownError("Returned request from input.presign() was nil for the operation GetCallerIdentity.")
}
return presignedRequest
return try await presignedRequest.toURLRequest()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ class PresignerGenerator : SwiftIntegration {
writer.apply {
openBlock("extension $clientName {", "}") {
val params = listOf("input: $inputType", "expiration: Foundation.TimeInterval")
val returnType = "ClientRuntime.SdkHttpRequest"
val returnType = "URLRequest"
openBlock("public func presignRequestFor${op.toUpperCamelCase()}(${params.joinToString()}) async throws -> $returnType {", "}") {
openBlock("guard let presignedRequest = try await input.presign(config: config, expiration: expiration) else {", "}") {
write("throw ClientError.unknownError(\"Returned request from input.presign() was nil for the operation ${op.toUpperCamelCase()}.\")")
}
write("return presignedRequest")
write("return try await presignedRequest.toURLRequest()")
}
}
}
Expand Down

0 comments on commit 54b01c6

Please sign in to comment.