Skip to content

Commit

Permalink
Remove generated code from .git/info/exclude.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sichan Yoo committed Jan 12, 2024
1 parent df3db69 commit e195512
Show file tree
Hide file tree
Showing 2,617 changed files with 5,668,096 additions and 0 deletions.
916 changes: 916 additions & 0 deletions Sources/Services/AWSACM/ACMClient.swift

Large diffs are not rendered by default.

279 changes: 279 additions & 0 deletions Sources/Services/AWSACM/ACMClientProtocol.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)
}
}
153 changes: 153 additions & 0 deletions Sources/Services/AWSACM/EndpointResolver.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

import AWSClientRuntime
import ClientRuntime

public struct EndpointParams {
/// Override the endpoint used to send this request
public let endpoint: Swift.String?
/// The AWS region used to dispatch the request.
public let region: Swift.String?
/// When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
public let useDualStack: Swift.Bool
/// When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
public let useFIPS: Swift.Bool

public init(
endpoint: Swift.String? = nil,
region: Swift.String? = nil,
useDualStack: Swift.Bool = false,
useFIPS: Swift.Bool = false
)
{
self.endpoint = endpoint
self.region = region
self.useDualStack = useDualStack
self.useFIPS = useFIPS
}
}

public protocol EndpointResolver {
func resolve(params: EndpointParams) throws -> ClientRuntime.Endpoint
}

public struct DefaultEndpointResolver: EndpointResolver {

private let engine: AWSClientRuntime.AWSEndpointsRuleEngine
private let ruleSet = "{\"version\":\"1.0\",\"parameters\":{\"Region\":{\"builtIn\":\"AWS::Region\",\"required\":false,\"documentation\":\"The AWS region used to dispatch the request.\",\"type\":\"String\"},\"UseDualStack\":{\"builtIn\":\"AWS::UseDualStack\",\"required\":true,\"default\":false,\"documentation\":\"When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.\",\"type\":\"Boolean\"},\"UseFIPS\":{\"builtIn\":\"AWS::UseFIPS\",\"required\":true,\"default\":false,\"documentation\":\"When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.\",\"type\":\"Boolean\"},\"Endpoint\":{\"builtIn\":\"SDK::Endpoint\",\"required\":false,\"documentation\":\"Override the endpoint used to send this request\",\"type\":\"String\"}},\"rules\":[{\"conditions\":[{\"fn\":\"isSet\",\"argv\":[{\"ref\":\"Endpoint\"}]}],\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]}],\"error\":\"Invalid Configuration: FIPS and custom endpoint are not supported\",\"type\":\"error\"},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseDualStack\"},true]}],\"error\":\"Invalid Configuration: Dualstack and custom endpoint are not supported\",\"type\":\"error\"},{\"conditions\":[],\"endpoint\":{\"url\":{\"ref\":\"Endpoint\"},\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}],\"type\":\"tree\"},{\"conditions\":[{\"fn\":\"isSet\",\"argv\":[{\"ref\":\"Region\"}]}],\"rules\":[{\"conditions\":[{\"fn\":\"aws.partition\",\"argv\":[{\"ref\":\"Region\"}],\"assign\":\"PartitionResult\"}],\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]},{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseDualStack\"},true]}],\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsFIPS\"]}]},{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsDualStack\"]}]}],\"rules\":[{\"conditions\":[],\"endpoint\":{\"url\":\"https://acm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}],\"type\":\"tree\"},{\"conditions\":[],\"error\":\"FIPS and DualStack are enabled, but this partition does not support one or both\",\"type\":\"error\"}],\"type\":\"tree\"},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]}],\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsFIPS\"]},true]}],\"rules\":[{\"conditions\":[{\"fn\":\"stringEquals\",\"argv\":[{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"name\"]},\"aws-us-gov\"]}],\"endpoint\":{\"url\":\"https://acm.{Region}.amazonaws.com\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"},{\"conditions\":[],\"endpoint\":{\"url\":\"https://acm-fips.{Region}.{PartitionResult#dnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}],\"type\":\"tree\"},{\"conditions\":[],\"error\":\"FIPS is enabled but this partition does not support FIPS\",\"type\":\"error\"}],\"type\":\"tree\"},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseDualStack\"},true]}],\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsDualStack\"]}]}],\"rules\":[{\"conditions\":[],\"endpoint\":{\"url\":\"https://acm.{Region}.{PartitionResult#dualStackDnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}],\"type\":\"tree\"},{\"conditions\":[],\"error\":\"DualStack is enabled but this partition does not support DualStack\",\"type\":\"error\"}],\"type\":\"tree\"},{\"conditions\":[],\"endpoint\":{\"url\":\"https://acm.{Region}.{PartitionResult#dnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}],\"type\":\"tree\"}],\"type\":\"tree\"},{\"conditions\":[],\"error\":\"Invalid Configuration: Missing Region\",\"type\":\"error\"}]}"

public init() throws {
engine = try AWSClientRuntime.AWSEndpointsRuleEngine(ruleSet: ruleSet)
}

public func resolve(params: EndpointParams) throws -> ClientRuntime.Endpoint {
let context = try AWSClientRuntime.AWSEndpointsRequestContext()
try context.add(name: "Endpoint", value: params.endpoint)
try context.add(name: "Region", value: params.region)
try context.add(name: "UseDualStack", value: params.useDualStack)
try context.add(name: "UseFIPS", value: params.useFIPS)

guard let crtResolvedEndpoint = try engine.resolve(context: context) else {
throw EndpointError.unresolved("Failed to resolved endpoint")
}

if crtResolvedEndpoint.getType() == .error {
let error = crtResolvedEndpoint.getError()
throw EndpointError.unresolved(error)
}

guard let url = crtResolvedEndpoint.getURL() else {
assertionFailure("This must be a bug in either CRT or the rule engine, if the endpoint is not an error, it must have a url")
throw EndpointError.unresolved("Failed to resolved endpoint")
}

let headers = crtResolvedEndpoint.getHeaders() ?? [:]
let properties = crtResolvedEndpoint.getProperties() ?? [:]
return try Endpoint(urlString: url, headers: Headers(headers), properties: properties)
}
}

public struct EndpointResolverMiddleware<OperationStackOutput>: ClientRuntime.Middleware {
public let id: Swift.String = "EndpointResolverMiddleware"

let endpointResolver: EndpointResolver

let endpointParams: EndpointParams

let authSchemeResolver: AWSClientRuntime.AuthSchemeResolver

public init(endpointResolver: EndpointResolver, endpointParams: EndpointParams, authSchemeResolver: AWSClientRuntime.AuthSchemeResolver = AWSClientRuntime.DefaultAuthSchemeResolver()) {
self.endpointResolver = endpointResolver
self.endpointParams = endpointParams
self.authSchemeResolver = authSchemeResolver
}

public func handle<H>(context: Context,
input: ClientRuntime.SdkHttpRequestBuilder,
next: H) async throws -> ClientRuntime.OperationOutput<OperationStackOutput>
where H: Handler,
Self.MInput == H.Input,
Self.MOutput == H.Output,
Self.Context == H.Context
{
let endpoint = try endpointResolver.resolve(params: endpointParams)

var signingName: String? = nil
var signingRegion: String? = nil
var signingAlgorithm: String? = nil
if let authSchemes = endpoint.authSchemes() {
let schemes = try authSchemes.map { try AuthScheme(from: $0) }
let authScheme = try authSchemeResolver.resolve(authSchemes: schemes)
signingAlgorithm = authScheme.name
switch authScheme {
case .sigV4(let param):
signingName = param.signingName
signingRegion = param.signingRegion
case .sigV4A(let param):
signingName = param.signingName
signingRegion = param.signingRegionSet?.first
case .none:
break
}
}

let awsEndpoint = AWSEndpoint(endpoint: endpoint, signingName: signingName, signingRegion: signingRegion)

var host = ""
if let hostOverride = context.getHost() {
host = hostOverride
} else {
host = "\(context.getHostPrefix() ?? "")\(awsEndpoint.endpoint.host)"
}

if let protocolType = awsEndpoint.endpoint.protocolType {
input.withProtocol(protocolType)
}

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

if let headers = endpoint.headers {
input.withHeaders(headers)
}

input.withMethod(context.getMethod())
.withHost(host)
.withPort(awsEndpoint.endpoint.port)
.withPath(awsEndpoint.endpoint.path.appendingPathComponent(context.getPath()))
.withHeader(name: "Host", value: host)

return try await next.handle(context: context, input: input)
}

public typealias MInput = ClientRuntime.SdkHttpRequestBuilder
public typealias MOutput = ClientRuntime.OperationOutput<OperationStackOutput>
public typealias Context = ClientRuntime.HttpContext
}
38 changes: 38 additions & 0 deletions Sources/Services/AWSACM/Paginators.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

import ClientRuntime

extension ACMClient {
/// Paginate over `[ListCertificatesOutput]` results.
///
/// When this operation is called, an `AsyncSequence` is created. AsyncSequences are lazy so no service
/// calls are made until the sequence is iterated over. This also means there is no guarantee that the request is valid
/// until then. If there are errors in your request, you will see the failures only after you start iterating.
/// - Parameters:
/// - input: A `[ListCertificatesInput]` to start pagination
/// - Returns: An `AsyncSequence` that can iterate over `ListCertificatesOutput`
public func listCertificatesPaginated(input: ListCertificatesInput) -> ClientRuntime.PaginatorSequence<ListCertificatesInput, ListCertificatesOutput> {
return ClientRuntime.PaginatorSequence<ListCertificatesInput, ListCertificatesOutput>(input: input, inputKey: \.nextToken, outputKey: \.nextToken, paginationFunction: self.listCertificates(input:))
}
}

extension ListCertificatesInput: ClientRuntime.PaginateToken {
public func usingPaginationToken(_ token: Swift.String) -> ListCertificatesInput {
return ListCertificatesInput(
certificateStatuses: self.certificateStatuses,
includes: self.includes,
maxItems: self.maxItems,
nextToken: token,
sortBy: self.sortBy,
sortOrder: self.sortOrder
)}
}

extension PaginatorSequence where OperationStackInput == ListCertificatesInput, OperationStackOutput == ListCertificatesOutput {
/// This paginator transforms the `AsyncSequence` returned by `listCertificatesPaginated`
/// to access the nested member `[ACMClientTypes.CertificateSummary]`
/// - Returns: `[ACMClientTypes.CertificateSummary]`
public func certificateSummaryList() async throws -> [ACMClientTypes.CertificateSummary] {
return try await self.asyncCompactMap { item in item.certificateSummaryList }
}
}
67 changes: 67 additions & 0 deletions Sources/Services/AWSACM/Waiters.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Code generated by smithy-swift-codegen. DO NOT EDIT!

import ClientRuntime

extension ACMClientProtocol {

static func certificateValidatedWaiterConfig() throws -> WaiterConfiguration<DescribeCertificateInput, DescribeCertificateOutput> {
let acceptors: [WaiterConfiguration<DescribeCertificateInput, DescribeCertificateOutput>.Acceptor] = [
.init(state: .success, matcher: { (input: DescribeCertificateInput, result: Result<DescribeCertificateOutput, Error>) -> Bool in
// JMESPath expression: "Certificate.DomainValidationOptions[].ValidationStatus"
// JMESPath comparator: "allStringEquals"
// JMESPath expected value: "SUCCESS"
guard case .success(let output) = result else { return false }
let certificate = output.certificate
let domainValidationOptions = certificate?.domainValidationOptions
let projection: [ACMClientTypes.DomainStatus]? = domainValidationOptions?.compactMap { original in
let validationStatus = original.validationStatus
return validationStatus
}
return (projection?.count ?? 0) > 1 && (projection?.allSatisfy { JMESUtils.compare($0, ==, "SUCCESS") } ?? false)
}),
.init(state: .retry, matcher: { (input: DescribeCertificateInput, result: Result<DescribeCertificateOutput, Error>) -> Bool in
// JMESPath expression: "Certificate.DomainValidationOptions[].ValidationStatus"
// JMESPath comparator: "anyStringEquals"
// JMESPath expected value: "PENDING_VALIDATION"
guard case .success(let output) = result else { return false }
let certificate = output.certificate
let domainValidationOptions = certificate?.domainValidationOptions
let projection: [ACMClientTypes.DomainStatus]? = domainValidationOptions?.compactMap { original in
let validationStatus = original.validationStatus
return validationStatus
}
return projection?.contains(where: { JMESUtils.compare($0, ==, "PENDING_VALIDATION") }) ?? false
}),
.init(state: .failure, matcher: { (input: DescribeCertificateInput, result: Result<DescribeCertificateOutput, Error>) -> Bool in
// JMESPath expression: "Certificate.Status"
// JMESPath comparator: "stringEquals"
// JMESPath expected value: "FAILED"
guard case .success(let output) = result else { return false }
let certificate = output.certificate
let status = certificate?.status
return JMESUtils.compare(status, ==, "FAILED")
}),
.init(state: .failure, matcher: { (input: DescribeCertificateInput, result: Result<DescribeCertificateOutput, Error>) -> Bool in
guard case .failure(let error) = result else { return false }
return (error as? ServiceError)?.typeName == "ResourceNotFoundException"
}),
]
return try WaiterConfiguration<DescribeCertificateInput, DescribeCertificateOutput>(acceptors: acceptors, minDelay: 60.0, maxDelay: 120.0)
}

/// Initiates waiting for the CertificateValidated event on the describeCertificate operation.
/// The operation will be tried and (if necessary) retried until the wait succeeds, fails, or times out.
/// Returns a `WaiterOutcome` asynchronously on waiter success, throws an error asynchronously on
/// waiter failure or timeout.
/// - Parameters:
/// - options: `WaiterOptions` to be used to configure this wait.
/// - input: The `DescribeCertificateInput` object to be used as a parameter when performing the operation.
/// - Returns: A `WaiterOutcome` with the result of the final, successful performance of the operation.
/// - Throws: `WaiterFailureError` if the waiter fails due to matching an `Acceptor` with state `failure`
/// or there is an error not handled by any `Acceptor.`
/// `WaiterTimeoutError` if the waiter times out.
public func waitUntilCertificateValidated(options: WaiterOptions, input: DescribeCertificateInput) async throws -> WaiterOutcome<DescribeCertificateOutput> {
let waiter = Waiter(config: try Self.certificateValidatedWaiterConfig(), operation: self.describeCertificate(input:))
return try await waiter.waitUntil(options: options, input: input)
}
}
Loading

0 comments on commit e195512

Please sign in to comment.