aws-sdk-glue 1.147.0

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

/// <p>An object that defines a connection type for a compute environment.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Property {
    /// <p>The name of the property.</p>
    pub name: ::std::string::String,
    /// <p>A description of the property.</p>
    pub description: ::std::string::String,
    /// <p>Indicates whether the property is required.</p>
    pub required: bool,
    /// <p>The default value for the property.</p>
    pub default_value: ::std::option::Option<::std::string::String>,
    /// <p>Describes the type of property.</p>
    pub property_types: ::std::vec::Vec<crate::types::PropertyType>,
    /// <p>A list of <code>AllowedValue</code> objects representing the values allowed for the property.</p>
    pub allowed_values: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>,
    /// <p>Indicates which data operations are applicable to the property.</p>
    pub data_operation_scopes: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>,
    /// <p>A key name to use when sending this property in API requests, if different from the display name.</p>
    pub key_override: ::std::option::Option<::std::string::String>,
    /// <p>Specifies where this property should be included in REST requests, such as in headers, query parameters, or request body.</p>
    pub property_location: ::std::option::Option<crate::types::PropertyLocation>,
}
impl Property {
    /// <p>The name of the property.</p>
    pub fn name(&self) -> &str {
        use std::ops::Deref;
        self.name.deref()
    }
    /// <p>A description of the property.</p>
    pub fn description(&self) -> &str {
        use std::ops::Deref;
        self.description.deref()
    }
    /// <p>Indicates whether the property is required.</p>
    pub fn required(&self) -> bool {
        self.required
    }
    /// <p>The default value for the property.</p>
    pub fn default_value(&self) -> ::std::option::Option<&str> {
        self.default_value.as_deref()
    }
    /// <p>Describes the type of property.</p>
    pub fn property_types(&self) -> &[crate::types::PropertyType] {
        use std::ops::Deref;
        self.property_types.deref()
    }
    /// <p>A list of <code>AllowedValue</code> objects representing the values allowed for the property.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.allowed_values.is_none()`.
    pub fn allowed_values(&self) -> &[crate::types::AllowedValue] {
        self.allowed_values.as_deref().unwrap_or_default()
    }
    /// <p>Indicates which data operations are applicable to the property.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.data_operation_scopes.is_none()`.
    pub fn data_operation_scopes(&self) -> &[crate::types::DataOperation] {
        self.data_operation_scopes.as_deref().unwrap_or_default()
    }
    /// <p>A key name to use when sending this property in API requests, if different from the display name.</p>
    pub fn key_override(&self) -> ::std::option::Option<&str> {
        self.key_override.as_deref()
    }
    /// <p>Specifies where this property should be included in REST requests, such as in headers, query parameters, or request body.</p>
    pub fn property_location(&self) -> ::std::option::Option<&crate::types::PropertyLocation> {
        self.property_location.as_ref()
    }
}
impl Property {
    /// Creates a new builder-style object to manufacture [`Property`](crate::types::Property).
    pub fn builder() -> crate::types::builders::PropertyBuilder {
        crate::types::builders::PropertyBuilder::default()
    }
}

/// A builder for [`Property`](crate::types::Property).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PropertyBuilder {
    pub(crate) 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) default_value: ::std::option::Option<::std::string::String>,
    pub(crate) property_types: ::std::option::Option<::std::vec::Vec<crate::types::PropertyType>>,
    pub(crate) allowed_values: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>,
    pub(crate) data_operation_scopes: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>,
    pub(crate) key_override: ::std::option::Option<::std::string::String>,
    pub(crate) property_location: ::std::option::Option<crate::types::PropertyLocation>,
}
impl PropertyBuilder {
    /// <p>The name of the property.</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 property.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the property.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>A description of the property.</p>
    /// 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
    }
    /// <p>A description of the property.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>A description of the property.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// <p>Indicates whether the property is required.</p>
    /// This field is required.
    pub fn required(mut self, input: bool) -> Self {
        self.required = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates whether the property is required.</p>
    pub fn set_required(mut self, input: ::std::option::Option<bool>) -> Self {
        self.required = input;
        self
    }
    /// <p>Indicates whether the property is required.</p>
    pub fn get_required(&self) -> &::std::option::Option<bool> {
        &self.required
    }
    /// <p>The default value for the property.</p>
    pub fn default_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.default_value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The default value for the property.</p>
    pub fn set_default_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.default_value = input;
        self
    }
    /// <p>The default value for the property.</p>
    pub fn get_default_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.default_value
    }
    /// Appends an item to `property_types`.
    ///
    /// To override the contents of this collection use [`set_property_types`](Self::set_property_types).
    ///
    /// <p>Describes the type of property.</p>
    pub fn property_types(mut self, input: crate::types::PropertyType) -> Self {
        let mut v = self.property_types.unwrap_or_default();
        v.push(input);
        self.property_types = ::std::option::Option::Some(v);
        self
    }
    /// <p>Describes the type of property.</p>
    pub fn set_property_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PropertyType>>) -> Self {
        self.property_types = input;
        self
    }
    /// <p>Describes the type of property.</p>
    pub fn get_property_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PropertyType>> {
        &self.property_types
    }
    /// Appends an item to `allowed_values`.
    ///
    /// To override the contents of this collection use [`set_allowed_values`](Self::set_allowed_values).
    ///
    /// <p>A list of <code>AllowedValue</code> objects representing the values allowed for the property.</p>
    pub fn allowed_values(mut self, input: crate::types::AllowedValue) -> Self {
        let mut v = self.allowed_values.unwrap_or_default();
        v.push(input);
        self.allowed_values = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of <code>AllowedValue</code> objects representing the values allowed for the property.</p>
    pub fn set_allowed_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>>) -> Self {
        self.allowed_values = input;
        self
    }
    /// <p>A list of <code>AllowedValue</code> objects representing the values allowed for the property.</p>
    pub fn get_allowed_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AllowedValue>> {
        &self.allowed_values
    }
    /// Appends an item to `data_operation_scopes`.
    ///
    /// To override the contents of this collection use [`set_data_operation_scopes`](Self::set_data_operation_scopes).
    ///
    /// <p>Indicates which data operations are applicable to the property.</p>
    pub fn data_operation_scopes(mut self, input: crate::types::DataOperation) -> Self {
        let mut v = self.data_operation_scopes.unwrap_or_default();
        v.push(input);
        self.data_operation_scopes = ::std::option::Option::Some(v);
        self
    }
    /// <p>Indicates which data operations are applicable to the property.</p>
    pub fn set_data_operation_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DataOperation>>) -> Self {
        self.data_operation_scopes = input;
        self
    }
    /// <p>Indicates which data operations are applicable to the property.</p>
    pub fn get_data_operation_scopes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DataOperation>> {
        &self.data_operation_scopes
    }
    /// <p>A key name to use when sending this property in API requests, if different from the display name.</p>
    pub fn key_override(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_override = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A key name to use when sending this property in API requests, if different from the display name.</p>
    pub fn set_key_override(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_override = input;
        self
    }
    /// <p>A key name to use when sending this property in API requests, if different from the display name.</p>
    pub fn get_key_override(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_override
    }
    /// <p>Specifies where this property should be included in REST requests, such as in headers, query parameters, or request body.</p>
    pub fn property_location(mut self, input: crate::types::PropertyLocation) -> Self {
        self.property_location = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies where this property should be included in REST requests, such as in headers, query parameters, or request body.</p>
    pub fn set_property_location(mut self, input: ::std::option::Option<crate::types::PropertyLocation>) -> Self {
        self.property_location = input;
        self
    }
    /// <p>Specifies where this property should be included in REST requests, such as in headers, query parameters, or request body.</p>
    pub fn get_property_location(&self) -> &::std::option::Option<crate::types::PropertyLocation> {
        &self.property_location
    }
    /// Consumes the builder and constructs a [`Property`](crate::types::Property).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::PropertyBuilder::name)
    /// - [`description`](crate::types::builders::PropertyBuilder::description)
    /// - [`required`](crate::types::builders::PropertyBuilder::required)
    pub fn build(self) -> ::std::result::Result<crate::types::Property, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Property {
            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 Property",
                )
            })?,
            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 Property",
                )
            })?,
            required: self.required.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "required",
                    "required was not specified but it is required when building Property",
                )
            })?,
            default_value: self.default_value,
            property_types: self.property_types.unwrap_or_default(),
            allowed_values: self.allowed_values,
            data_operation_scopes: self.data_operation_scopes,
            key_override: self.key_override,
            property_location: self.property_location,
        })
    }
}