Skip to content

Commit

Permalink
feat: add service specific AuthSchemePlugin and DefaultAWSAuthSchemeP…
Browse files Browse the repository at this point in the history
…lugin (#1378)

* feat: feat: add service specific AuthSchemePlugin and DefaultAWSAuthSchemePlugin

* feat: add client changes
  • Loading branch information
AndrewFossAWS authored Mar 7, 2024
1 parent d67f716 commit 10eb823
Show file tree
Hide file tree
Showing 765 changed files with 21,679 additions and 6,077 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class DefaultAWSClientPlugin: Plugin {
& AWSDefaultClientConfiguration
& AWSRegionClientConfiguration {
config.retryStrategyOptions = try AWSClientConfigDefaultsProvider.retryStrategyOptions()
config.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
}
}
}
18 changes: 2 additions & 16 deletions Sources/Services/AWSACM/ACMClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ extension ACMClient {
public static func builder() -> ClientBuilder<ACMClient> {
return ClientBuilder<ACMClient>(defaultPlugins: [
ClientRuntime.DefaultClientPlugin(),
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName)
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName),
DefaultAWSAuthSchemePlugin()
])
}
}
Expand All @@ -135,21 +136,6 @@ public struct ACMClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory {
}
}

public class EndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMClient.ACMClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

extension ACMClient {
/// Performs the `AddTagsToCertificate` operation on the `CertificateManager` service.
///
Expand Down
55 changes: 55 additions & 0 deletions Sources/Services/AWSACM/Plugins.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

@_spi(FileBasedConfig) import AWSClientRuntime
import ClientRuntime

public class ACMClientEndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMClient.ACMClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

public class DefaultAWSAuthSchemePlugin: Plugin {
public init() {
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMClient.ACMClientConfiguration {
config.authSchemeResolver = DefaultACMAuthSchemeResolver()
config.authSchemes = [SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
}
}
}

public class ACMClientAuthSchemePlugin: Plugin {
private var authSchemes: [ClientRuntime.AuthScheme]?
private var authSchemeResolver: ClientRuntime.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)?
public init(authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ACMAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMClient.ACMClientConfiguration {
if (self.authSchemes != nil) {
config.authSchemes = self.authSchemes
}
if (self.authSchemeResolver != nil) {
config.authSchemeResolver = self.authSchemeResolver!
}
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
}
}
}
18 changes: 2 additions & 16 deletions Sources/Services/AWSACMPCA/ACMPCAClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ extension ACMPCAClient {
public static func builder() -> ClientBuilder<ACMPCAClient> {
return ClientBuilder<ACMPCAClient>(defaultPlugins: [
ClientRuntime.DefaultClientPlugin(),
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName)
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName),
DefaultAWSAuthSchemePlugin()
])
}
}
Expand All @@ -135,21 +136,6 @@ public struct ACMPCAClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFactory
}
}

public class EndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMPCAClient.ACMPCAClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

extension ACMPCAClient {
/// Performs the `CreateCertificateAuthority` operation on the `ACMPrivateCA` service.
///
Expand Down
55 changes: 55 additions & 0 deletions Sources/Services/AWSACMPCA/Plugins.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

@_spi(FileBasedConfig) import AWSClientRuntime
import ClientRuntime

public class ACMPCAClientEndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMPCAClient.ACMPCAClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

public class DefaultAWSAuthSchemePlugin: Plugin {
public init() {
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMPCAClient.ACMPCAClientConfiguration {
config.authSchemeResolver = DefaultACMPCAAuthSchemeResolver()
config.authSchemes = [SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
}
}
}

public class ACMPCAClientAuthSchemePlugin: Plugin {
private var authSchemes: [ClientRuntime.AuthScheme]?
private var authSchemeResolver: ClientRuntime.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)?
public init(authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ACMPCAAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ACMPCAClient.ACMPCAClientConfiguration {
if (self.authSchemes != nil) {
config.authSchemes = self.authSchemes
}
if (self.authSchemeResolver != nil) {
config.authSchemeResolver = self.authSchemeResolver!
}
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
}
}
}
18 changes: 2 additions & 16 deletions Sources/Services/AWSAPIGateway/APIGatewayClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ extension APIGatewayClient {
public static func builder() -> ClientBuilder<APIGatewayClient> {
return ClientBuilder<APIGatewayClient>(defaultPlugins: [
ClientRuntime.DefaultClientPlugin(),
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName)
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName),
DefaultAWSAuthSchemePlugin()
])
}
}
Expand All @@ -135,21 +136,6 @@ public struct APIGatewayClientLogHandlerFactory: ClientRuntime.SDKLogHandlerFact
}
}

public class EndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? APIGatewayClient.APIGatewayClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

extension APIGatewayClient {
/// Performs the `CreateApiKey` operation on the `BackplaneControlService` service.
///
Expand Down
55 changes: 55 additions & 0 deletions Sources/Services/AWSAPIGateway/Plugins.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

@_spi(FileBasedConfig) import AWSClientRuntime
import ClientRuntime

public class APIGatewayClientEndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? APIGatewayClient.APIGatewayClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

public class DefaultAWSAuthSchemePlugin: Plugin {
public init() {
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? APIGatewayClient.APIGatewayClientConfiguration {
config.authSchemeResolver = DefaultAPIGatewayAuthSchemeResolver()
config.authSchemes = [SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
}
}
}

public class APIGatewayClientAuthSchemePlugin: Plugin {
private var authSchemes: [ClientRuntime.AuthScheme]?
private var authSchemeResolver: ClientRuntime.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)?
public init(authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: APIGatewayAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? APIGatewayClient.APIGatewayClientConfiguration {
if (self.authSchemes != nil) {
config.authSchemes = self.authSchemes
}
if (self.authSchemeResolver != nil) {
config.authSchemeResolver = self.authSchemeResolver!
}
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
}
}
}
18 changes: 2 additions & 16 deletions Sources/Services/AWSARCZonalShift/ARCZonalShiftClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ extension ARCZonalShiftClient {
public static func builder() -> ClientBuilder<ARCZonalShiftClient> {
return ClientBuilder<ARCZonalShiftClient>(defaultPlugins: [
ClientRuntime.DefaultClientPlugin(),
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName)
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName),
DefaultAWSAuthSchemePlugin()
])
}
}
Expand All @@ -135,21 +136,6 @@ public struct ARCZonalShiftClientLogHandlerFactory: ClientRuntime.SDKLogHandlerF
}
}

public class EndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ARCZonalShiftClient.ARCZonalShiftClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

extension ARCZonalShiftClient {
/// Performs the `CancelZonalShift` operation on the `PercDataPlane` service.
///
Expand Down
55 changes: 55 additions & 0 deletions Sources/Services/AWSARCZonalShift/Plugins.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

@_spi(FileBasedConfig) import AWSClientRuntime
import ClientRuntime

public class ARCZonalShiftClientEndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ARCZonalShiftClient.ARCZonalShiftClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

public class DefaultAWSAuthSchemePlugin: Plugin {
public init() {
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ARCZonalShiftClient.ARCZonalShiftClientConfiguration {
config.authSchemeResolver = DefaultARCZonalShiftAuthSchemeResolver()
config.authSchemes = [SigV4AuthScheme()]
config.awsCredentialIdentityResolver = try AWSClientConfigDefaultsProvider.awsCredentialIdentityResolver()
}
}
}

public class ARCZonalShiftClientAuthSchemePlugin: Plugin {
private var authSchemes: [ClientRuntime.AuthScheme]?
private var authSchemeResolver: ClientRuntime.AuthSchemeResolver?
private var awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)?
public init(authSchemes: [ClientRuntime.AuthScheme]? = nil, authSchemeResolver: ARCZonalShiftAuthSchemeResolver? = nil, awsCredentialIdentityResolver: (any AWSClientRuntime.AWSCredentialIdentityResolver)? = nil) {
self.authSchemeResolver = authSchemeResolver
self.authSchemes = authSchemes
self.awsCredentialIdentityResolver = awsCredentialIdentityResolver
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? ARCZonalShiftClient.ARCZonalShiftClientConfiguration {
if (self.authSchemes != nil) {
config.authSchemes = self.authSchemes
}
if (self.authSchemeResolver != nil) {
config.authSchemeResolver = self.authSchemeResolver!
}
if (self.awsCredentialIdentityResolver != nil) {
config.awsCredentialIdentityResolver = self.awsCredentialIdentityResolver!
}
}
}
}
18 changes: 2 additions & 16 deletions Sources/Services/AWSAccessAnalyzer/AccessAnalyzerClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ extension AccessAnalyzerClient {
public static func builder() -> ClientBuilder<AccessAnalyzerClient> {
return ClientBuilder<AccessAnalyzerClient>(defaultPlugins: [
ClientRuntime.DefaultClientPlugin(),
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName)
AWSClientRuntime.DefaultAWSClientPlugin(clientName: self.clientName),
DefaultAWSAuthSchemePlugin()
])
}
}
Expand All @@ -135,21 +136,6 @@ public struct AccessAnalyzerClientLogHandlerFactory: ClientRuntime.SDKLogHandler
}
}

public class EndpointPlugin: Plugin {
private var endpointResolver: EndpointResolver
public init(endpointResolver: EndpointResolver) {
self.endpointResolver = endpointResolver
}
public convenience init() throws {
self.init(endpointResolver: try DefaultEndpointResolver())
}
public func configureClient(clientConfiguration: ClientRuntime.ClientConfiguration) throws {
if var config = clientConfiguration as? AccessAnalyzerClient.AccessAnalyzerClientConfiguration {
config.endpointResolver = self.endpointResolver
}
}
}

extension AccessAnalyzerClient {
/// Performs the `ApplyArchiveRule` operation on the `AccessAnalyzer` service.
///
Expand Down
Loading

0 comments on commit 10eb823

Please sign in to comment.