Skip to content

Commit

Permalink
Merge branch 'main' into day/retry-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dayaffe authored May 15, 2024
2 parents f705cfe + a0b43f0 commit fe44313
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 121 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ abstract class DefaultHTTPProtocolCustomizations : HTTPProtocolCustomizable {
writer: SwiftWriter,
serviceConfig: ServiceConfig
): HttpProtocolServiceClient {
val clientProperties = getClientProperties()
return HttpProtocolServiceClient(ctx, writer, clientProperties, serviceConfig)
return HttpProtocolServiceClient(ctx, writer, serviceConfig)
}

override fun renderEventStreamAttributes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ interface HTTPProtocolCustomizable {
op: OperationShape
)

fun getClientProperties(): List<ClientProperty> {
return emptyList()
}

fun serviceClient(
ctx: ProtocolGenerator.GenerationContext,
writer: SwiftWriter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import software.amazon.smithy.utils.CodeSection
open class HttpProtocolServiceClient(
private val ctx: ProtocolGenerator.GenerationContext,
private val writer: SwiftWriter,
private val properties: List<ClientProperty>,
private val serviceConfig: ServiceConfig
) {
private val serviceName: String = ctx.settings.sdkId
Expand All @@ -31,10 +30,7 @@ open class HttpProtocolServiceClient(
writer.write("let config: \$L", serviceConfig.typeName)
writer.write("let serviceName = \$S", serviceName)
writer.write("")
properties.forEach { prop ->
prop.addImportsAndDependencies(writer)
}
renderInitFunction(properties)
renderInitFunction()
writer.write("")
renderConvenienceInitFunctions(serviceSymbol)
}
Expand All @@ -44,21 +40,12 @@ open class HttpProtocolServiceClient(
renderServiceSpecificPlugins()
}

open fun renderInitFunction(properties: List<ClientProperty>) {
open fun renderInitFunction() {
writer.openBlock("public required init(config: \$L) {", "}", serviceConfig.typeName) {
writer.write(
"client = \$N(engine: config.httpClientEngine, config: config.httpClientConfiguration)",
ClientRuntimeTypes.Http.SdkHttpClient
)

properties.forEach { prop ->
prop.renderInstantiation(writer)
if (prop.needsConfigure) {
prop.renderConfiguration(writer)
}
prop.renderInitialization(writer, "config")
}

writer.write("self.config = config")
}
writer.write("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ class MiddlewareShapeUtils {
return inputShape.members().any { it.isInHttpBody() }
}

fun bodyIsHttpPayload(model: Model, op: OperationShape): Boolean {
// a special type in smithy where body only has one member and is typically bytes
val bindingIndex = HttpBindingIndex.of(model)
val requestBindings = bindingIndex.getRequestBindings(op).values.map { HttpBindingDescriptor(it) }
return requestBindings.firstOrNull { it.location == HttpBinding.Location.PAYLOAD } != null
}

fun hasHttpHeaders(model: Model, op: OperationShape): Boolean {
val bindingIndex = HttpBindingIndex.of(model)
val requestBindings = bindingIndex.getRequestBindings(op).values.map { HttpBindingDescriptor(it) }
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit fe44313

Please sign in to comment.