Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove client properties feature #726

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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.

Loading