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 after merging identity & auth #1368

Merged
merged 2 commits into from
Feb 28, 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
  •  
  •  
  •  
8 changes: 7 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ func addIntegrationTestTarget(_ name: String) {
"Resources/ECSIntegTestApp/"
]
case "AWSS3":
additionalDependencies = ["AWSSSOAdmin"]
additionalDependencies = ["AWSSSOAdmin", "AWSS3Control", "AWSSTS"]
case "AWSEventBridge":
additionalDependencies = ["AWSRoute53"]
case "AWSCloudFrontKeyValueStore":
additionalDependencies = ["AWSCloudFront"]
case "AWSSTS":
additionalDependencies = ["AWSIAM", "AWSCognitoIdentity"]
default:
Expand Down Expand Up @@ -622,7 +626,9 @@ let serviceTargets: [String] = [
addAllServices()

let servicesWithIntegrationTests: [String] = [
"AWSCloudFrontKeyValueStore",
"AWSECS",
"AWSEventBridge",
"AWSKinesis",
"AWSMediaConvert",
"AWSS3",
Expand Down
174 changes: 120 additions & 54 deletions Sources/Services/AWSACM/ACMClient.swift

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions Sources/Services/AWSACM/AuthSchemeResolver.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

import ClientRuntime

public struct ACMAuthSchemeResolverParameters: ClientRuntime.AuthSchemeResolverParameters {
public let operation: String
// Region is used for SigV4 auth scheme
public let region: String?
}

public protocol ACMAuthSchemeResolver: ClientRuntime.AuthSchemeResolver {
// Intentionally empty.
// This is the parent protocol that all auth scheme resolver implementations of
// the service ACM must conform to.
}

public struct DefaultACMAuthSchemeResolver: ACMAuthSchemeResolver {
public func resolveAuthScheme(params: ClientRuntime.AuthSchemeResolverParameters) throws -> [AuthOption] {
var validAuthOptions = [AuthOption]()
guard let serviceParams = params as? ACMAuthSchemeResolverParameters else {
throw ClientError.authError("Service specific auth scheme parameters type must be passed to auth scheme resolver.")
}
switch serviceParams.operation {
default:
var sigV4Option = AuthOption(schemeID: "aws.auth#sigv4")
sigV4Option.signingProperties.set(key: AttributeKeys.signingName, value: "acm")
guard let region = serviceParams.region else {
throw ClientError.authError("Missing region in auth scheme parameters for SigV4 auth scheme.")
}
sigV4Option.signingProperties.set(key: AttributeKeys.signingRegion, value: region)
validAuthOptions.append(sigV4Option)
}
return validAuthOptions
}

public func constructParameters(context: HttpContext) throws -> ClientRuntime.AuthSchemeResolverParameters {
guard let opName = context.getOperation() else {
throw ClientError.dataNotFound("Operation name not configured in middleware context for auth scheme resolver params construction.")
}
let opRegion = context.getRegion()
return ACMAuthSchemeResolverParameters(operation: opName, region: opRegion)
}
}
6 changes: 3 additions & 3 deletions Sources/Services/AWSACM/EndpointResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ public struct EndpointResolverMiddleware<OperationStackOutput>: ClientRuntime.Mi
}

if let signingRegion = signingRegion {
context.attributes.set(key: HttpContext.signingRegion, value: signingRegion)
context.attributes.set(key: AttributeKeys.signingRegion, value: signingRegion)
}
if let signingName = signingName {
context.attributes.set(key: HttpContext.signingName, value: signingName)
context.attributes.set(key: AttributeKeys.signingName, value: signingName)
}
if let signingAlgorithm = signingAlgorithm {
context.attributes.set(key: HttpContext.signingAlgorithm, value: signingAlgorithm)
context.attributes.set(key: AttributeKeys.signingAlgorithm, value: AWSSigningAlgorithm(rawValue: signingAlgorithm))
}

if let headers = endpoint.headers {
Expand Down
254 changes: 176 additions & 78 deletions Sources/Services/AWSACMPCA/ACMPCAClient.swift

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions Sources/Services/AWSACMPCA/AuthSchemeResolver.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

import ClientRuntime

public struct ACMPCAAuthSchemeResolverParameters: ClientRuntime.AuthSchemeResolverParameters {
public let operation: String
// Region is used for SigV4 auth scheme
public let region: String?
}

public protocol ACMPCAAuthSchemeResolver: ClientRuntime.AuthSchemeResolver {
// Intentionally empty.
// This is the parent protocol that all auth scheme resolver implementations of
// the service ACMPCA must conform to.
}

public struct DefaultACMPCAAuthSchemeResolver: ACMPCAAuthSchemeResolver {
public func resolveAuthScheme(params: ClientRuntime.AuthSchemeResolverParameters) throws -> [AuthOption] {
var validAuthOptions = [AuthOption]()
guard let serviceParams = params as? ACMPCAAuthSchemeResolverParameters else {
throw ClientError.authError("Service specific auth scheme parameters type must be passed to auth scheme resolver.")
}
switch serviceParams.operation {
default:
var sigV4Option = AuthOption(schemeID: "aws.auth#sigv4")
sigV4Option.signingProperties.set(key: AttributeKeys.signingName, value: "acm-pca")
guard let region = serviceParams.region else {
throw ClientError.authError("Missing region in auth scheme parameters for SigV4 auth scheme.")
}
sigV4Option.signingProperties.set(key: AttributeKeys.signingRegion, value: region)
validAuthOptions.append(sigV4Option)
}
return validAuthOptions
}

public func constructParameters(context: HttpContext) throws -> ClientRuntime.AuthSchemeResolverParameters {
guard let opName = context.getOperation() else {
throw ClientError.dataNotFound("Operation name not configured in middleware context for auth scheme resolver params construction.")
}
let opRegion = context.getRegion()
return ACMPCAAuthSchemeResolverParameters(operation: opName, region: opRegion)
}
}
6 changes: 3 additions & 3 deletions Sources/Services/AWSACMPCA/EndpointResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ public struct EndpointResolverMiddleware<OperationStackOutput>: ClientRuntime.Mi
}

if let signingRegion = signingRegion {
context.attributes.set(key: HttpContext.signingRegion, value: signingRegion)
context.attributes.set(key: AttributeKeys.signingRegion, value: signingRegion)
}
if let signingName = signingName {
context.attributes.set(key: HttpContext.signingName, value: signingName)
context.attributes.set(key: AttributeKeys.signingName, value: signingName)
}
if let signingAlgorithm = signingAlgorithm {
context.attributes.set(key: HttpContext.signingAlgorithm, value: signingAlgorithm)
context.attributes.set(key: AttributeKeys.signingAlgorithm, value: AWSSigningAlgorithm(rawValue: signingAlgorithm))
}

if let headers = endpoint.headers {
Expand Down
Loading
Loading