{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.S3.Types.ReplicationRuleFilter -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.S3.Types.ReplicationRuleFilter where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import Amazonka.S3.Internal import Amazonka.S3.Types.ReplicationRuleAndOperator import Amazonka.S3.Types.Tag -- | A filter that identifies the subset of objects to which the replication -- rule applies. A @Filter@ must specify exactly one @Prefix@, @Tag@, or an -- @And@ child element. -- -- /See:/ 'newReplicationRuleFilter' smart constructor. data ReplicationRuleFilter = ReplicationRuleFilter' { -- | A container for specifying rule filters. The filters determine the -- subset of objects to which the rule applies. This element is required -- only if you specify more than one filter. For example: -- -- - If you specify both a @Prefix@ and a @Tag@ filter, wrap these -- filters in an @And@ tag. -- -- - If you specify a filter based on multiple tags, wrap the @Tag@ -- elements in an @And@ tag. and :: Prelude.Maybe ReplicationRuleAndOperator, -- | An object key name prefix that identifies the subset of objects to which -- the rule applies. -- -- Replacement must be made for object keys containing special characters -- (such as carriage returns) when using XML requests. For more -- information, see -- . prefix :: Prelude.Maybe Prelude.Text, -- | A container for specifying a tag key and value. -- -- The rule applies only to objects that have the tag in their tag set. tag :: Prelude.Maybe Tag } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ReplicationRuleFilter' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'and', 'replicationRuleFilter_and' - A container for specifying rule filters. The filters determine the -- subset of objects to which the rule applies. This element is required -- only if you specify more than one filter. For example: -- -- - If you specify both a @Prefix@ and a @Tag@ filter, wrap these -- filters in an @And@ tag. -- -- - If you specify a filter based on multiple tags, wrap the @Tag@ -- elements in an @And@ tag. -- -- 'prefix', 'replicationRuleFilter_prefix' - An object key name prefix that identifies the subset of objects to which -- the rule applies. -- -- Replacement must be made for object keys containing special characters -- (such as carriage returns) when using XML requests. For more -- information, see -- . -- -- 'tag', 'replicationRuleFilter_tag' - A container for specifying a tag key and value. -- -- The rule applies only to objects that have the tag in their tag set. newReplicationRuleFilter :: ReplicationRuleFilter newReplicationRuleFilter = ReplicationRuleFilter' { and = Prelude.Nothing, prefix = Prelude.Nothing, tag = Prelude.Nothing } -- | A container for specifying rule filters. The filters determine the -- subset of objects to which the rule applies. This element is required -- only if you specify more than one filter. For example: -- -- - If you specify both a @Prefix@ and a @Tag@ filter, wrap these -- filters in an @And@ tag. -- -- - If you specify a filter based on multiple tags, wrap the @Tag@ -- elements in an @And@ tag. replicationRuleFilter_and :: Lens.Lens' ReplicationRuleFilter (Prelude.Maybe ReplicationRuleAndOperator) replicationRuleFilter_and = Lens.lens (\ReplicationRuleFilter' {and} -> and) (\s@ReplicationRuleFilter' {} a -> s {and = a} :: ReplicationRuleFilter) -- | An object key name prefix that identifies the subset of objects to which -- the rule applies. -- -- Replacement must be made for object keys containing special characters -- (such as carriage returns) when using XML requests. For more -- information, see -- . replicationRuleFilter_prefix :: Lens.Lens' ReplicationRuleFilter (Prelude.Maybe Prelude.Text) replicationRuleFilter_prefix = Lens.lens (\ReplicationRuleFilter' {prefix} -> prefix) (\s@ReplicationRuleFilter' {} a -> s {prefix = a} :: ReplicationRuleFilter) -- | A container for specifying a tag key and value. -- -- The rule applies only to objects that have the tag in their tag set. replicationRuleFilter_tag :: Lens.Lens' ReplicationRuleFilter (Prelude.Maybe Tag) replicationRuleFilter_tag = Lens.lens (\ReplicationRuleFilter' {tag} -> tag) (\s@ReplicationRuleFilter' {} a -> s {tag = a} :: ReplicationRuleFilter) instance Data.FromXML ReplicationRuleFilter where parseXML x = ReplicationRuleFilter' Prelude.<$> (x Data..@? "And") Prelude.<*> (x Data..@? "Prefix") Prelude.<*> (x Data..@? "Tag") instance Prelude.Hashable ReplicationRuleFilter where hashWithSalt _salt ReplicationRuleFilter' {..} = _salt `Prelude.hashWithSalt` and `Prelude.hashWithSalt` prefix `Prelude.hashWithSalt` tag instance Prelude.NFData ReplicationRuleFilter where rnf ReplicationRuleFilter' {..} = Prelude.rnf and `Prelude.seq` Prelude.rnf prefix `Prelude.seq` Prelude.rnf tag instance Data.ToXML ReplicationRuleFilter where toXML ReplicationRuleFilter' {..} = Prelude.mconcat [ "And" Data.@= and, "Prefix" Data.@= prefix, "Tag" Data.@= tag ]