aws-sdk-shield 1.98.0

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

/// <p>An object that represents a resource that is under DDoS protection.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Protection {
    /// <p>The unique identifier (ID) of the protection.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>The name of the protection. For example, <code>My CloudFront distributions</code>.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.</p>
    pub resource_arn: ::std::option::Option<::std::string::String>,
    /// <p>The unique identifier (ID) for the Route&nbsp;53 health check that's associated with the protection.</p>
    pub health_check_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The ARN (Amazon Resource Name) of the protection.</p>
    pub protection_arn: ::std::option::Option<::std::string::String>,
    /// <p>The automatic application layer DDoS mitigation settings for the protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.</p>
    pub application_layer_automatic_response_configuration: ::std::option::Option<crate::types::ApplicationLayerAutomaticResponseConfiguration>,
}
impl Protection {
    /// <p>The unique identifier (ID) of the protection.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>The name of the protection. For example, <code>My CloudFront distributions</code>.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.</p>
    pub fn resource_arn(&self) -> ::std::option::Option<&str> {
        self.resource_arn.as_deref()
    }
    /// <p>The unique identifier (ID) for the Route&nbsp;53 health check that's associated with the protection.</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 `.health_check_ids.is_none()`.
    pub fn health_check_ids(&self) -> &[::std::string::String] {
        self.health_check_ids.as_deref().unwrap_or_default()
    }
    /// <p>The ARN (Amazon Resource Name) of the protection.</p>
    pub fn protection_arn(&self) -> ::std::option::Option<&str> {
        self.protection_arn.as_deref()
    }
    /// <p>The automatic application layer DDoS mitigation settings for the protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.</p>
    pub fn application_layer_automatic_response_configuration(
        &self,
    ) -> ::std::option::Option<&crate::types::ApplicationLayerAutomaticResponseConfiguration> {
        self.application_layer_automatic_response_configuration.as_ref()
    }
}
impl Protection {
    /// Creates a new builder-style object to manufacture [`Protection`](crate::types::Protection).
    pub fn builder() -> crate::types::builders::ProtectionBuilder {
        crate::types::builders::ProtectionBuilder::default()
    }
}

/// A builder for [`Protection`](crate::types::Protection).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ProtectionBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
    pub(crate) health_check_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) protection_arn: ::std::option::Option<::std::string::String>,
    pub(crate) application_layer_automatic_response_configuration:
        ::std::option::Option<crate::types::ApplicationLayerAutomaticResponseConfiguration>,
}
impl ProtectionBuilder {
    /// <p>The unique identifier (ID) of the protection.</p>
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier (ID) of the protection.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The unique identifier (ID) of the protection.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>The name of the protection. For example, <code>My CloudFront distributions</code>.</p>
    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 protection. For example, <code>My CloudFront distributions</code>.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the protection. For example, <code>My CloudFront distributions</code>.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.</p>
    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.resource_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.</p>
    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.resource_arn = input;
        self
    }
    /// <p>The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.</p>
    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.resource_arn
    }
    /// Appends an item to `health_check_ids`.
    ///
    /// To override the contents of this collection use [`set_health_check_ids`](Self::set_health_check_ids).
    ///
    /// <p>The unique identifier (ID) for the Route&nbsp;53 health check that's associated with the protection.</p>
    pub fn health_check_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.health_check_ids.unwrap_or_default();
        v.push(input.into());
        self.health_check_ids = ::std::option::Option::Some(v);
        self
    }
    /// <p>The unique identifier (ID) for the Route&nbsp;53 health check that's associated with the protection.</p>
    pub fn set_health_check_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.health_check_ids = input;
        self
    }
    /// <p>The unique identifier (ID) for the Route&nbsp;53 health check that's associated with the protection.</p>
    pub fn get_health_check_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.health_check_ids
    }
    /// <p>The ARN (Amazon Resource Name) of the protection.</p>
    pub fn protection_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.protection_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN (Amazon Resource Name) of the protection.</p>
    pub fn set_protection_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.protection_arn = input;
        self
    }
    /// <p>The ARN (Amazon Resource Name) of the protection.</p>
    pub fn get_protection_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.protection_arn
    }
    /// <p>The automatic application layer DDoS mitigation settings for the protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.</p>
    pub fn application_layer_automatic_response_configuration(mut self, input: crate::types::ApplicationLayerAutomaticResponseConfiguration) -> Self {
        self.application_layer_automatic_response_configuration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The automatic application layer DDoS mitigation settings for the protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.</p>
    pub fn set_application_layer_automatic_response_configuration(
        mut self,
        input: ::std::option::Option<crate::types::ApplicationLayerAutomaticResponseConfiguration>,
    ) -> Self {
        self.application_layer_automatic_response_configuration = input;
        self
    }
    /// <p>The automatic application layer DDoS mitigation settings for the protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.</p>
    pub fn get_application_layer_automatic_response_configuration(
        &self,
    ) -> &::std::option::Option<crate::types::ApplicationLayerAutomaticResponseConfiguration> {
        &self.application_layer_automatic_response_configuration
    }
    /// Consumes the builder and constructs a [`Protection`](crate::types::Protection).
    pub fn build(self) -> crate::types::Protection {
        crate::types::Protection {
            id: self.id,
            name: self.name,
            resource_arn: self.resource_arn,
            health_check_ids: self.health_check_ids,
            protection_arn: self.protection_arn,
            application_layer_automatic_response_configuration: self.application_layer_automatic_response_configuration,
        }
    }
}