Skip to content

Commit

Permalink
chore: Updates version to 0.59.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sdk-swift-automation committed Aug 15, 2024
1 parent 043388b commit b2fdda3
Show file tree
Hide file tree
Showing 10 changed files with 574 additions and 160 deletions.
2 changes: 1 addition & 1 deletion Package.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.58.0
0.59.0
71 changes: 71 additions & 0 deletions Sources/Services/AWSDocDB/Sources/AWSDocDB/DocDBClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2690,6 +2690,77 @@ extension DocDBClient {
return try await op.execute(input: input)
}

/// Performs the `FailoverGlobalCluster` operation on the `AmazonRDSv19` service.
///
/// Promotes the specified secondary DB cluster to be the primary DB cluster in the global cluster when failing over a global cluster occurs. Use this operation to respond to an unplanned event, such as a regional disaster in the primary region. Failing over can result in a loss of write transaction data that wasn't replicated to the chosen secondary before the failover event occurred. However, the recovery process that promotes a DB instance on the chosen seconday DB cluster to be the primary writer DB instance guarantees that the data is in a transactionally consistent state.
///
/// - Parameter FailoverGlobalClusterInput : [no documentation found]
///
/// - Returns: `FailoverGlobalClusterOutput` : [no documentation found]
///
/// - Throws: One of the exceptions listed below __Possible Exceptions__.
///
/// __Possible Exceptions:__
/// - `DBClusterNotFoundFault` : DBClusterIdentifier doesn't refer to an existing cluster.
/// - `GlobalClusterNotFoundFault` : The GlobalClusterIdentifier doesn't refer to an existing global cluster.
/// - `InvalidDBClusterStateFault` : The cluster isn't in a valid state.
/// - `InvalidGlobalClusterStateFault` : The requested operation can't be performed while the cluster is in this state.
public func failoverGlobalCluster(input: FailoverGlobalClusterInput) async throws -> FailoverGlobalClusterOutput {
let context = Smithy.ContextBuilder()
.withMethod(value: .post)
.withServiceName(value: serviceName)
.withOperation(value: "failoverGlobalCluster")
.withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator)
.withLogger(value: config.logger)
.withPartitionID(value: config.partitionID)
.withAuthSchemes(value: config.authSchemes ?? [])
.withAuthSchemeResolver(value: config.authSchemeResolver)
.withUnsignedPayloadTrait(value: false)
.withSocketTimeout(value: config.httpClientConfiguration.socketTimeout)
.withIdentityResolver(value: config.bearerTokenIdentityResolver, schemeID: "smithy.api#httpBearerAuth")
.withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4")
.withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a")
.withRegion(value: config.region)
.withSigningName(value: "rds")
.withSigningRegion(value: config.signingRegion)
.build()
let builder = ClientRuntime.OrchestratorBuilder<FailoverGlobalClusterInput, FailoverGlobalClusterOutput, SmithyHTTPAPI.HTTPRequest, SmithyHTTPAPI.HTTPResponse>()
config.interceptorProviders.forEach { provider in
builder.interceptors.add(provider.create())
}
config.httpInterceptorProviders.forEach { provider in
let i: any ClientRuntime.HttpInterceptor<FailoverGlobalClusterInput, FailoverGlobalClusterOutput> = provider.create()
builder.interceptors.add(i)
}
builder.interceptors.add(ClientRuntime.URLPathMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>(FailoverGlobalClusterInput.urlPathProvider(_:)))
builder.interceptors.add(ClientRuntime.URLHostMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>())
builder.interceptors.add(ClientRuntime.ContentLengthMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>())
builder.deserialize(ClientRuntime.DeserializeMiddleware<FailoverGlobalClusterOutput>(FailoverGlobalClusterOutput.httpOutput(from:), FailoverGlobalClusterOutputError.httpError(from:)))
builder.interceptors.add(ClientRuntime.LoggerMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>(clientLogMode: config.clientLogMode))
builder.retryStrategy(SmithyRetries.DefaultRetryStrategy(options: config.retryStrategyOptions))
builder.retryErrorInfoProvider(AWSClientRuntime.AWSRetryErrorInfoProvider.errorInfo(for:))
builder.applySigner(ClientRuntime.SignerMiddleware<FailoverGlobalClusterOutput>())
let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false)
builder.applyEndpoint(AWSClientRuntime.EndpointResolverMiddleware<FailoverGlobalClusterOutput, EndpointParams>(endpointResolverBlock: { [config] in try config.endpointResolver.resolve(params: $0) }, endpointParams: endpointParams))
builder.interceptors.add(AWSClientRuntime.UserAgentMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0", config: config)))
builder.serialize(ClientRuntime.BodyMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput, SmithyFormURL.Writer>(rootNodeInfo: "", inputWritingClosure: FailoverGlobalClusterInput.write(value:to:)))
builder.interceptors.add(ClientRuntime.ContentTypeMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>(contentType: "application/x-www-form-urlencoded"))
builder.selectAuthScheme(ClientRuntime.AuthSchemeMiddleware<FailoverGlobalClusterOutput>())
builder.interceptors.add(AWSClientRuntime.AmzSdkInvocationIdMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>())
builder.interceptors.add(AWSClientRuntime.AmzSdkRequestMiddleware<FailoverGlobalClusterInput, FailoverGlobalClusterOutput>(maxRetries: config.retryStrategyOptions.maxRetriesBase))
var metricsAttributes = Smithy.Attributes()
metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.service, value: "DocDB")
metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.method, value: "FailoverGlobalCluster")
let op = builder.attributes(context)
.telemetry(ClientRuntime.OrchestratorTelemetry(
telemetryProvider: config.telemetryProvider,
metricsAttributes: metricsAttributes
))
.executeRequest(client)
.build()
return try await op.execute(input: input)
}

/// Performs the `ListTagsForResource` operation on the `AmazonRDSv19` service.
///
/// Lists all tags on an Amazon DocumentDB resource.
Expand Down
105 changes: 105 additions & 0 deletions Sources/Services/AWSDocDB/Sources/AWSDocDB/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4245,6 +4245,62 @@ public struct FailoverDBClusterOutput {
}
}

public struct FailoverGlobalClusterInput {
/// Specifies whether to allow data loss for this global cluster operation. Allowing data loss triggers a global failover operation. If you don't specify AllowDataLoss, the global cluster operation defaults to a switchover. Constraints:
///
/// * Can't be specified together with the Switchover parameter.
public var allowDataLoss: Swift.Bool?
/// The identifier of the Amazon DocumentDB global cluster to apply this operation. The identifier is the unique key assigned by the user when the cluster is created. In other words, it's the name of the global cluster. Constraints:
///
/// * Must match the identifier of an existing global cluster.
///
/// * Minimum length of 1. Maximum length of 255.
///
///
/// Pattern: [A-Za-z][0-9A-Za-z-:._]*
/// This member is required.
public var globalClusterIdentifier: Swift.String?
/// Specifies whether to switch over this global database cluster. Constraints:
///
/// * Can't be specified together with the AllowDataLoss parameter.
public var switchover: Swift.Bool?
/// The identifier of the secondary Amazon DocumentDB cluster that you want to promote to the primary for the global cluster. Use the Amazon Resource Name (ARN) for the identifier so that Amazon DocumentDB can locate the cluster in its Amazon Web Services region. Constraints:
///
/// * Must match the identifier of an existing secondary cluster.
///
/// * Minimum length of 1. Maximum length of 255.
///
///
/// Pattern: [A-Za-z][0-9A-Za-z-:._]*
/// This member is required.
public var targetDbClusterIdentifier: Swift.String?

public init(
allowDataLoss: Swift.Bool? = nil,
globalClusterIdentifier: Swift.String? = nil,
switchover: Swift.Bool? = nil,
targetDbClusterIdentifier: Swift.String? = nil
)
{
self.allowDataLoss = allowDataLoss
self.globalClusterIdentifier = globalClusterIdentifier
self.switchover = switchover
self.targetDbClusterIdentifier = targetDbClusterIdentifier
}
}

public struct FailoverGlobalClusterOutput {
/// A data type representing an Amazon DocumentDB global cluster.
public var globalCluster: DocDBClientTypes.GlobalCluster?

public init(
globalCluster: DocDBClientTypes.GlobalCluster? = nil
)
{
self.globalCluster = globalCluster
}
}

/// Represents the input to [ListTagsForResource].
public struct ListTagsForResourceInput {
/// This parameter is not currently supported.
Expand Down Expand Up @@ -5552,6 +5608,13 @@ extension FailoverDBClusterInput {
}
}

extension FailoverGlobalClusterInput {

static func urlPathProvider(_ value: FailoverGlobalClusterInput) -> Swift.String? {
return "/"
}
}

extension ListTagsForResourceInput {

static func urlPathProvider(_ value: ListTagsForResourceInput) -> Swift.String? {
Expand Down Expand Up @@ -6167,6 +6230,19 @@ extension FailoverDBClusterInput {
}
}

extension FailoverGlobalClusterInput {

static func write(value: FailoverGlobalClusterInput?, to writer: SmithyFormURL.Writer) throws {
guard let value else { return }
try writer["AllowDataLoss"].write(value.allowDataLoss)
try writer["GlobalClusterIdentifier"].write(value.globalClusterIdentifier)
try writer["Switchover"].write(value.switchover)
try writer["TargetDbClusterIdentifier"].write(value.targetDbClusterIdentifier)
try writer["Action"].write("FailoverGlobalCluster")
try writer["Version"].write("2014-10-31")
}
}

extension ListTagsForResourceInput {

static func write(value: ListTagsForResourceInput?, to writer: SmithyFormURL.Writer) throws {
Expand Down Expand Up @@ -6847,6 +6923,18 @@ extension FailoverDBClusterOutput {
}
}

extension FailoverGlobalClusterOutput {

static func httpOutput(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> FailoverGlobalClusterOutput {
let data = try await httpResponse.data()
let responseReader = try SmithyXML.Reader.from(data: data)
let reader = responseReader["FailoverGlobalClusterResult"]
var value = FailoverGlobalClusterOutput()
value.globalCluster = try reader["GlobalCluster"].readIfPresent(with: DocDBClientTypes.GlobalCluster.read(from:))
return value
}
}

extension ListTagsForResourceOutput {

static func httpOutput(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> ListTagsForResourceOutput {
Expand Down Expand Up @@ -7633,6 +7721,23 @@ enum FailoverDBClusterOutputError {
}
}

enum FailoverGlobalClusterOutputError {

static func httpError(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> Swift.Error {
let data = try await httpResponse.data()
let responseReader = try SmithyXML.Reader.from(data: data)
let baseError = try AWSClientRuntime.AWSQueryError(httpResponse: httpResponse, responseReader: responseReader, noErrorWrapping: false)
if let error = baseError.customError() { return error }
switch baseError.code {
case "DBClusterNotFoundFault": return try DBClusterNotFoundFault.makeError(baseError: baseError)
case "GlobalClusterNotFoundFault": return try GlobalClusterNotFoundFault.makeError(baseError: baseError)
case "InvalidDBClusterStateFault": return try InvalidDBClusterStateFault.makeError(baseError: baseError)
case "InvalidGlobalClusterStateFault": return try InvalidGlobalClusterStateFault.makeError(baseError: baseError)
default: return try AWSClientRuntime.UnknownAWSHTTPServiceError.makeError(baseError: baseError)
}
}
}

enum ListTagsForResourceOutputError {

static func httpError(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> Swift.Error {
Expand Down
Loading

0 comments on commit b2fdda3

Please sign in to comment.