aws-sdk-applicationsignals 1.89.0

AWS SDK for Amazon CloudWatch Application Signals
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A structure that represents a node in a dependency graph, containing information about a service, resource, or other entity and its characteristics.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Node {
    /// <p>The key attributes that identify this node, including Type, Name, and Environment information.</p>
    pub key_attributes: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    /// <p>The name of the entity represented by this node.</p>
    pub name: ::std::string::String,
    /// <p>A unique identifier for this node within the dependency graph.</p>
    pub node_id: ::std::string::String,
    /// <p>The operation associated with this node, if applicable.</p>
    pub operation: ::std::option::Option<::std::string::String>,
    /// <p>The type of entity represented by this node, such as <code>Service</code> or <code>Resource</code>.</p>
    pub r#type: ::std::option::Option<::std::string::String>,
    /// <p>The duration or processing time associated with this node, if applicable.</p>
    pub duration: ::std::option::Option<f64>,
    /// <p>The status of the entity represented by this node.</p>
    pub status: ::std::option::Option<::std::string::String>,
}
impl Node {
    /// <p>The key attributes that identify this node, including Type, Name, and Environment information.</p>
    pub fn key_attributes(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
        &self.key_attributes
    }
    /// <p>The name of the entity represented by this node.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>A unique identifier for this node within the dependency graph.</p>
    pub fn node_id(&self) -> &str {
        use std::ops::Deref;
        self.node_id.deref()
    }
    /// <p>The operation associated with this node, if applicable.</p>
    pub fn operation(&self) -> ::std::option::Option<&str> {
        self.operation.as_deref()
    }
    /// <p>The type of entity represented by this node, such as <code>Service</code> or <code>Resource</code>.</p>
    pub fn r#type(&self) -> ::std::option::Option<&str> {
        self.r#type.as_deref()
    }
    /// <p>The duration or processing time associated with this node, if applicable.</p>
    pub fn duration(&self) -> ::std::option::Option<f64> {
        self.duration
    }
    /// <p>The status of the entity represented by this node.</p>
    pub fn status(&self) -> ::std::option::Option<&str> {
        self.status.as_deref()
    }
}
impl Node {
    /// Creates a new builder-style object to manufacture [`Node`](crate::types::Node).
    pub fn builder() -> crate::types::builders::NodeBuilder {
        crate::types::builders::NodeBuilder::default()
    }
}

/// A builder for [`Node`](crate::types::Node).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct NodeBuilder {
    pub(crate) key_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) node_id: ::std::option::Option<::std::string::String>,
    pub(crate) operation: ::std::option::Option<::std::string::String>,
    pub(crate) r#type: ::std::option::Option<::std::string::String>,
    pub(crate) duration: ::std::option::Option<f64>,
    pub(crate) status: ::std::option::Option<::std::string::String>,
}
impl NodeBuilder {
    /// Adds a key-value pair to `key_attributes`.
    ///
    /// To override the contents of this collection use [`set_key_attributes`](Self::set_key_attributes).
    ///
    /// <p>The key attributes that identify this node, including Type, Name, and Environment information.</p>
    pub fn key_attributes(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: impl ::std::convert::Into<::std::string::String>,
    ) -> Self {
        let mut hash_map = self.key_attributes.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.key_attributes = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The key attributes that identify this node, including Type, Name, and Environment information.</p>
    pub fn set_key_attributes(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    ) -> Self {
        self.key_attributes = input;
        self
    }
    /// <p>The key attributes that identify this node, including Type, Name, and Environment information.</p>
    pub fn get_key_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.key_attributes
    }
    /// <p>The name of the entity represented by this node.</p>
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the entity represented by this node.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the entity represented by this node.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>A unique identifier for this node within the dependency graph.</p>
    /// This field is required.
    pub fn node_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.node_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A unique identifier for this node within the dependency graph.</p>
    pub fn set_node_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.node_id = input;
        self
    }
    /// <p>A unique identifier for this node within the dependency graph.</p>
    pub fn get_node_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.node_id
    }
    /// <p>The operation associated with this node, if applicable.</p>
    pub fn operation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.operation = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The operation associated with this node, if applicable.</p>
    pub fn set_operation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.operation = input;
        self
    }
    /// <p>The operation associated with this node, if applicable.</p>
    pub fn get_operation(&self) -> &::std::option::Option<::std::string::String> {
        &self.operation
    }
    /// <p>The type of entity represented by this node, such as <code>Service</code> or <code>Resource</code>.</p>
    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.r#type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The type of entity represented by this node, such as <code>Service</code> or <code>Resource</code>.</p>
    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of entity represented by this node, such as <code>Service</code> or <code>Resource</code>.</p>
    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.r#type
    }
    /// <p>The duration or processing time associated with this node, if applicable.</p>
    pub fn duration(mut self, input: f64) -> Self {
        self.duration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The duration or processing time associated with this node, if applicable.</p>
    pub fn set_duration(mut self, input: ::std::option::Option<f64>) -> Self {
        self.duration = input;
        self
    }
    /// <p>The duration or processing time associated with this node, if applicable.</p>
    pub fn get_duration(&self) -> &::std::option::Option<f64> {
        &self.duration
    }
    /// <p>The status of the entity represented by this node.</p>
    pub fn status(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.status = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The status of the entity represented by this node.</p>
    pub fn set_status(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.status = input;
        self
    }
    /// <p>The status of the entity represented by this node.</p>
    pub fn get_status(&self) -> &::std::option::Option<::std::string::String> {
        &self.status
    }
    /// Consumes the builder and constructs a [`Node`](crate::types::Node).
    /// This method will fail if any of the following fields are not set:
    /// - [`key_attributes`](crate::types::builders::NodeBuilder::key_attributes)
    /// - [`name`](crate::types::builders::NodeBuilder::name)
    /// - [`node_id`](crate::types::builders::NodeBuilder::node_id)
    pub fn build(self) -> ::std::result::Result<crate::types::Node, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Node {
            key_attributes: self.key_attributes.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "key_attributes",
                    "key_attributes was not specified but it is required when building Node",
                )
            })?,
            name: self.name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "name",
                    "name was not specified but it is required when building Node",
                )
            })?,
            node_id: self.node_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "node_id",
                    "node_id was not specified but it is required when building Node",
                )
            })?,
            operation: self.operation,
            r#type: self.r#type,
            duration: self.duration,
            status: self.status,
        })
    }
}