aws-sdk-devopsagent 1.10.0

AWS SDK for AWS DevOps Agent Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Represents an asset in an agent space, including its identifier, type, metadata, version, and timestamps.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Asset {
    /// <p>The unique identifier for this asset</p>
    pub asset_id: ::std::string::String,
    /// <p>The type of this asset</p>
    pub asset_type: ::std::string::String,
    /// <p>The metadata for this asset</p>
    pub metadata: ::aws_smithy_types::Document,
    /// <p>The version number of this asset</p>
    pub version: i32,
    /// <p>Timestamp when this asset was created</p>
    pub created_at: ::aws_smithy_types::DateTime,
    /// <p>Timestamp when this asset was last updated</p>
    pub updated_at: ::aws_smithy_types::DateTime,
}
impl Asset {
    /// <p>The unique identifier for this asset</p>
    pub fn asset_id(&self) -> &str {
        use std::ops::Deref;
        self.asset_id.deref()
    }
    /// <p>The type of this asset</p>
    pub fn asset_type(&self) -> &str {
        use std::ops::Deref;
        self.asset_type.deref()
    }
    /// <p>The metadata for this asset</p>
    pub fn metadata(&self) -> &::aws_smithy_types::Document {
        &self.metadata
    }
    /// <p>The version number of this asset</p>
    pub fn version(&self) -> i32 {
        self.version
    }
    /// <p>Timestamp when this asset was created</p>
    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
        &self.created_at
    }
    /// <p>Timestamp when this asset was last updated</p>
    pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
        &self.updated_at
    }
}
impl Asset {
    /// Creates a new builder-style object to manufacture [`Asset`](crate::types::Asset).
    pub fn builder() -> crate::types::builders::AssetBuilder {
        crate::types::builders::AssetBuilder::default()
    }
}

/// A builder for [`Asset`](crate::types::Asset).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AssetBuilder {
    pub(crate) asset_id: ::std::option::Option<::std::string::String>,
    pub(crate) asset_type: ::std::option::Option<::std::string::String>,
    pub(crate) metadata: ::std::option::Option<::aws_smithy_types::Document>,
    pub(crate) version: ::std::option::Option<i32>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl AssetBuilder {
    /// <p>The unique identifier for this asset</p>
    /// This field is required.
    pub fn asset_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.asset_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier for this asset</p>
    pub fn set_asset_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.asset_id = input;
        self
    }
    /// <p>The unique identifier for this asset</p>
    pub fn get_asset_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.asset_id
    }
    /// <p>The type of this asset</p>
    /// This field is required.
    pub fn asset_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.asset_type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The type of this asset</p>
    pub fn set_asset_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.asset_type = input;
        self
    }
    /// <p>The type of this asset</p>
    pub fn get_asset_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.asset_type
    }
    /// <p>The metadata for this asset</p>
    /// This field is required.
    pub fn metadata(mut self, input: ::aws_smithy_types::Document) -> Self {
        self.metadata = ::std::option::Option::Some(input);
        self
    }
    /// <p>The metadata for this asset</p>
    pub fn set_metadata(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
        self.metadata = input;
        self
    }
    /// <p>The metadata for this asset</p>
    pub fn get_metadata(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
        &self.metadata
    }
    /// <p>The version number of this asset</p>
    /// This field is required.
    pub fn version(mut self, input: i32) -> Self {
        self.version = ::std::option::Option::Some(input);
        self
    }
    /// <p>The version number of this asset</p>
    pub fn set_version(mut self, input: ::std::option::Option<i32>) -> Self {
        self.version = input;
        self
    }
    /// <p>The version number of this asset</p>
    pub fn get_version(&self) -> &::std::option::Option<i32> {
        &self.version
    }
    /// <p>Timestamp when this asset was created</p>
    /// This field is required.
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>Timestamp when this asset was created</p>
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// <p>Timestamp when this asset was created</p>
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// <p>Timestamp when this asset was last updated</p>
    /// This field is required.
    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.updated_at = ::std::option::Option::Some(input);
        self
    }
    /// <p>Timestamp when this asset was last updated</p>
    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.updated_at = input;
        self
    }
    /// <p>Timestamp when this asset was last updated</p>
    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.updated_at
    }
    /// Consumes the builder and constructs a [`Asset`](crate::types::Asset).
    /// This method will fail if any of the following fields are not set:
    /// - [`asset_id`](crate::types::builders::AssetBuilder::asset_id)
    /// - [`asset_type`](crate::types::builders::AssetBuilder::asset_type)
    /// - [`metadata`](crate::types::builders::AssetBuilder::metadata)
    /// - [`version`](crate::types::builders::AssetBuilder::version)
    /// - [`created_at`](crate::types::builders::AssetBuilder::created_at)
    /// - [`updated_at`](crate::types::builders::AssetBuilder::updated_at)
    pub fn build(self) -> ::std::result::Result<crate::types::Asset, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Asset {
            asset_id: self.asset_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "asset_id",
                    "asset_id was not specified but it is required when building Asset",
                )
            })?,
            asset_type: self.asset_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "asset_type",
                    "asset_type was not specified but it is required when building Asset",
                )
            })?,
            metadata: self.metadata.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "metadata",
                    "metadata was not specified but it is required when building Asset",
                )
            })?,
            version: self.version.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "version",
                    "version was not specified but it is required when building Asset",
                )
            })?,
            created_at: self.created_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "created_at",
                    "created_at was not specified but it is required when building Asset",
                )
            })?,
            updated_at: self.updated_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "updated_at",
                    "updated_at was not specified but it is required when building Asset",
                )
            })?,
        })
    }
}