aws-sdk-amp 1.110.0

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

/// <p>Represents the output of a <code>CreateWorkspace</code> operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreateWorkspaceOutput {
    /// <p>The unique ID for the new workspace.</p>
    pub workspace_id: ::std::string::String,
    /// <p>The ARN for the new workspace.</p>
    pub arn: ::std::string::String,
    /// <p>The current status of the new workspace. Immediately after you create the workspace, the status is usually <code>CREATING</code>.</p>
    pub status: ::std::option::Option<crate::types::WorkspaceStatus>,
    /// <p>The list of tag keys and values that are associated with the workspace.</p>
    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    /// <p>(optional) If the workspace was created with a customer managed KMS key, the ARN for the key used.</p>
    pub kms_key_arn: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl CreateWorkspaceOutput {
    /// <p>The unique ID for the new workspace.</p>
    pub fn workspace_id(&self) -> &str {
        use std::ops::Deref;
        self.workspace_id.deref()
    }
    /// <p>The ARN for the new workspace.</p>
    pub fn arn(&self) -> &str {
        use std::ops::Deref;
        self.arn.deref()
    }
    /// <p>The current status of the new workspace. Immediately after you create the workspace, the status is usually <code>CREATING</code>.</p>
    pub fn status(&self) -> ::std::option::Option<&crate::types::WorkspaceStatus> {
        self.status.as_ref()
    }
    /// <p>The list of tag keys and values that are associated with the workspace.</p>
    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.tags.as_ref()
    }
    /// <p>(optional) If the workspace was created with a customer managed KMS key, the ARN for the key used.</p>
    pub fn kms_key_arn(&self) -> ::std::option::Option<&str> {
        self.kms_key_arn.as_deref()
    }
}
impl ::aws_types::request_id::RequestId for CreateWorkspaceOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl CreateWorkspaceOutput {
    /// Creates a new builder-style object to manufacture [`CreateWorkspaceOutput`](crate::operation::create_workspace::CreateWorkspaceOutput).
    pub fn builder() -> crate::operation::create_workspace::builders::CreateWorkspaceOutputBuilder {
        crate::operation::create_workspace::builders::CreateWorkspaceOutputBuilder::default()
    }
}

/// A builder for [`CreateWorkspaceOutput`](crate::operation::create_workspace::CreateWorkspaceOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateWorkspaceOutputBuilder {
    pub(crate) workspace_id: ::std::option::Option<::std::string::String>,
    pub(crate) arn: ::std::option::Option<::std::string::String>,
    pub(crate) status: ::std::option::Option<crate::types::WorkspaceStatus>,
    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    pub(crate) kms_key_arn: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl CreateWorkspaceOutputBuilder {
    /// <p>The unique ID for the new workspace.</p>
    /// This field is required.
    pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.workspace_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique ID for the new workspace.</p>
    pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.workspace_id = input;
        self
    }
    /// <p>The unique ID for the new workspace.</p>
    pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.workspace_id
    }
    /// <p>The ARN for the new workspace.</p>
    /// This field is required.
    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN for the new workspace.</p>
    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.arn = input;
        self
    }
    /// <p>The ARN for the new workspace.</p>
    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.arn
    }
    /// <p>The current status of the new workspace. Immediately after you create the workspace, the status is usually <code>CREATING</code>.</p>
    /// This field is required.
    pub fn status(mut self, input: crate::types::WorkspaceStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The current status of the new workspace. Immediately after you create the workspace, the status is usually <code>CREATING</code>.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::WorkspaceStatus>) -> Self {
        self.status = input;
        self
    }
    /// <p>The current status of the new workspace. Immediately after you create the workspace, the status is usually <code>CREATING</code>.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::WorkspaceStatus> {
        &self.status
    }
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>The list of tag keys and values that are associated with the workspace.</p>
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.tags.unwrap_or_default();
        hash_map.insert(k.into(), v.into());
        self.tags = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The list of tag keys and values that are associated with the workspace.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.tags = input;
        self
    }
    /// <p>The list of tag keys and values that are associated with the workspace.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.tags
    }
    /// <p>(optional) If the workspace was created with a customer managed KMS key, the ARN for the key used.</p>
    pub fn kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.kms_key_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>(optional) If the workspace was created with a customer managed KMS key, the ARN for the key used.</p>
    pub fn set_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.kms_key_arn = input;
        self
    }
    /// <p>(optional) If the workspace was created with a customer managed KMS key, the ARN for the key used.</p>
    pub fn get_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.kms_key_arn
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`CreateWorkspaceOutput`](crate::operation::create_workspace::CreateWorkspaceOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`workspace_id`](crate::operation::create_workspace::builders::CreateWorkspaceOutputBuilder::workspace_id)
    /// - [`arn`](crate::operation::create_workspace::builders::CreateWorkspaceOutputBuilder::arn)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::create_workspace::CreateWorkspaceOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_workspace::CreateWorkspaceOutput {
            workspace_id: self.workspace_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "workspace_id",
                    "workspace_id was not specified but it is required when building CreateWorkspaceOutput",
                )
            })?,
            arn: self.arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "arn",
                    "arn was not specified but it is required when building CreateWorkspaceOutput",
                )
            })?,
            status: self.status,
            tags: self.tags,
            kms_key_arn: self.kms_key_arn,
            _request_id: self._request_id,
        })
    }
}