#[non_exhaustive]
#[derive(Debug)]
pub struct InvokeAgentRuntimeCommandStreamOutputUnmarshaller;
impl InvokeAgentRuntimeCommandStreamOutputUnmarshaller {
pub fn new() -> Self {
InvokeAgentRuntimeCommandStreamOutputUnmarshaller
}
}
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for InvokeAgentRuntimeCommandStreamOutputUnmarshaller {
type Output = crate::types::InvokeAgentRuntimeCommandStreamOutput;
type Error = crate::types::error::InvokeAgentRuntimeCommandStreamOutputError;
fn unmarshall(
&self,
message: &::aws_smithy_types::event_stream::Message,
) -> std::result::Result<::aws_smithy_eventstream::frame::UnmarshalledMessage<Self::Output, Self::Error>, ::aws_smithy_eventstream::error::Error>
{
let response_headers = ::aws_smithy_eventstream::smithy::parse_response_headers(message)?;
match response_headers.message_type.as_str() {
"event" => match response_headers.smithy_type.as_str() {
"chunk" => {
let parsed = crate::protocol_serde::shape_response_chunk::de_response_chunk_payload(&message.payload()[..])
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall Chunk: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeAgentRuntimeCommandStreamOutput::Chunk(parsed),
))
}
_unknown_variant => Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeAgentRuntimeCommandStreamOutput::Unknown,
)),
},
"exception" => {
let generic = match crate::protocol_serde::parse_event_stream_error_metadata(message.payload()) {
Ok(builder) => builder.build(),
Err(err) => {
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::unhandled(err),
))
}
};
match response_headers.smithy_type.as_str() {
"accessDeniedException" => {
let mut builder = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
builder = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall accessDeniedException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::AccessDeniedException(builder.build()),
));
}
"internalServerException" => {
let mut builder = crate::types::error::builders::InternalServerExceptionBuilder::default();
builder = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall internalServerException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::InternalServerException(builder.build()),
));
}
"resourceNotFoundException" => {
let mut builder = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
builder = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall resourceNotFoundException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::ResourceNotFoundException(builder.build()),
));
}
"serviceQuotaExceededException" => {
let mut builder = crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default();
builder = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!(
"failed to unmarshall serviceQuotaExceededException: {err}"
))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::ServiceQuotaExceededException(builder.build()),
));
}
"throttlingException" => {
let mut builder = crate::types::error::builders::ThrottlingExceptionBuilder::default();
builder =
crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall throttlingException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::ThrottlingException(builder.build()),
));
}
"validationException" => {
let mut builder = crate::types::error::builders::ValidationExceptionBuilder::default();
builder =
crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall validationException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::ValidationException(
crate::serde_util::validation_exception_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("{err}")))?,
),
));
}
"runtimeClientError" => {
let mut builder = crate::types::error::builders::RuntimeClientErrorBuilder::default();
builder =
crate::protocol_serde::shape_runtime_client_error::de_runtime_client_error_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall runtimeClientError: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::RuntimeClientError(builder.build()),
));
}
_ => {}
}
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeAgentRuntimeCommandStreamOutputError::generic(generic),
))
}
value => {
return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
"unrecognized :message-type: {value}"
)));
}
}
}
}
#[non_exhaustive]
#[derive(Debug)]
pub struct CodeInterpreterStreamOutputUnmarshaller;
impl CodeInterpreterStreamOutputUnmarshaller {
pub fn new() -> Self {
CodeInterpreterStreamOutputUnmarshaller
}
}
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for CodeInterpreterStreamOutputUnmarshaller {
type Output = crate::types::CodeInterpreterStreamOutput;
type Error = crate::types::error::CodeInterpreterStreamOutputError;
fn unmarshall(
&self,
message: &::aws_smithy_types::event_stream::Message,
) -> std::result::Result<::aws_smithy_eventstream::frame::UnmarshalledMessage<Self::Output, Self::Error>, ::aws_smithy_eventstream::error::Error>
{
let response_headers = ::aws_smithy_eventstream::smithy::parse_response_headers(message)?;
match response_headers.message_type.as_str() {
"event" => match response_headers.smithy_type.as_str() {
"result" => {
let parsed = crate::protocol_serde::shape_code_interpreter_result::de_code_interpreter_result_payload(&message.payload()[..])
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall Result: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::CodeInterpreterStreamOutput::Result(parsed),
))
}
_unknown_variant => Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::CodeInterpreterStreamOutput::Unknown,
)),
},
"exception" => {
let generic = match crate::protocol_serde::parse_event_stream_error_metadata(message.payload()) {
Ok(builder) => builder.build(),
Err(err) => {
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::unhandled(err),
))
}
};
match response_headers.smithy_type.as_str() {
"accessDeniedException" => {
let mut builder = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
builder = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall accessDeniedException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::AccessDeniedException(builder.build()),
));
}
"conflictException" => {
let mut builder = crate::types::error::builders::ConflictExceptionBuilder::default();
builder = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall conflictException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::ConflictException(builder.build()),
));
}
"internalServerException" => {
let mut builder = crate::types::error::builders::InternalServerExceptionBuilder::default();
builder = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall internalServerException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::InternalServerException(builder.build()),
));
}
"resourceNotFoundException" => {
let mut builder = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
builder = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall resourceNotFoundException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::ResourceNotFoundException(builder.build()),
));
}
"serviceQuotaExceededException" => {
let mut builder = crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default();
builder = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!(
"failed to unmarshall serviceQuotaExceededException: {err}"
))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::ServiceQuotaExceededException(builder.build()),
));
}
"throttlingException" => {
let mut builder = crate::types::error::builders::ThrottlingExceptionBuilder::default();
builder =
crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall throttlingException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::ThrottlingException(builder.build()),
));
}
"validationException" => {
let mut builder = crate::types::error::builders::ValidationExceptionBuilder::default();
builder =
crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall validationException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::ValidationException(
crate::serde_util::validation_exception_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("{err}")))?,
),
));
}
_ => {}
}
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::CodeInterpreterStreamOutputError::generic(generic),
))
}
value => {
return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
"unrecognized :message-type: {value}"
)));
}
}
}
}
#[non_exhaustive]
#[derive(Debug)]
pub struct InvokeHarnessStreamOutputUnmarshaller;
impl InvokeHarnessStreamOutputUnmarshaller {
pub fn new() -> Self {
InvokeHarnessStreamOutputUnmarshaller
}
}
impl ::aws_smithy_eventstream::frame::UnmarshallMessage for InvokeHarnessStreamOutputUnmarshaller {
type Output = crate::types::InvokeHarnessStreamOutput;
type Error = crate::types::error::InvokeHarnessStreamOutputError;
fn unmarshall(
&self,
message: &::aws_smithy_types::event_stream::Message,
) -> std::result::Result<::aws_smithy_eventstream::frame::UnmarshalledMessage<Self::Output, Self::Error>, ::aws_smithy_eventstream::error::Error>
{
let response_headers = ::aws_smithy_eventstream::smithy::parse_response_headers(message)?;
match response_headers.message_type.as_str() {
"event" => match response_headers.smithy_type.as_str() {
"messageStart" => {
let parsed =
crate::protocol_serde::shape_harness_message_start_event::de_harness_message_start_event_payload(&message.payload()[..])
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall MessageStart: {err}"))
})?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::MessageStart(parsed),
))
}
"contentBlockStart" => {
let parsed = crate::protocol_serde::shape_harness_content_block_start_event::de_harness_content_block_start_event_payload(
&message.payload()[..],
)
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall ContentBlockStart: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::ContentBlockStart(parsed),
))
}
"contentBlockDelta" => {
let parsed = crate::protocol_serde::shape_harness_content_block_delta_event::de_harness_content_block_delta_event_payload(
&message.payload()[..],
)
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall ContentBlockDelta: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::ContentBlockDelta(parsed),
))
}
"contentBlockStop" => {
let parsed = crate::protocol_serde::shape_harness_content_block_stop_event::de_harness_content_block_stop_event_payload(
&message.payload()[..],
)
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall ContentBlockStop: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::ContentBlockStop(parsed),
))
}
"messageStop" => {
let parsed =
crate::protocol_serde::shape_harness_message_stop_event::de_harness_message_stop_event_payload(&message.payload()[..])
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall MessageStop: {err}"))
})?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::MessageStop(parsed),
))
}
"metadata" => {
let parsed = crate::protocol_serde::shape_harness_metadata_event::de_harness_metadata_event_payload(&message.payload()[..])
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall Metadata: {err}")))?;
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::Metadata(parsed),
))
}
_unknown_variant => Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
crate::types::InvokeHarnessStreamOutput::Unknown,
)),
},
"exception" => {
let generic = match crate::protocol_serde::parse_event_stream_error_metadata(message.payload()) {
Ok(builder) => builder.build(),
Err(err) => {
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeHarnessStreamOutputError::unhandled(err),
))
}
};
match response_headers.smithy_type.as_str() {
"internalServerException" => {
let mut builder = crate::types::error::builders::InternalServerExceptionBuilder::default();
builder = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(
&message.payload()[..],
builder,
)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall internalServerException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeHarnessStreamOutputError::InternalServerException(builder.build()),
));
}
"validationException" => {
let mut builder = crate::types::error::builders::ValidationExceptionBuilder::default();
builder =
crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall validationException: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeHarnessStreamOutputError::ValidationException(
crate::serde_util::validation_exception_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_eventstream::error::Error::unmarshalling(format!("{err}")))?,
),
));
}
"runtimeClientError" => {
let mut builder = crate::types::error::builders::RuntimeClientErrorBuilder::default();
builder =
crate::protocol_serde::shape_runtime_client_error::de_runtime_client_error_json_err(&message.payload()[..], builder)
.map_err(|err| {
::aws_smithy_eventstream::error::Error::unmarshalling(format!("failed to unmarshall runtimeClientError: {err}"))
})?;
builder.set_meta(Some(generic));
return Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeHarnessStreamOutputError::RuntimeClientError(builder.build()),
));
}
_ => {}
}
Ok(::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
crate::types::error::InvokeHarnessStreamOutputError::generic(generic),
))
}
value => {
return Err(::aws_smithy_eventstream::error::Error::unmarshalling(format!(
"unrecognized :message-type: {value}"
)));
}
}
}
}