#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Span {
pub span_id: ::std::string::String,
pub assistant_id: ::std::string::String,
pub session_id: ::std::string::String,
pub parent_span_id: ::std::option::Option<::std::string::String>,
pub span_name: ::std::string::String,
pub span_type: crate::types::SpanType,
pub start_timestamp: ::aws_smithy_types::DateTime,
pub end_timestamp: ::aws_smithy_types::DateTime,
pub status: crate::types::SpanStatus,
pub request_id: ::std::string::String,
pub attributes: ::std::option::Option<crate::types::SpanAttributes>,
}
impl Span {
pub fn span_id(&self) -> &str {
use std::ops::Deref;
self.span_id.deref()
}
pub fn assistant_id(&self) -> &str {
use std::ops::Deref;
self.assistant_id.deref()
}
pub fn session_id(&self) -> &str {
use std::ops::Deref;
self.session_id.deref()
}
pub fn parent_span_id(&self) -> ::std::option::Option<&str> {
self.parent_span_id.as_deref()
}
pub fn span_name(&self) -> &str {
use std::ops::Deref;
self.span_name.deref()
}
pub fn span_type(&self) -> &crate::types::SpanType {
&self.span_type
}
pub fn start_timestamp(&self) -> &::aws_smithy_types::DateTime {
&self.start_timestamp
}
pub fn end_timestamp(&self) -> &::aws_smithy_types::DateTime {
&self.end_timestamp
}
pub fn status(&self) -> &crate::types::SpanStatus {
&self.status
}
pub fn request_id(&self) -> &str {
use std::ops::Deref;
self.request_id.deref()
}
pub fn attributes(&self) -> ::std::option::Option<&crate::types::SpanAttributes> {
self.attributes.as_ref()
}
}
impl Span {
pub fn builder() -> crate::types::builders::SpanBuilder {
crate::types::builders::SpanBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SpanBuilder {
pub(crate) span_id: ::std::option::Option<::std::string::String>,
pub(crate) assistant_id: ::std::option::Option<::std::string::String>,
pub(crate) session_id: ::std::option::Option<::std::string::String>,
pub(crate) parent_span_id: ::std::option::Option<::std::string::String>,
pub(crate) span_name: ::std::option::Option<::std::string::String>,
pub(crate) span_type: ::std::option::Option<crate::types::SpanType>,
pub(crate) start_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) end_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) status: ::std::option::Option<crate::types::SpanStatus>,
pub(crate) request_id: ::std::option::Option<::std::string::String>,
pub(crate) attributes: ::std::option::Option<crate::types::SpanAttributes>,
}
impl SpanBuilder {
pub fn span_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.span_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_span_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.span_id = input;
self
}
pub fn get_span_id(&self) -> &::std::option::Option<::std::string::String> {
&self.span_id
}
pub fn assistant_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.assistant_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_assistant_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.assistant_id = input;
self
}
pub fn get_assistant_id(&self) -> &::std::option::Option<::std::string::String> {
&self.assistant_id
}
pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.session_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
&self.session_id
}
pub fn parent_span_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.parent_span_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_parent_span_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.parent_span_id = input;
self
}
pub fn get_parent_span_id(&self) -> &::std::option::Option<::std::string::String> {
&self.parent_span_id
}
pub fn span_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.span_name = ::std::option::Option::Some(input.into());
self
}
pub fn set_span_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.span_name = input;
self
}
pub fn get_span_name(&self) -> &::std::option::Option<::std::string::String> {
&self.span_name
}
pub fn span_type(mut self, input: crate::types::SpanType) -> Self {
self.span_type = ::std::option::Option::Some(input);
self
}
pub fn set_span_type(mut self, input: ::std::option::Option<crate::types::SpanType>) -> Self {
self.span_type = input;
self
}
pub fn get_span_type(&self) -> &::std::option::Option<crate::types::SpanType> {
&self.span_type
}
pub fn start_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.start_timestamp = ::std::option::Option::Some(input);
self
}
pub fn set_start_timestamp(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.start_timestamp = input;
self
}
pub fn get_start_timestamp(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.start_timestamp
}
pub fn end_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.end_timestamp = ::std::option::Option::Some(input);
self
}
pub fn set_end_timestamp(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.end_timestamp = input;
self
}
pub fn get_end_timestamp(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.end_timestamp
}
pub fn status(mut self, input: crate::types::SpanStatus) -> Self {
self.status = ::std::option::Option::Some(input);
self
}
pub fn set_status(mut self, input: ::std::option::Option<crate::types::SpanStatus>) -> Self {
self.status = input;
self
}
pub fn get_status(&self) -> &::std::option::Option<crate::types::SpanStatus> {
&self.status
}
pub fn request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.request_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.request_id = input;
self
}
pub fn get_request_id(&self) -> &::std::option::Option<::std::string::String> {
&self.request_id
}
pub fn attributes(mut self, input: crate::types::SpanAttributes) -> Self {
self.attributes = ::std::option::Option::Some(input);
self
}
pub fn set_attributes(mut self, input: ::std::option::Option<crate::types::SpanAttributes>) -> Self {
self.attributes = input;
self
}
pub fn get_attributes(&self) -> &::std::option::Option<crate::types::SpanAttributes> {
&self.attributes
}
pub fn build(self) -> ::std::result::Result<crate::types::Span, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Span {
span_id: self.span_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"span_id",
"span_id was not specified but it is required when building Span",
)
})?,
assistant_id: self.assistant_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"assistant_id",
"assistant_id was not specified but it is required when building Span",
)
})?,
session_id: self.session_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"session_id",
"session_id was not specified but it is required when building Span",
)
})?,
parent_span_id: self.parent_span_id,
span_name: self.span_name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"span_name",
"span_name was not specified but it is required when building Span",
)
})?,
span_type: self.span_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"span_type",
"span_type was not specified but it is required when building Span",
)
})?,
start_timestamp: self.start_timestamp.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"start_timestamp",
"start_timestamp was not specified but it is required when building Span",
)
})?,
end_timestamp: self.end_timestamp.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"end_timestamp",
"end_timestamp was not specified but it is required when building Span",
)
})?,
status: self.status.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"status",
"status was not specified but it is required when building Span",
)
})?,
request_id: self.request_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"request_id",
"request_id was not specified but it is required when building Span",
)
})?,
attributes: self.attributes,
})
}
}