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

fix: Correct serde for errors in event streams #1120

Merged
merged 2 commits into from
Sep 13, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Sources/Services/AWSKinesis/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ extension InternalFailureException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2541,7 +2541,7 @@ extension KMSAccessDeniedException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2616,7 +2616,7 @@ extension KMSDisabledException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2691,7 +2691,7 @@ extension KMSInvalidStateException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2766,7 +2766,7 @@ extension KMSNotFoundException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2841,7 +2841,7 @@ extension KMSOptInRequired: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -2916,7 +2916,7 @@ extension KMSThrottlingException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -4760,7 +4760,7 @@ extension ResourceInUseException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -4835,7 +4835,7 @@ extension ResourceNotFoundException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down
16 changes: 8 additions & 8 deletions Sources/Services/AWSLexRuntimeV2/models/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension AccessDeniedException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -330,7 +330,7 @@ extension BadGatewayException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -660,7 +660,7 @@ extension ConflictException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -969,7 +969,7 @@ extension DependencyFailedException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -1809,7 +1809,7 @@ extension InternalServerException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -3048,7 +3048,7 @@ extension ResourceNotFoundException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -4102,7 +4102,7 @@ extension ThrottlingException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down Expand Up @@ -4222,7 +4222,7 @@ extension ValidationException: Swift.Codable {
public init(from decoder: Swift.Decoder) throws {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let messageDecoded = try containerValues.decodeIfPresent(Swift.String.self, forKey: .message)
message = messageDecoded
properties.message = messageDecoded
}
}

Expand Down
57 changes: 57 additions & 0 deletions Sources/Services/AWSSageMakerRuntime/SageMakerRuntimeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,61 @@ extension SageMakerRuntimeClient: SageMakerRuntimeClientProtocol {
return result
}

/// Invokes a model at the specified endpoint to return the inference response as a stream. The inference stream provides the response payload incrementally as a series of parts. Before you can get an inference stream, you must have access to a model that's deployed using Amazon SageMaker hosting services, and the container for that model must support inference streaming. For more information that can help you use this API, see the following sections in the Amazon SageMaker Developer Guide:
///
/// * For information about how to add streaming support to a model, see [How Containers Serve Requests](https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-how-containe-serves-requests).
///
/// * For information about how to process the streaming response, see [Invoke real-time endpoints](https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-test-endpoints.html).
///
///
/// Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax. Calls to InvokeEndpointWithResponseStream are authenticated by using Amazon Web Services Signature Version 4. For information, see [Authenticating Requests (Amazon Web Services Signature Version 4)](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) in the Amazon S3 API Reference.
///
/// - Parameter InvokeEndpointWithResponseStreamInput : [no documentation found]
///
/// - Returns: `InvokeEndpointWithResponseStreamOutputResponse` : [no documentation found]
///
/// - Throws: One of the exceptions listed below __Possible Exceptions__.
///
/// __Possible Exceptions:__
/// - `InternalFailure` : An internal failure occurred.
/// - `InternalStreamFailure` : The stream processing failed because of an unknown error, exception or failure. Try your request again.
/// - `ModelError` : Model (owned by the customer in the container) returned 4xx or 5xx error code.
/// - `ModelStreamError` : An error occurred while streaming the response body. This error can have the following error codes: ModelInvocationTimeExceeded The model failed to finish sending the response within the timeout period allowed by Amazon SageMaker. StreamBroken The Transmission Control Protocol (TCP) connection between the client and the model was reset or closed.
/// - `ServiceUnavailable` : The service is unavailable. Try your call again.
/// - `ValidationError` : Inspect your request and try again.
public func invokeEndpointWithResponseStream(input: InvokeEndpointWithResponseStreamInput) async throws -> InvokeEndpointWithResponseStreamOutputResponse
{
let context = ClientRuntime.HttpContextBuilder()
.withEncoder(value: encoder)
.withDecoder(value: decoder)
.withMethod(value: .post)
.withServiceName(value: serviceName)
.withOperation(value: "invokeEndpointWithResponseStream")
.withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator)
.withLogger(value: config.logger)
.withPartitionID(value: config.partitionID)
.withCredentialsProvider(value: config.credentialsProvider)
.withRegion(value: config.region)
.withSigningName(value: "sagemaker")
.withSigningRegion(value: config.signingRegion)
.build()
var operation = ClientRuntime.OperationStack<InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>(id: "invokeEndpointWithResponseStream")
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware<InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>())
operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware<InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutputResponse>())
let endpointParams = EndpointParams(endpoint: config.endpoint, region: config.region, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false)
operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware<InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams))
operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0", config: config)))
operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.HeaderMiddleware<InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutputResponse>())
operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware<InvokeEndpointWithResponseStreamInput, InvokeEndpointWithResponseStreamOutputResponse>(contentType: "application/octet-stream"))
operation.serializeStep.intercept(position: .after, middleware: InvokeEndpointWithResponseStreamInputBodyMiddleware())
operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware())
operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware<ClientRuntime.DefaultRetryStrategy, AWSClientRuntime.AWSRetryErrorInfoProvider, InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>(options: config.retryStrategyOptions))
let sigv4Config = AWSClientRuntime.SigV4Config(unsignedBody: false, signingAlgorithm: .sigv4)
operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware<InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>(config: sigv4Config))
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware<InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>())
operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware<InvokeEndpointWithResponseStreamOutputResponse, InvokeEndpointWithResponseStreamOutputError>(clientLogMode: config.clientLogMode))
let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler())
return result
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ public protocol SageMakerRuntimeClientProtocol {
/// - `ServiceUnavailable` : The service is unavailable. Try your call again.
/// - `ValidationError` : Inspect your request and try again.
func invokeEndpointAsync(input: InvokeEndpointAsyncInput) async throws -> InvokeEndpointAsyncOutputResponse
/// Invokes a model at the specified endpoint to return the inference response as a stream. The inference stream provides the response payload incrementally as a series of parts. Before you can get an inference stream, you must have access to a model that's deployed using Amazon SageMaker hosting services, and the container for that model must support inference streaming. For more information that can help you use this API, see the following sections in the Amazon SageMaker Developer Guide:
///
/// * For information about how to add streaming support to a model, see [How Containers Serve Requests](https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-how-containe-serves-requests).
///
/// * For information about how to process the streaming response, see [Invoke real-time endpoints](https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-test-endpoints.html).
///
///
/// Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax. Calls to InvokeEndpointWithResponseStream are authenticated by using Amazon Web Services Signature Version 4. For information, see [Authenticating Requests (Amazon Web Services Signature Version 4)](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) in the Amazon S3 API Reference.
///
/// - Parameter InvokeEndpointWithResponseStreamInput : [no documentation found]
///
/// - Returns: `InvokeEndpointWithResponseStreamOutputResponse` : [no documentation found]
///
/// - Throws: One of the exceptions listed below __Possible Exceptions__.
///
/// __Possible Exceptions:__
/// - `InternalFailure` : An internal failure occurred.
/// - `InternalStreamFailure` : The stream processing failed because of an unknown error, exception or failure. Try your request again.
/// - `ModelError` : Model (owned by the customer in the container) returned 4xx or 5xx error code.
/// - `ModelStreamError` : An error occurred while streaming the response body. This error can have the following error codes: ModelInvocationTimeExceeded The model failed to finish sending the response within the timeout period allowed by Amazon SageMaker. StreamBroken The Transmission Control Protocol (TCP) connection between the client and the model was reset or closed.
/// - `ServiceUnavailable` : The service is unavailable. Try your call again.
/// - `ValidationError` : Inspect your request and try again.
func invokeEndpointWithResponseStream(input: InvokeEndpointWithResponseStreamInput) async throws -> InvokeEndpointWithResponseStreamOutputResponse
}

public enum SageMakerRuntimeClientTypes {}
Loading
Loading