-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws-sdk-swift release build artifacts
- Loading branch information
AWS CI
committed
Dec 6, 2022
1 parent
c429238
commit c54c028
Showing
386 changed files
with
275,827 additions
and
43,355 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
release/AWSARCZonalShift/ARCZonalShiftClientProtocol.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Code generated by smithy-swift-codegen. DO NOT EDIT! | ||
|
||
import AWSClientRuntime | ||
import ClientRuntime | ||
|
||
/// This is the API Reference Guide for the zonal shift feature of Amazon Route 53 Application Recovery Controller. This guide is for developers who need detailed information about zonal shift API actions, data types, and errors. Zonal shift is in preview release for Amazon Route 53 Application Recovery Controller and is subject to change. Zonal shift in Route 53 ARC enables you to move traffic for a load balancer resource away from an Availability Zone. Starting a zonal shift helps your application recover immediately, for example, from a developer's bad code deployment or from an AWS infrastructure failure in a single Availability Zone, reducing the impact and time lost from an issue in one zone. Supported AWS resources are automatically registered with Route 53 ARC. Resources that are registered for zonal shifts in Route 53 ARC are managed resources in Route 53 ARC. You can start a zonal shift for any managed resource in your account in a Region. At this time, you can only start a zonal shift for Network Load Balancers and Application Load Balancers with cross-zone load balancing turned off. Zonal shifts are temporary. You must specify an expiration when you start a zonal shift, of up to three days initially. If you want to still keep traffic away from an Availability Zone, you can update the zonal shift and set a new expiration. You can also cancel a zonal shift, before it expires, for example, if you're ready to restore traffic to the Availability Zone. For more information about using zonal shift, see the [Amazon Route 53 Application Recovery Controller Developer Guide](https://docs.aws.amazon.com/r53recovery/latest/dg/what-is-route53-recovery.html). | ||
public protocol ARCZonalShiftClientProtocol { | ||
/// Cancel a zonal shift in Amazon Route 53 Application Recovery Controller that you've started for a resource in your AWS account in an AWS Region. | ||
func cancelZonalShift(input: CancelZonalShiftInput) async throws -> CancelZonalShiftOutputResponse | ||
/// Get information about a resource that's been registered for zonal shifts with Amazon Route 53 Application Recovery Controller in this AWS Region. Resources that are registered for zonal shifts are managed resources in Route 53 ARC. At this time, you can only start a zonal shift for Network Load Balancers and Application Load Balancers with cross-zone load balancing turned off. | ||
func getManagedResource(input: GetManagedResourceInput) async throws -> GetManagedResourceOutputResponse | ||
/// Lists all the resources in your AWS account in this AWS Region that are managed for zonal shifts in Amazon Route 53 Application Recovery Controller, and information about them. The information includes their Amazon Resource Names (ARNs), the Availability Zones the resources are deployed in, and the resource name. | ||
func listManagedResources(input: ListManagedResourcesInput) async throws -> ListManagedResourcesOutputResponse | ||
/// Lists all the active zonal shifts in Amazon Route 53 Application Recovery Controller in your AWS account in this AWS Region. | ||
func listZonalShifts(input: ListZonalShiftsInput) async throws -> ListZonalShiftsOutputResponse | ||
/// You start a zonal shift to temporarily move load balancer traffic away from an Availability Zone in a AWS Region, to help your application recover immediately, for example, from a developer's bad code deployment or from an AWS infrastructure failure in a single Availability Zone. You can start a zonal shift in Route 53 ARC only for managed resources in your account in an AWS Region. Resources are automatically registered with Route 53 ARC by AWS services. At this time, you can only start a zonal shift for Network Load Balancers and Application Load Balancers with cross-zone load balancing turned off. When you start a zonal shift, traffic for the resource is no longer routed to the Availability Zone. The zonal shift is created immediately in Route 53 ARC. However, it can take a short time, typically up to a few minutes, for existing, in-progress connections in the Availability Zone to complete. For more information, see [Zonal shift](https://docs.aws.amazon.com/r53recovery/latest/dg/arc-zonal-shift.html) in the Amazon Route 53 Application Recovery Controller Developer Guide. | ||
func startZonalShift(input: StartZonalShiftInput) async throws -> StartZonalShiftOutputResponse | ||
/// Update an active zonal shift in Amazon Route 53 Application Recovery Controller in your AWS account. You can update a zonal shift to set a new expiration, or edit or replace the comment for the zonal shift. | ||
func updateZonalShift(input: UpdateZonalShiftInput) async throws -> UpdateZonalShiftOutputResponse | ||
} | ||
|
||
public protocol ARCZonalShiftClientConfigurationProtocol : AWSClientRuntime.AWSClientConfiguration { | ||
var endpointResolver: EndpointResolver { get } | ||
} | ||
|
||
public enum ARCZonalShiftClientTypes {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// 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, | ||
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 partitions = "{\"version\":\"1.1\",\"partitions\":[{\"id\":\"aws\",\"regionRegex\":\"^(us|eu|ap|sa|ca|me|af)-\\\\w+-\\\\d+$\",\"regions\":{\"af-south-1\":{},\"ap-east-1\":{},\"ap-northeast-1\":{},\"ap-northeast-2\":{},\"ap-northeast-3\":{},\"ap-south-1\":{},\"ap-southeast-1\":{},\"ap-southeast-2\":{},\"ap-southeast-3\":{},\"ca-central-1\":{},\"eu-central-1\":{},\"eu-north-1\":{},\"eu-south-1\":{},\"eu-west-1\":{},\"eu-west-2\":{},\"eu-west-3\":{},\"me-central-1\":{},\"me-south-1\":{},\"sa-east-1\":{},\"us-east-1\":{},\"us-east-2\":{},\"us-west-1\":{},\"us-west-2\":{},\"aws-global\":{}},\"outputs\":{\"name\":\"aws\",\"dnsSuffix\":\"amazonaws.com\",\"dualStackDnsSuffix\":\"api.aws\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-us-gov\",\"regionRegex\":\"^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$\",\"regions\":{\"us-gov-west-1\":{},\"us-gov-east-1\":{},\"aws-us-gov-global\":{}},\"outputs\":{\"name\":\"aws-us-gov\",\"dnsSuffix\":\"amazonaws.com\",\"dualStackDnsSuffix\":\"api.aws\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-cn\",\"regionRegex\":\"^cn\\\\-\\\\w+\\\\-\\\\d+$\",\"regions\":{\"cn-north-1\":{},\"cn-northwest-1\":{},\"aws-cn-global\":{}},\"outputs\":{\"name\":\"aws-cn\",\"dnsSuffix\":\"amazonaws.com.cn\",\"dualStackDnsSuffix\":\"api.amazonwebservices.com.cn\",\"supportsFIPS\":true,\"supportsDualStack\":true}},{\"id\":\"aws-iso\",\"regionRegex\":\"^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$\",\"outputs\":{\"name\":\"aws-iso\",\"dnsSuffix\":\"c2s.ic.gov\",\"supportsFIPS\":true,\"supportsDualStack\":false,\"dualStackDnsSuffix\":\"c2s.ic.gov\"},\"regions\":{\"us-iso-east-1\":{},\"us-iso-west-1\":{},\"aws-iso-global\":{}}},{\"id\":\"aws-iso-b\",\"regionRegex\":\"^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$\",\"outputs\":{\"name\":\"aws-iso-b\",\"dnsSuffix\":\"sc2s.sgov.gov\",\"supportsFIPS\":true,\"supportsDualStack\":false,\"dualStackDnsSuffix\":\"sc2s.sgov.gov\"},\"regions\":{\"us-isob-east-1\":{},\"aws-iso-b-global\":{}}}]}" | ||
private let ruleSet = "{\"version\":\"1.0\",\"parameters\":{\"Region\":{\"builtIn\":\"AWS::Region\",\"required\":true,\"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\":\"aws.partition\",\"argv\":[{\"ref\":\"Region\"}],\"assign\":\"PartitionResult\"}],\"type\":\"tree\",\"rules\":[{\"conditions\":[{\"fn\":\"isSet\",\"argv\":[{\"ref\":\"Endpoint\"}]},{\"fn\":\"parseURL\",\"argv\":[{\"ref\":\"Endpoint\"}],\"assign\":\"url\"}],\"type\":\"tree\",\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]}],\"error\":\"Invalid Configuration: FIPS and custom endpoint are not supported\",\"type\":\"error\"},{\"conditions\":[],\"type\":\"tree\",\"rules\":[{\"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\"}]}]},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]},{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseDualStack\"},true]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsFIPS\"]}]},{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsDualStack\"]}]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[],\"endpoint\":{\"url\":\"https://arc-zonal-shift-fips.{Region}.{PartitionResult#dualStackDnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}]},{\"conditions\":[],\"error\":\"FIPS and DualStack are enabled, but this partition does not support one or both\",\"type\":\"error\"}]},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseFIPS\"},true]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsFIPS\"]}]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[],\"endpoint\":{\"url\":\"https://arc-zonal-shift-fips.{Region}.{PartitionResult#dnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}]},{\"conditions\":[],\"error\":\"FIPS is enabled but this partition does not support FIPS\",\"type\":\"error\"}]},{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[{\"ref\":\"UseDualStack\"},true]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[{\"fn\":\"booleanEquals\",\"argv\":[true,{\"fn\":\"getAttr\",\"argv\":[{\"ref\":\"PartitionResult\"},\"supportsDualStack\"]}]}],\"type\":\"tree\",\"rules\":[{\"conditions\":[],\"endpoint\":{\"url\":\"https://arc-zonal-shift.{Region}.{PartitionResult#dualStackDnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}]},{\"conditions\":[],\"error\":\"DualStack is enabled but this partition does not support DualStack\",\"type\":\"error\"}]},{\"conditions\":[],\"endpoint\":{\"url\":\"https://arc-zonal-shift.{Region}.{PartitionResult#dnsSuffix}\",\"properties\":{},\"headers\":{}},\"type\":\"endpoint\"}]}]}" | ||
|
||
public init() throws { | ||
engine = try AWSClientRuntime.AWSEndpointsRuleEngine(partitions: partitions, 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 = try crtResolvedEndpoint.getError() | ||
throw EndpointError.unresolved(error) | ||
} | ||
|
||
guard let url = try 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 = try crtResolvedEndpoint.getHeaders() ?? [:] | ||
let properties = try crtResolvedEndpoint.getProperties() ?? [:] | ||
return try Endpoint(urlString: url, headers: Headers(headers), properties: properties) | ||
} | ||
} | ||
|
||
public struct EndpointResolverMiddleware<OperationStackOutput: ClientRuntime.HttpResponseBinding, OperationStackError: ClientRuntime.HttpResponseBinding>: ClientRuntime.Middleware { | ||
public let id: Swift.String = "EndpointResolverMiddleware" | ||
|
||
let endpointResolver: EndpointResolver | ||
|
||
let endpointParams: EndpointParams | ||
|
||
public init(endpointResolver: EndpointResolver, endpointParams: EndpointParams) { | ||
self.endpointResolver = endpointResolver | ||
self.endpointParams = endpointParams | ||
} | ||
|
||
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) | ||
|
||
let authScheme = endpoint.authScheme(name: "sigv4") | ||
let awsEndpoint = AWSEndpoint(endpoint: endpoint, signingName: authScheme?["signingName"] as? String, signingRegion: authScheme?["signingRegion"] as? String) | ||
|
||
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) | ||
} | ||
|
||
var updatedContext = context | ||
if let signingRegion = awsEndpoint.signingRegion { | ||
updatedContext.attributes.set(key: HttpContext.signingRegion, value: signingRegion) | ||
} | ||
if let signingName = awsEndpoint.signingName { | ||
updatedContext.attributes.set(key: HttpContext.signingName, value: signingName) | ||
} | ||
|
||
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: updatedContext, input: input) | ||
} | ||
|
||
public typealias MInput = ClientRuntime.SdkHttpRequestBuilder | ||
public typealias MOutput = ClientRuntime.OperationOutput<OperationStackOutput> | ||
public typealias Context = ClientRuntime.HttpContext | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Code generated by smithy-swift-codegen. DO NOT EDIT! | ||
|
||
|
||
|
||
|
Oops, something went wrong.