{-# 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.ConfigurationSet
-- 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.ConfigurationSet where

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

-- | The name of the configuration set.
--
-- Configuration sets let you create groups of rules that you can apply to
-- the emails you send using Amazon SES. For more information about using
-- configuration sets, see
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-configuration-sets.html Using Amazon SES Configuration Sets>
-- in the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/ Amazon SES Developer Guide>.
--
-- /See:/ 'newConfigurationSet' smart constructor.
data ConfigurationSet = ConfigurationSet'
  { -- | The name of the configuration set. The name must meet the following
    -- requirements:
    --
    -- -   Contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or
    --     dashes (-).
    --
    -- -   Contain 64 characters or fewer.
    ConfigurationSet -> Text
name :: Prelude.Text
  }
  deriving (ConfigurationSet -> ConfigurationSet -> Bool
(ConfigurationSet -> ConfigurationSet -> Bool)
-> (ConfigurationSet -> ConfigurationSet -> Bool)
-> Eq ConfigurationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationSet -> ConfigurationSet -> Bool
$c/= :: ConfigurationSet -> ConfigurationSet -> Bool
== :: ConfigurationSet -> ConfigurationSet -> Bool
$c== :: ConfigurationSet -> ConfigurationSet -> Bool
Prelude.Eq, ReadPrec [ConfigurationSet]
ReadPrec ConfigurationSet
Int -> ReadS ConfigurationSet
ReadS [ConfigurationSet]
(Int -> ReadS ConfigurationSet)
-> ReadS [ConfigurationSet]
-> ReadPrec ConfigurationSet
-> ReadPrec [ConfigurationSet]
-> Read ConfigurationSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationSet]
$creadListPrec :: ReadPrec [ConfigurationSet]
readPrec :: ReadPrec ConfigurationSet
$creadPrec :: ReadPrec ConfigurationSet
readList :: ReadS [ConfigurationSet]
$creadList :: ReadS [ConfigurationSet]
readsPrec :: Int -> ReadS ConfigurationSet
$creadsPrec :: Int -> ReadS ConfigurationSet
Prelude.Read, Int -> ConfigurationSet -> ShowS
[ConfigurationSet] -> ShowS
ConfigurationSet -> String
(Int -> ConfigurationSet -> ShowS)
-> (ConfigurationSet -> String)
-> ([ConfigurationSet] -> ShowS)
-> Show ConfigurationSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationSet] -> ShowS
$cshowList :: [ConfigurationSet] -> ShowS
show :: ConfigurationSet -> String
$cshow :: ConfigurationSet -> String
showsPrec :: Int -> ConfigurationSet -> ShowS
$cshowsPrec :: Int -> ConfigurationSet -> ShowS
Prelude.Show, (forall x. ConfigurationSet -> Rep ConfigurationSet x)
-> (forall x. Rep ConfigurationSet x -> ConfigurationSet)
-> Generic ConfigurationSet
forall x. Rep ConfigurationSet x -> ConfigurationSet
forall x. ConfigurationSet -> Rep ConfigurationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationSet x -> ConfigurationSet
$cfrom :: forall x. ConfigurationSet -> Rep ConfigurationSet x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationSet' 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', 'configurationSet_name' - The name of the configuration set. The name must meet the following
-- requirements:
--
-- -   Contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or
--     dashes (-).
--
-- -   Contain 64 characters or fewer.
newConfigurationSet ::
  -- | 'name'
  Prelude.Text ->
  ConfigurationSet
newConfigurationSet :: Text -> ConfigurationSet
newConfigurationSet Text
pName_ =
  ConfigurationSet' :: Text -> ConfigurationSet
ConfigurationSet' {$sel:name:ConfigurationSet' :: Text
name = Text
pName_}

-- | The name of the configuration set. The name must meet the following
-- requirements:
--
-- -   Contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or
--     dashes (-).
--
-- -   Contain 64 characters or fewer.
configurationSet_name :: Lens.Lens' ConfigurationSet Prelude.Text
configurationSet_name :: (Text -> f Text) -> ConfigurationSet -> f ConfigurationSet
configurationSet_name = (ConfigurationSet -> Text)
-> (ConfigurationSet -> Text -> ConfigurationSet)
-> Lens ConfigurationSet ConfigurationSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSet' {Text
name :: Text
$sel:name:ConfigurationSet' :: ConfigurationSet -> Text
name} -> Text
name) (\s :: ConfigurationSet
s@ConfigurationSet' {} Text
a -> ConfigurationSet
s {$sel:name:ConfigurationSet' :: Text
name = Text
a} :: ConfigurationSet)

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

instance Prelude.Hashable ConfigurationSet

instance Prelude.NFData ConfigurationSet

instance Core.ToQuery ConfigurationSet where
  toQuery :: ConfigurationSet -> QueryString
toQuery ConfigurationSet' {Text
name :: Text
$sel:name:ConfigurationSet' :: ConfigurationSet -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name]