aws-sdk-xray 1.94.0

AWS SDK for AWS X-Ray
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A span from a trace that has been ingested by the X-Ray service. A span represents a unit of work or an operation performed by a service.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Span {
    /// <p>The span ID.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>The span document.</p>
    pub document: ::std::option::Option<::std::string::String>,
}
impl Span {
    /// <p>The span ID.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>The span document.</p>
    pub fn document(&self) -> ::std::option::Option<&str> {
        self.document.as_deref()
    }
}
impl Span {
    /// Creates a new builder-style object to manufacture [`Span`](crate::types::Span).
    pub fn builder() -> crate::types::builders::SpanBuilder {
        crate::types::builders::SpanBuilder::default()
    }
}

/// A builder for [`Span`](crate::types::Span).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SpanBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) document: ::std::option::Option<::std::string::String>,
}
impl SpanBuilder {
    /// <p>The span ID.</p>
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The span ID.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The span ID.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>The span document.</p>
    pub fn document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.document = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The span document.</p>
    pub fn set_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.document = input;
        self
    }
    /// <p>The span document.</p>
    pub fn get_document(&self) -> &::std::option::Option<::std::string::String> {
        &self.document
    }
    /// Consumes the builder and constructs a [`Span`](crate::types::Span).
    pub fn build(self) -> crate::types::Span {
        crate::types::Span {
            id: self.id,
            document: self.document,
        }
    }
}