{-# 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.SES.Types.ReceiptRuleSetMetadata
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SES.Types.ReceiptRuleSetMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a receipt rule set.
--
-- A receipt rule set is a collection of rules that specify what Amazon SES
-- should do with mail it receives on behalf of your account\'s verified
-- domains.
--
-- For information about setting up receipt rule sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-receipt-rule-set.html Amazon SES Developer Guide>.
--
-- /See:/ 'newReceiptRuleSetMetadata' smart constructor.
data ReceiptRuleSetMetadata = ReceiptRuleSetMetadata'
  { -- | The name of the receipt rule set. The name must:
    --
    -- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
    --     underscores (_), or dashes (-).
    --
    -- -   Start and end with a letter or number.
    --
    -- -   Contain less than 64 characters.
    ReceiptRuleSetMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time the receipt rule set was created.
    ReceiptRuleSetMetadata -> Maybe ISO8601
createdTimestamp :: Prelude.Maybe Core.ISO8601
  }
  deriving (ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool
(ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool)
-> (ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool)
-> Eq ReceiptRuleSetMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool
$c/= :: ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool
== :: ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool
$c== :: ReceiptRuleSetMetadata -> ReceiptRuleSetMetadata -> Bool
Prelude.Eq, ReadPrec [ReceiptRuleSetMetadata]
ReadPrec ReceiptRuleSetMetadata
Int -> ReadS ReceiptRuleSetMetadata
ReadS [ReceiptRuleSetMetadata]
(Int -> ReadS ReceiptRuleSetMetadata)
-> ReadS [ReceiptRuleSetMetadata]
-> ReadPrec ReceiptRuleSetMetadata
-> ReadPrec [ReceiptRuleSetMetadata]
-> Read ReceiptRuleSetMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReceiptRuleSetMetadata]
$creadListPrec :: ReadPrec [ReceiptRuleSetMetadata]
readPrec :: ReadPrec ReceiptRuleSetMetadata
$creadPrec :: ReadPrec ReceiptRuleSetMetadata
readList :: ReadS [ReceiptRuleSetMetadata]
$creadList :: ReadS [ReceiptRuleSetMetadata]
readsPrec :: Int -> ReadS ReceiptRuleSetMetadata
$creadsPrec :: Int -> ReadS ReceiptRuleSetMetadata
Prelude.Read, Int -> ReceiptRuleSetMetadata -> ShowS
[ReceiptRuleSetMetadata] -> ShowS
ReceiptRuleSetMetadata -> String
(Int -> ReceiptRuleSetMetadata -> ShowS)
-> (ReceiptRuleSetMetadata -> String)
-> ([ReceiptRuleSetMetadata] -> ShowS)
-> Show ReceiptRuleSetMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReceiptRuleSetMetadata] -> ShowS
$cshowList :: [ReceiptRuleSetMetadata] -> ShowS
show :: ReceiptRuleSetMetadata -> String
$cshow :: ReceiptRuleSetMetadata -> String
showsPrec :: Int -> ReceiptRuleSetMetadata -> ShowS
$cshowsPrec :: Int -> ReceiptRuleSetMetadata -> ShowS
Prelude.Show, (forall x. ReceiptRuleSetMetadata -> Rep ReceiptRuleSetMetadata x)
-> (forall x.
    Rep ReceiptRuleSetMetadata x -> ReceiptRuleSetMetadata)
-> Generic ReceiptRuleSetMetadata
forall x. Rep ReceiptRuleSetMetadata x -> ReceiptRuleSetMetadata
forall x. ReceiptRuleSetMetadata -> Rep ReceiptRuleSetMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReceiptRuleSetMetadata x -> ReceiptRuleSetMetadata
$cfrom :: forall x. ReceiptRuleSetMetadata -> Rep ReceiptRuleSetMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ReceiptRuleSetMetadata' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'name', 'receiptRuleSetMetadata_name' - The name of the receipt rule set. The name must:
--
-- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
--     underscores (_), or dashes (-).
--
-- -   Start and end with a letter or number.
--
-- -   Contain less than 64 characters.
--
-- 'createdTimestamp', 'receiptRuleSetMetadata_createdTimestamp' - The date and time the receipt rule set was created.
newReceiptRuleSetMetadata ::
  ReceiptRuleSetMetadata
newReceiptRuleSetMetadata :: ReceiptRuleSetMetadata
newReceiptRuleSetMetadata =
  ReceiptRuleSetMetadata' :: Maybe Text -> Maybe ISO8601 -> ReceiptRuleSetMetadata
ReceiptRuleSetMetadata'
    { $sel:name:ReceiptRuleSetMetadata' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:ReceiptRuleSetMetadata' :: Maybe ISO8601
createdTimestamp = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the receipt rule set. The name must:
--
-- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
--     underscores (_), or dashes (-).
--
-- -   Start and end with a letter or number.
--
-- -   Contain less than 64 characters.
receiptRuleSetMetadata_name :: Lens.Lens' ReceiptRuleSetMetadata (Prelude.Maybe Prelude.Text)
receiptRuleSetMetadata_name :: (Maybe Text -> f (Maybe Text))
-> ReceiptRuleSetMetadata -> f ReceiptRuleSetMetadata
receiptRuleSetMetadata_name = (ReceiptRuleSetMetadata -> Maybe Text)
-> (ReceiptRuleSetMetadata -> Maybe Text -> ReceiptRuleSetMetadata)
-> Lens
     ReceiptRuleSetMetadata
     ReceiptRuleSetMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRuleSetMetadata' {Maybe Text
name :: Maybe Text
$sel:name:ReceiptRuleSetMetadata' :: ReceiptRuleSetMetadata -> Maybe Text
name} -> Maybe Text
name) (\s :: ReceiptRuleSetMetadata
s@ReceiptRuleSetMetadata' {} Maybe Text
a -> ReceiptRuleSetMetadata
s {$sel:name:ReceiptRuleSetMetadata' :: Maybe Text
name = Maybe Text
a} :: ReceiptRuleSetMetadata)

-- | The date and time the receipt rule set was created.
receiptRuleSetMetadata_createdTimestamp :: Lens.Lens' ReceiptRuleSetMetadata (Prelude.Maybe Prelude.UTCTime)
receiptRuleSetMetadata_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReceiptRuleSetMetadata -> f ReceiptRuleSetMetadata
receiptRuleSetMetadata_createdTimestamp = (ReceiptRuleSetMetadata -> Maybe ISO8601)
-> (ReceiptRuleSetMetadata
    -> Maybe ISO8601 -> ReceiptRuleSetMetadata)
-> Lens
     ReceiptRuleSetMetadata
     ReceiptRuleSetMetadata
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRuleSetMetadata' {Maybe ISO8601
createdTimestamp :: Maybe ISO8601
$sel:createdTimestamp:ReceiptRuleSetMetadata' :: ReceiptRuleSetMetadata -> Maybe ISO8601
createdTimestamp} -> Maybe ISO8601
createdTimestamp) (\s :: ReceiptRuleSetMetadata
s@ReceiptRuleSetMetadata' {} Maybe ISO8601
a -> ReceiptRuleSetMetadata
s {$sel:createdTimestamp:ReceiptRuleSetMetadata' :: Maybe ISO8601
createdTimestamp = Maybe ISO8601
a} :: ReceiptRuleSetMetadata) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ReceiptRuleSetMetadata -> f ReceiptRuleSetMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReceiptRuleSetMetadata
-> f ReceiptRuleSetMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromXML ReceiptRuleSetMetadata where
  parseXML :: [Node] -> Either String ReceiptRuleSetMetadata
parseXML [Node]
x =
    Maybe Text -> Maybe ISO8601 -> ReceiptRuleSetMetadata
ReceiptRuleSetMetadata'
      (Maybe Text -> Maybe ISO8601 -> ReceiptRuleSetMetadata)
-> Either String (Maybe Text)
-> Either String (Maybe ISO8601 -> ReceiptRuleSetMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Name")
      Either String (Maybe ISO8601 -> ReceiptRuleSetMetadata)
-> Either String (Maybe ISO8601)
-> Either String ReceiptRuleSetMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreatedTimestamp")

instance Prelude.Hashable ReceiptRuleSetMetadata

instance Prelude.NFData ReceiptRuleSetMetadata