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: Codegen with bearer token changes #1649

Merged
merged 3 commits into from
Jul 26, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 28 additions & 7 deletions Sources/Services/AWSACM/Sources/AWSACM/ACMClient.swift

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Sources/Services/AWSACM/Sources/AWSACM/Plugins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import protocol ClientRuntime.ClientConfiguration
import protocol ClientRuntime.Plugin
import protocol SmithyHTTPAuthAPI.AuthSchemeResolver
import protocol SmithyIdentity.AWSCredentialIdentityResolver
import protocol SmithyIdentity.BearerTokenIdentityResolver
import struct AWSSDKHTTPAuth.SigV4AuthScheme
import struct SmithyIdentity.BearerTokenIdentity
import struct SmithyIdentity.StaticBearerTokenIdentityResolver
import typealias SmithyHTTPAuthAPI.AuthSchemes

public class ACMClientEndpointPlugin: Plugin {
Expand Down Expand Up @@ -42,6 +45,7 @@ public class DefaultAWSAuthSchemePlugin: ClientRuntime.Plugin {
config.authSchemeResolver = DefaultACMAuthSchemeResolver()
config.authSchemes = [AWSSDKHTTPAuth.SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientRuntime.AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
config.bearerTokenIdentityResolver = SmithyIdentity.StaticBearerTokenIdentityResolver(token: SmithyIdentity.BearerTokenIdentity(token: ""))
}
}
}
Expand All @@ -50,11 +54,13 @@ public class ACMClientAuthSchemePlugin: ClientRuntime.Plugin {
private var authSchemes: SmithyHTTPAuthAPI.AuthSchemes?
private var authSchemeResolver: SmithyHTTPAuthAPI.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)?
private var bearerTokenIdentityResolver: (any SmithyIdentity.BearerTokenIdentityResolver)?

public init(authSchemes: SmithyHTTPAuthAPI.AuthSchemes? = nil, authSchemeResolver: ACMAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)? = nil) {
public init(authSchemes: SmithyHTTPAuthAPI.AuthSchemes? = nil, authSchemeResolver: ACMAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)? = nil, bearerTokenIdentityResolver: (any SmithyIdentity.BearerTokenIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
self.bearerTokenIdentityResolver = bearerTokenIdentityResolver
}

public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
Expand All @@ -68,6 +74,9 @@ public class ACMClientAuthSchemePlugin: ClientRuntime.Plugin {
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
if (self.bearerTokenIdentityResolver != nil) {
config.bearerTokenIdentityResolver = self.bearerTokenIdentityResolver!
}
}
}
}
43 changes: 36 additions & 7 deletions Sources/Services/AWSACMPCA/Sources/AWSACMPCA/ACMPCAClient.swift

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Sources/Services/AWSACMPCA/Sources/AWSACMPCA/Plugins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import protocol ClientRuntime.ClientConfiguration
import protocol ClientRuntime.Plugin
import protocol SmithyHTTPAuthAPI.AuthSchemeResolver
import protocol SmithyIdentity.AWSCredentialIdentityResolver
import protocol SmithyIdentity.BearerTokenIdentityResolver
import struct AWSSDKHTTPAuth.SigV4AuthScheme
import struct SmithyIdentity.BearerTokenIdentity
import struct SmithyIdentity.StaticBearerTokenIdentityResolver
import typealias SmithyHTTPAuthAPI.AuthSchemes

public class ACMPCAClientEndpointPlugin: Plugin {
Expand Down Expand Up @@ -42,6 +45,7 @@ public class DefaultAWSAuthSchemePlugin: ClientRuntime.Plugin {
config.authSchemeResolver = DefaultACMPCAAuthSchemeResolver()
config.authSchemes = [AWSSDKHTTPAuth.SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientRuntime.AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
config.bearerTokenIdentityResolver = SmithyIdentity.StaticBearerTokenIdentityResolver(token: SmithyIdentity.BearerTokenIdentity(token: ""))
}
}
}
Expand All @@ -50,11 +54,13 @@ public class ACMPCAClientAuthSchemePlugin: ClientRuntime.Plugin {
private var authSchemes: SmithyHTTPAuthAPI.AuthSchemes?
private var authSchemeResolver: SmithyHTTPAuthAPI.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)?
private var bearerTokenIdentityResolver: (any SmithyIdentity.BearerTokenIdentityResolver)?

public init(authSchemes: SmithyHTTPAuthAPI.AuthSchemes? = nil, authSchemeResolver: ACMPCAAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)? = nil) {
public init(authSchemes: SmithyHTTPAuthAPI.AuthSchemes? = nil, authSchemeResolver: ACMPCAAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any SmithyIdentity.AWSCredentialIdentityResolver)? = nil, bearerTokenIdentityResolver: (any SmithyIdentity.BearerTokenIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
self.bearerTokenIdentityResolver = bearerTokenIdentityResolver
}

public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
Expand All @@ -68,6 +74,9 @@ public class ACMPCAClientAuthSchemePlugin: ClientRuntime.Plugin {
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
if (self.bearerTokenIdentityResolver != nil) {
config.bearerTokenIdentityResolver = self.bearerTokenIdentityResolver!
}
}
}
}
Loading
Loading