aws-sdk-iot 1.112.0

AWS SDK for AWS IoT
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 UpdateSecurityProfileInput {
    /// <p>The name of the security profile you want to update.</p>
    pub security_profile_name: ::std::option::Option<::std::string::String>,
    /// <p>A description of the security profile.</p>
    pub security_profile_description: ::std::option::Option<::std::string::String>,
    /// <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</p>
    pub behaviors: ::std::option::Option<::std::vec::Vec<crate::types::Behavior>>,
    /// <p>Where the alerts are sent. (Alerts are always sent to the console.)</p>
    pub alert_targets: ::std::option::Option<::std::collections::HashMap<crate::types::AlertTargetType, crate::types::AlertTarget>>,
    /// <p><i>Please use <code>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</code> instead.</i></p>
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    #[deprecated(note = "Use additionalMetricsToRetainV2.")]
    pub additional_metrics_to_retain: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    pub additional_metrics_to_retain_v2: ::std::option::Option<::std::vec::Vec<crate::types::MetricToRetain>>,
    /// <p>If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.</p>
    pub delete_behaviors: ::std::option::Option<bool>,
    /// <p>If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.</p>
    pub delete_alert_targets: ::std::option::Option<bool>,
    /// <p>If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.</p>
    pub delete_additional_metrics_to_retain: ::std::option::Option<bool>,
    /// <p>The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a <code>VersionConflictException</code> is thrown.</p>
    pub expected_version: ::std::option::Option<i64>,
    /// <p>Specifies the MQTT topic and role ARN required for metric export.</p>
    pub metrics_export_config: ::std::option::Option<crate::types::MetricsExportConfig>,
    /// <p>Set the value as true to delete metrics export related configurations.</p>
    pub delete_metrics_export_config: ::std::option::Option<bool>,
}
impl UpdateSecurityProfileInput {
    /// <p>The name of the security profile you want to update.</p>
    pub fn security_profile_name(&self) -> ::std::option::Option<&str> {
        self.security_profile_name.as_deref()
    }
    /// <p>A description of the security profile.</p>
    pub fn security_profile_description(&self) -> ::std::option::Option<&str> {
        self.security_profile_description.as_deref()
    }
    /// <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</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 `.behaviors.is_none()`.
    pub fn behaviors(&self) -> &[crate::types::Behavior] {
        self.behaviors.as_deref().unwrap_or_default()
    }
    /// <p>Where the alerts are sent. (Alerts are always sent to the console.)</p>
    pub fn alert_targets(&self) -> ::std::option::Option<&::std::collections::HashMap<crate::types::AlertTargetType, crate::types::AlertTarget>> {
        self.alert_targets.as_ref()
    }
    /// <p><i>Please use <code>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</code> instead.</i></p>
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</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 `.additional_metrics_to_retain.is_none()`.
    #[deprecated(note = "Use additionalMetricsToRetainV2.")]
    pub fn additional_metrics_to_retain(&self) -> &[::std::string::String] {
        self.additional_metrics_to_retain.as_deref().unwrap_or_default()
    }
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</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 `.additional_metrics_to_retain_v2.is_none()`.
    pub fn additional_metrics_to_retain_v2(&self) -> &[crate::types::MetricToRetain] {
        self.additional_metrics_to_retain_v2.as_deref().unwrap_or_default()
    }
    /// <p>If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_behaviors(&self) -> ::std::option::Option<bool> {
        self.delete_behaviors
    }
    /// <p>If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_alert_targets(&self) -> ::std::option::Option<bool> {
        self.delete_alert_targets
    }
    /// <p>If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_additional_metrics_to_retain(&self) -> ::std::option::Option<bool> {
        self.delete_additional_metrics_to_retain
    }
    /// <p>The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a <code>VersionConflictException</code> is thrown.</p>
    pub fn expected_version(&self) -> ::std::option::Option<i64> {
        self.expected_version
    }
    /// <p>Specifies the MQTT topic and role ARN required for metric export.</p>
    pub fn metrics_export_config(&self) -> ::std::option::Option<&crate::types::MetricsExportConfig> {
        self.metrics_export_config.as_ref()
    }
    /// <p>Set the value as true to delete metrics export related configurations.</p>
    pub fn delete_metrics_export_config(&self) -> ::std::option::Option<bool> {
        self.delete_metrics_export_config
    }
}
impl UpdateSecurityProfileInput {
    /// Creates a new builder-style object to manufacture [`UpdateSecurityProfileInput`](crate::operation::update_security_profile::UpdateSecurityProfileInput).
    pub fn builder() -> crate::operation::update_security_profile::builders::UpdateSecurityProfileInputBuilder {
        crate::operation::update_security_profile::builders::UpdateSecurityProfileInputBuilder::default()
    }
}

/// A builder for [`UpdateSecurityProfileInput`](crate::operation::update_security_profile::UpdateSecurityProfileInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct UpdateSecurityProfileInputBuilder {
    pub(crate) security_profile_name: ::std::option::Option<::std::string::String>,
    pub(crate) security_profile_description: ::std::option::Option<::std::string::String>,
    pub(crate) behaviors: ::std::option::Option<::std::vec::Vec<crate::types::Behavior>>,
    pub(crate) alert_targets: ::std::option::Option<::std::collections::HashMap<crate::types::AlertTargetType, crate::types::AlertTarget>>,
    pub(crate) additional_metrics_to_retain: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) additional_metrics_to_retain_v2: ::std::option::Option<::std::vec::Vec<crate::types::MetricToRetain>>,
    pub(crate) delete_behaviors: ::std::option::Option<bool>,
    pub(crate) delete_alert_targets: ::std::option::Option<bool>,
    pub(crate) delete_additional_metrics_to_retain: ::std::option::Option<bool>,
    pub(crate) expected_version: ::std::option::Option<i64>,
    pub(crate) metrics_export_config: ::std::option::Option<crate::types::MetricsExportConfig>,
    pub(crate) delete_metrics_export_config: ::std::option::Option<bool>,
}
impl UpdateSecurityProfileInputBuilder {
    /// <p>The name of the security profile you want to update.</p>
    /// This field is required.
    pub fn security_profile_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.security_profile_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the security profile you want to update.</p>
    pub fn set_security_profile_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.security_profile_name = input;
        self
    }
    /// <p>The name of the security profile you want to update.</p>
    pub fn get_security_profile_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.security_profile_name
    }
    /// <p>A description of the security profile.</p>
    pub fn security_profile_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.security_profile_description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A description of the security profile.</p>
    pub fn set_security_profile_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.security_profile_description = input;
        self
    }
    /// <p>A description of the security profile.</p>
    pub fn get_security_profile_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.security_profile_description
    }
    /// Appends an item to `behaviors`.
    ///
    /// To override the contents of this collection use [`set_behaviors`](Self::set_behaviors).
    ///
    /// <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</p>
    pub fn behaviors(mut self, input: crate::types::Behavior) -> Self {
        let mut v = self.behaviors.unwrap_or_default();
        v.push(input);
        self.behaviors = ::std::option::Option::Some(v);
        self
    }
    /// <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</p>
    pub fn set_behaviors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Behavior>>) -> Self {
        self.behaviors = input;
        self
    }
    /// <p>Specifies the behaviors that, when violated by a device (thing), cause an alert.</p>
    pub fn get_behaviors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Behavior>> {
        &self.behaviors
    }
    /// Adds a key-value pair to `alert_targets`.
    ///
    /// To override the contents of this collection use [`set_alert_targets`](Self::set_alert_targets).
    ///
    /// <p>Where the alerts are sent. (Alerts are always sent to the console.)</p>
    pub fn alert_targets(mut self, k: crate::types::AlertTargetType, v: crate::types::AlertTarget) -> Self {
        let mut hash_map = self.alert_targets.unwrap_or_default();
        hash_map.insert(k, v);
        self.alert_targets = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>Where the alerts are sent. (Alerts are always sent to the console.)</p>
    pub fn set_alert_targets(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<crate::types::AlertTargetType, crate::types::AlertTarget>>,
    ) -> Self {
        self.alert_targets = input;
        self
    }
    /// <p>Where the alerts are sent. (Alerts are always sent to the console.)</p>
    pub fn get_alert_targets(&self) -> &::std::option::Option<::std::collections::HashMap<crate::types::AlertTargetType, crate::types::AlertTarget>> {
        &self.alert_targets
    }
    /// Appends an item to `additional_metrics_to_retain`.
    ///
    /// To override the contents of this collection use [`set_additional_metrics_to_retain`](Self::set_additional_metrics_to_retain).
    ///
    /// <p><i>Please use <code>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</code> instead.</i></p>
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    #[deprecated(note = "Use additionalMetricsToRetainV2.")]
    pub fn additional_metrics_to_retain(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.additional_metrics_to_retain.unwrap_or_default();
        v.push(input.into());
        self.additional_metrics_to_retain = ::std::option::Option::Some(v);
        self
    }
    /// <p><i>Please use <code>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</code> instead.</i></p>
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    #[deprecated(note = "Use additionalMetricsToRetainV2.")]
    pub fn set_additional_metrics_to_retain(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.additional_metrics_to_retain = input;
        self
    }
    /// <p><i>Please use <code>UpdateSecurityProfileRequest$additionalMetricsToRetainV2</code> instead.</i></p>
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's <code>behaviors</code>, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    #[deprecated(note = "Use additionalMetricsToRetainV2.")]
    pub fn get_additional_metrics_to_retain(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.additional_metrics_to_retain
    }
    /// Appends an item to `additional_metrics_to_retain_v2`.
    ///
    /// To override the contents of this collection use [`set_additional_metrics_to_retain_v2`](Self::set_additional_metrics_to_retain_v2).
    ///
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    pub fn additional_metrics_to_retain_v2(mut self, input: crate::types::MetricToRetain) -> Self {
        let mut v = self.additional_metrics_to_retain_v2.unwrap_or_default();
        v.push(input);
        self.additional_metrics_to_retain_v2 = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    pub fn set_additional_metrics_to_retain_v2(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::MetricToRetain>>) -> Self {
        self.additional_metrics_to_retain_v2 = input;
        self
    }
    /// <p>A list of metrics whose data is retained (stored). By default, data is retained for any metric used in the profile's behaviors, but it is also retained for any metric specified here. Can be used with custom metrics; cannot be used with dimensions.</p>
    pub fn get_additional_metrics_to_retain_v2(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::MetricToRetain>> {
        &self.additional_metrics_to_retain_v2
    }
    /// <p>If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_behaviors(mut self, input: bool) -> Self {
        self.delete_behaviors = ::std::option::Option::Some(input);
        self
    }
    /// <p>If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.</p>
    pub fn set_delete_behaviors(mut self, input: ::std::option::Option<bool>) -> Self {
        self.delete_behaviors = input;
        self
    }
    /// <p>If true, delete all <code>behaviors</code> defined for this security profile. If any <code>behaviors</code> are defined in the current invocation, an exception occurs.</p>
    pub fn get_delete_behaviors(&self) -> &::std::option::Option<bool> {
        &self.delete_behaviors
    }
    /// <p>If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_alert_targets(mut self, input: bool) -> Self {
        self.delete_alert_targets = ::std::option::Option::Some(input);
        self
    }
    /// <p>If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.</p>
    pub fn set_delete_alert_targets(mut self, input: ::std::option::Option<bool>) -> Self {
        self.delete_alert_targets = input;
        self
    }
    /// <p>If true, delete all <code>alertTargets</code> defined for this security profile. If any <code>alertTargets</code> are defined in the current invocation, an exception occurs.</p>
    pub fn get_delete_alert_targets(&self) -> &::std::option::Option<bool> {
        &self.delete_alert_targets
    }
    /// <p>If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.</p>
    pub fn delete_additional_metrics_to_retain(mut self, input: bool) -> Self {
        self.delete_additional_metrics_to_retain = ::std::option::Option::Some(input);
        self
    }
    /// <p>If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.</p>
    pub fn set_delete_additional_metrics_to_retain(mut self, input: ::std::option::Option<bool>) -> Self {
        self.delete_additional_metrics_to_retain = input;
        self
    }
    /// <p>If true, delete all <code>additionalMetricsToRetain</code> defined for this security profile. If any <code>additionalMetricsToRetain</code> are defined in the current invocation, an exception occurs.</p>
    pub fn get_delete_additional_metrics_to_retain(&self) -> &::std::option::Option<bool> {
        &self.delete_additional_metrics_to_retain
    }
    /// <p>The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a <code>VersionConflictException</code> is thrown.</p>
    pub fn expected_version(mut self, input: i64) -> Self {
        self.expected_version = ::std::option::Option::Some(input);
        self
    }
    /// <p>The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a <code>VersionConflictException</code> is thrown.</p>
    pub fn set_expected_version(mut self, input: ::std::option::Option<i64>) -> Self {
        self.expected_version = input;
        self
    }
    /// <p>The expected version of the security profile. A new version is generated whenever the security profile is updated. If you specify a value that is different from the actual version, a <code>VersionConflictException</code> is thrown.</p>
    pub fn get_expected_version(&self) -> &::std::option::Option<i64> {
        &self.expected_version
    }
    /// <p>Specifies the MQTT topic and role ARN required for metric export.</p>
    pub fn metrics_export_config(mut self, input: crate::types::MetricsExportConfig) -> Self {
        self.metrics_export_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies the MQTT topic and role ARN required for metric export.</p>
    pub fn set_metrics_export_config(mut self, input: ::std::option::Option<crate::types::MetricsExportConfig>) -> Self {
        self.metrics_export_config = input;
        self
    }
    /// <p>Specifies the MQTT topic and role ARN required for metric export.</p>
    pub fn get_metrics_export_config(&self) -> &::std::option::Option<crate::types::MetricsExportConfig> {
        &self.metrics_export_config
    }
    /// <p>Set the value as true to delete metrics export related configurations.</p>
    pub fn delete_metrics_export_config(mut self, input: bool) -> Self {
        self.delete_metrics_export_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>Set the value as true to delete metrics export related configurations.</p>
    pub fn set_delete_metrics_export_config(mut self, input: ::std::option::Option<bool>) -> Self {
        self.delete_metrics_export_config = input;
        self
    }
    /// <p>Set the value as true to delete metrics export related configurations.</p>
    pub fn get_delete_metrics_export_config(&self) -> &::std::option::Option<bool> {
        &self.delete_metrics_export_config
    }
    /// Consumes the builder and constructs a [`UpdateSecurityProfileInput`](crate::operation::update_security_profile::UpdateSecurityProfileInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::update_security_profile::UpdateSecurityProfileInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::update_security_profile::UpdateSecurityProfileInput {
            security_profile_name: self.security_profile_name,
            security_profile_description: self.security_profile_description,
            behaviors: self.behaviors,
            alert_targets: self.alert_targets,
            additional_metrics_to_retain: self.additional_metrics_to_retain,
            additional_metrics_to_retain_v2: self.additional_metrics_to_retain_v2,
            delete_behaviors: self.delete_behaviors,
            delete_alert_targets: self.delete_alert_targets,
            delete_additional_metrics_to_retain: self.delete_additional_metrics_to_retain,
            expected_version: self.expected_version,
            metrics_export_config: self.metrics_export_config,
            delete_metrics_export_config: self.delete_metrics_export_config,
        })
    }
}