aws-sdk-cloudextensions 1.0.0

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

/// Defines a configurable setting that an extension exposes to deployers. Settings are part of an extension's declared configuration schema.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Setting {
    /// A unique identifier for this setting within the extension's configuration.
    pub id: ::std::string::String,
    /// A short, human-readable label for this setting, suitable for display in a UI.
    pub display_name: ::std::string::String,
    /// A description of what this setting controls and how it affects the extension's behavior.
    pub description: ::std::string::String,
    /// Whether the deployer must provide a value for this setting. Defaults to false.
    pub required: ::std::option::Option<bool>,
    /// A conditional expression referencing another setting's id. When specified, this setting is only active (visible and applicable) when the referenced condition is met.
    pub active_when: ::std::option::Option<::std::string::String>,
    /// The type and constraints for this setting's value.
    pub definition: ::std::option::Option<crate::types::SettingDefinition>,
}
impl Setting {
    /// A unique identifier for this setting within the extension's configuration.
    pub fn id(&self) -> &str {
        use std::ops::Deref;
        self.id.deref()
    }
    /// A short, human-readable label for this setting, suitable for display in a UI.
    pub fn display_name(&self) -> &str {
        use std::ops::Deref;
        self.display_name.deref()
    }
    /// A description of what this setting controls and how it affects the extension's behavior.
    pub fn description(&self) -> &str {
        use std::ops::Deref;
        self.description.deref()
    }
    /// Whether the deployer must provide a value for this setting. Defaults to false.
    pub fn required(&self) -> ::std::option::Option<bool> {
        self.required
    }
    /// A conditional expression referencing another setting's id. When specified, this setting is only active (visible and applicable) when the referenced condition is met.
    pub fn active_when(&self) -> ::std::option::Option<&str> {
        self.active_when.as_deref()
    }
    /// The type and constraints for this setting's value.
    pub fn definition(&self) -> ::std::option::Option<&crate::types::SettingDefinition> {
        self.definition.as_ref()
    }
}
impl Setting {
    /// Creates a new builder-style object to manufacture [`Setting`](crate::types::Setting).
    pub fn builder() -> crate::types::builders::SettingBuilder {
        crate::types::builders::SettingBuilder::default()
    }
}

/// A builder for [`Setting`](crate::types::Setting).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SettingBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) display_name: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) required: ::std::option::Option<bool>,
    pub(crate) active_when: ::std::option::Option<::std::string::String>,
    pub(crate) definition: ::std::option::Option<crate::types::SettingDefinition>,
}
impl SettingBuilder {
    /// A unique identifier for this setting within the extension's configuration.
    /// This field is required.
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// A unique identifier for this setting within the extension's configuration.
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// A unique identifier for this setting within the extension's configuration.
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// A short, human-readable label for this setting, suitable for display in a UI.
    /// This field is required.
    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.display_name = ::std::option::Option::Some(input.into());
        self
    }
    /// A short, human-readable label for this setting, suitable for display in a UI.
    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.display_name = input;
        self
    }
    /// A short, human-readable label for this setting, suitable for display in a UI.
    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.display_name
    }
    /// A description of what this setting controls and how it affects the extension's behavior.
    /// This field is required.
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// A description of what this setting controls and how it affects the extension's behavior.
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// A description of what this setting controls and how it affects the extension's behavior.
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Whether the deployer must provide a value for this setting. Defaults to false.
    pub fn required(mut self, input: bool) -> Self {
        self.required = ::std::option::Option::Some(input);
        self
    }
    /// Whether the deployer must provide a value for this setting. Defaults to false.
    pub fn set_required(mut self, input: ::std::option::Option<bool>) -> Self {
        self.required = input;
        self
    }
    /// Whether the deployer must provide a value for this setting. Defaults to false.
    pub fn get_required(&self) -> &::std::option::Option<bool> {
        &self.required
    }
    /// A conditional expression referencing another setting's id. When specified, this setting is only active (visible and applicable) when the referenced condition is met.
    pub fn active_when(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.active_when = ::std::option::Option::Some(input.into());
        self
    }
    /// A conditional expression referencing another setting's id. When specified, this setting is only active (visible and applicable) when the referenced condition is met.
    pub fn set_active_when(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.active_when = input;
        self
    }
    /// A conditional expression referencing another setting's id. When specified, this setting is only active (visible and applicable) when the referenced condition is met.
    pub fn get_active_when(&self) -> &::std::option::Option<::std::string::String> {
        &self.active_when
    }
    /// The type and constraints for this setting's value.
    /// This field is required.
    pub fn definition(mut self, input: crate::types::SettingDefinition) -> Self {
        self.definition = ::std::option::Option::Some(input);
        self
    }
    /// The type and constraints for this setting's value.
    pub fn set_definition(mut self, input: ::std::option::Option<crate::types::SettingDefinition>) -> Self {
        self.definition = input;
        self
    }
    /// The type and constraints for this setting's value.
    pub fn get_definition(&self) -> &::std::option::Option<crate::types::SettingDefinition> {
        &self.definition
    }
    /// Consumes the builder and constructs a [`Setting`](crate::types::Setting).
    /// This method will fail if any of the following fields are not set:
    /// - [`id`](crate::types::builders::SettingBuilder::id)
    /// - [`display_name`](crate::types::builders::SettingBuilder::display_name)
    /// - [`description`](crate::types::builders::SettingBuilder::description)
    pub fn build(self) -> ::std::result::Result<crate::types::Setting, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Setting {
            id: self.id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field("id", "id was not specified but it is required when building Setting")
            })?,
            display_name: self.display_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "display_name",
                    "display_name was not specified but it is required when building Setting",
                )
            })?,
            description: self.description.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "description",
                    "description was not specified but it is required when building Setting",
                )
            })?,
            required: self.required,
            active_when: self.active_when,
            definition: self.definition,
        })
    }
}