aws-sdk-networksecuritymanager 1.1.0

AWS SDK for AWS Network Security Manager Customer API
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreateRuleInput {
    /// <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
    pub client_token: ::std::option::Option<::std::string::String>,
    /// <p>The name of the rule.</p>
    pub rule_name: ::std::option::Option<::std::string::String>,
    /// <p>The firewall type associated with the resource.</p>
    pub firewall_type: ::std::option::Option<crate::types::RuleFirewallType>,
    /// <p>The type of the rule. <code>CONFIGURATION</code> rules contain firewall settings, and <code>INSPECTION</code> rules contain rule groups.</p>
    pub rule_type: ::std::option::Option<crate::types::RuleType>,
    /// <p>A description of the rule.</p>
    pub rule_description: ::std::option::Option<::std::string::String>,
    /// <p>The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF <code>INSPECTION</code> rule, provide an AWS WAF rule group. For an AWS WAF <code>CONFIGURATION</code> rule, provide a single web ACL setting, such as <code>DefaultAction</code> or <code>VisibilityConfig</code>; use <code>wafConfigDataType</code> to declare which setting the document contains. For the schema of each setting and complete examples, see <a href="https://docs.aws.amazon.com/network-security-manager/latest/devguide/what-is.html">Writing rule configurations</a> in the <i>AWS Network Security Manager Developer Guide</i>.</p>
    pub configuration: ::std::option::Option<::aws_smithy_types::Document>,
    /// <p>Specifies whether to publish the resource. When <code>true</code>, the resource is saved in published (<code>ACTIVE</code>) state. When <code>false</code>, it is saved as a draft (<code>DRAFT</code>). Default: <code>true</code>.</p>
    pub is_published: ::std::option::Option<bool>,
    /// <p>The tags to add to the resource when it is created.</p>
    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl CreateRuleInput {
    /// <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
    pub fn client_token(&self) -> ::std::option::Option<&str> {
        self.client_token.as_deref()
    }
    /// <p>The name of the rule.</p>
    pub fn rule_name(&self) -> ::std::option::Option<&str> {
        self.rule_name.as_deref()
    }
    /// <p>The firewall type associated with the resource.</p>
    pub fn firewall_type(&self) -> ::std::option::Option<&crate::types::RuleFirewallType> {
        self.firewall_type.as_ref()
    }
    /// <p>The type of the rule. <code>CONFIGURATION</code> rules contain firewall settings, and <code>INSPECTION</code> rules contain rule groups.</p>
    pub fn rule_type(&self) -> ::std::option::Option<&crate::types::RuleType> {
        self.rule_type.as_ref()
    }
    /// <p>A description of the rule.</p>
    pub fn rule_description(&self) -> ::std::option::Option<&str> {
        self.rule_description.as_deref()
    }
    /// <p>The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF <code>INSPECTION</code> rule, provide an AWS WAF rule group. For an AWS WAF <code>CONFIGURATION</code> rule, provide a single web ACL setting, such as <code>DefaultAction</code> or <code>VisibilityConfig</code>; use <code>wafConfigDataType</code> to declare which setting the document contains. For the schema of each setting and complete examples, see <a href="https://docs.aws.amazon.com/network-security-manager/latest/devguide/what-is.html">Writing rule configurations</a> in the <i>AWS Network Security Manager Developer Guide</i>.</p>
    pub fn configuration(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
        self.configuration.as_ref()
    }
    /// <p>Specifies whether to publish the resource. When <code>true</code>, the resource is saved in published (<code>ACTIVE</code>) state. When <code>false</code>, it is saved as a draft (<code>DRAFT</code>). Default: <code>true</code>.</p>
    pub fn is_published(&self) -> ::std::option::Option<bool> {
        self.is_published
    }
    /// <p>The tags to add to the resource when it is created.</p>
    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.tags.as_ref()
    }
}
impl CreateRuleInput {
    /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
        crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
    }
}

/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateRuleInputBuilder {
    pub(crate) client_token: ::std::option::Option<::std::string::String>,
    pub(crate) rule_name: ::std::option::Option<::std::string::String>,
    pub(crate) firewall_type: ::std::option::Option<crate::types::RuleFirewallType>,
    pub(crate) rule_type: ::std::option::Option<crate::types::RuleType>,
    pub(crate) rule_description: ::std::option::Option<::std::string::String>,
    pub(crate) configuration: ::std::option::Option<::aws_smithy_types::Document>,
    pub(crate) is_published: ::std::option::Option<bool>,
    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
}
impl CreateRuleInputBuilder {
    /// <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.client_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.client_token = input;
        self
    }
    /// <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.client_token
    }
    /// <p>The name of the rule.</p>
    /// This field is required.
    pub fn rule_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.rule_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the rule.</p>
    pub fn set_rule_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.rule_name = input;
        self
    }
    /// <p>The name of the rule.</p>
    pub fn get_rule_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.rule_name
    }
    /// <p>The firewall type associated with the resource.</p>
    /// This field is required.
    pub fn firewall_type(mut self, input: crate::types::RuleFirewallType) -> Self {
        self.firewall_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The firewall type associated with the resource.</p>
    pub fn set_firewall_type(mut self, input: ::std::option::Option<crate::types::RuleFirewallType>) -> Self {
        self.firewall_type = input;
        self
    }
    /// <p>The firewall type associated with the resource.</p>
    pub fn get_firewall_type(&self) -> &::std::option::Option<crate::types::RuleFirewallType> {
        &self.firewall_type
    }
    /// <p>The type of the rule. <code>CONFIGURATION</code> rules contain firewall settings, and <code>INSPECTION</code> rules contain rule groups.</p>
    /// This field is required.
    pub fn rule_type(mut self, input: crate::types::RuleType) -> Self {
        self.rule_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of the rule. <code>CONFIGURATION</code> rules contain firewall settings, and <code>INSPECTION</code> rules contain rule groups.</p>
    pub fn set_rule_type(mut self, input: ::std::option::Option<crate::types::RuleType>) -> Self {
        self.rule_type = input;
        self
    }
    /// <p>The type of the rule. <code>CONFIGURATION</code> rules contain firewall settings, and <code>INSPECTION</code> rules contain rule groups.</p>
    pub fn get_rule_type(&self) -> &::std::option::Option<crate::types::RuleType> {
        &self.rule_type
    }
    /// <p>A description of the rule.</p>
    pub fn rule_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.rule_description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A description of the rule.</p>
    pub fn set_rule_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.rule_description = input;
        self
    }
    /// <p>A description of the rule.</p>
    pub fn get_rule_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.rule_description
    }
    /// <p>The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF <code>INSPECTION</code> rule, provide an AWS WAF rule group. For an AWS WAF <code>CONFIGURATION</code> rule, provide a single web ACL setting, such as <code>DefaultAction</code> or <code>VisibilityConfig</code>; use <code>wafConfigDataType</code> to declare which setting the document contains. For the schema of each setting and complete examples, see <a href="https://docs.aws.amazon.com/network-security-manager/latest/devguide/what-is.html">Writing rule configurations</a> in the <i>AWS Network Security Manager Developer Guide</i>.</p>
    /// This field is required.
    pub fn configuration(mut self, input: ::aws_smithy_types::Document) -> Self {
        self.configuration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF <code>INSPECTION</code> rule, provide an AWS WAF rule group. For an AWS WAF <code>CONFIGURATION</code> rule, provide a single web ACL setting, such as <code>DefaultAction</code> or <code>VisibilityConfig</code>; use <code>wafConfigDataType</code> to declare which setting the document contains. For the schema of each setting and complete examples, see <a href="https://docs.aws.amazon.com/network-security-manager/latest/devguide/what-is.html">Writing rule configurations</a> in the <i>AWS Network Security Manager Developer Guide</i>.</p>
    pub fn set_configuration(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
        self.configuration = input;
        self
    }
    /// <p>The firewall configuration for the rule, as a JSON document. The structure depends on the rule's firewall type and rule type. For an AWS WAF <code>INSPECTION</code> rule, provide an AWS WAF rule group. For an AWS WAF <code>CONFIGURATION</code> rule, provide a single web ACL setting, such as <code>DefaultAction</code> or <code>VisibilityConfig</code>; use <code>wafConfigDataType</code> to declare which setting the document contains. For the schema of each setting and complete examples, see <a href="https://docs.aws.amazon.com/network-security-manager/latest/devguide/what-is.html">Writing rule configurations</a> in the <i>AWS Network Security Manager Developer Guide</i>.</p>
    pub fn get_configuration(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
        &self.configuration
    }
    /// <p>Specifies whether to publish the resource. When <code>true</code>, the resource is saved in published (<code>ACTIVE</code>) state. When <code>false</code>, it is saved as a draft (<code>DRAFT</code>). Default: <code>true</code>.</p>
    pub fn is_published(mut self, input: bool) -> Self {
        self.is_published = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies whether to publish the resource. When <code>true</code>, the resource is saved in published (<code>ACTIVE</code>) state. When <code>false</code>, it is saved as a draft (<code>DRAFT</code>). Default: <code>true</code>.</p>
    pub fn set_is_published(mut self, input: ::std::option::Option<bool>) -> Self {
        self.is_published = input;
        self
    }
    /// <p>Specifies whether to publish the resource. When <code>true</code>, the resource is saved in published (<code>ACTIVE</code>) state. When <code>false</code>, it is saved as a draft (<code>DRAFT</code>). Default: <code>true</code>.</p>
    pub fn get_is_published(&self) -> &::std::option::Option<bool> {
        &self.is_published
    }
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>The tags to add to the resource when it is created.</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 tags to add to the resource when it is created.</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 tags to add to the resource when it is created.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        &self.tags
    }
    /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
            client_token: self.client_token,
            rule_name: self.rule_name,
            firewall_type: self.firewall_type,
            rule_type: self.rule_type,
            rule_description: self.rule_description,
            configuration: self.configuration,
            is_published: self.is_published,
            tags: self.tags,
        })
    }
}