{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.PinpointEmail.PutConfigurationSetReputationOptions
-- 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)
--
-- Enable or disable collection of reputation metrics for emails that you
-- send using a particular configuration set in a specific AWS Region.
module Amazonka.PinpointEmail.PutConfigurationSetReputationOptions
  ( -- * Creating a Request
    PutConfigurationSetReputationOptions (..),
    newPutConfigurationSetReputationOptions,

    -- * Request Lenses
    putConfigurationSetReputationOptions_reputationMetricsEnabled,
    putConfigurationSetReputationOptions_configurationSetName,

    -- * Destructuring the Response
    PutConfigurationSetReputationOptionsResponse (..),
    newPutConfigurationSetReputationOptionsResponse,

    -- * Response Lenses
    putConfigurationSetReputationOptionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PinpointEmail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | A request to enable or disable tracking of reputation metrics for a
-- configuration set.
--
-- /See:/ 'newPutConfigurationSetReputationOptions' smart constructor.
data PutConfigurationSetReputationOptions = PutConfigurationSetReputationOptions'
  { -- | If @true@, tracking of reputation metrics is enabled for the
    -- configuration set. If @false@, tracking of reputation metrics is
    -- disabled for the configuration set.
    PutConfigurationSetReputationOptions -> Maybe Bool
reputationMetricsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the configuration set that you want to enable or disable
    -- reputation metric tracking for.
    PutConfigurationSetReputationOptions -> Text
configurationSetName :: Prelude.Text
  }
  deriving (PutConfigurationSetReputationOptions
-> PutConfigurationSetReputationOptions -> Bool
(PutConfigurationSetReputationOptions
 -> PutConfigurationSetReputationOptions -> Bool)
-> (PutConfigurationSetReputationOptions
    -> PutConfigurationSetReputationOptions -> Bool)
-> Eq PutConfigurationSetReputationOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationSetReputationOptions
-> PutConfigurationSetReputationOptions -> Bool
$c/= :: PutConfigurationSetReputationOptions
-> PutConfigurationSetReputationOptions -> Bool
== :: PutConfigurationSetReputationOptions
-> PutConfigurationSetReputationOptions -> Bool
$c== :: PutConfigurationSetReputationOptions
-> PutConfigurationSetReputationOptions -> Bool
Prelude.Eq, ReadPrec [PutConfigurationSetReputationOptions]
ReadPrec PutConfigurationSetReputationOptions
Int -> ReadS PutConfigurationSetReputationOptions
ReadS [PutConfigurationSetReputationOptions]
(Int -> ReadS PutConfigurationSetReputationOptions)
-> ReadS [PutConfigurationSetReputationOptions]
-> ReadPrec PutConfigurationSetReputationOptions
-> ReadPrec [PutConfigurationSetReputationOptions]
-> Read PutConfigurationSetReputationOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationSetReputationOptions]
$creadListPrec :: ReadPrec [PutConfigurationSetReputationOptions]
readPrec :: ReadPrec PutConfigurationSetReputationOptions
$creadPrec :: ReadPrec PutConfigurationSetReputationOptions
readList :: ReadS [PutConfigurationSetReputationOptions]
$creadList :: ReadS [PutConfigurationSetReputationOptions]
readsPrec :: Int -> ReadS PutConfigurationSetReputationOptions
$creadsPrec :: Int -> ReadS PutConfigurationSetReputationOptions
Prelude.Read, Int -> PutConfigurationSetReputationOptions -> ShowS
[PutConfigurationSetReputationOptions] -> ShowS
PutConfigurationSetReputationOptions -> String
(Int -> PutConfigurationSetReputationOptions -> ShowS)
-> (PutConfigurationSetReputationOptions -> String)
-> ([PutConfigurationSetReputationOptions] -> ShowS)
-> Show PutConfigurationSetReputationOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationSetReputationOptions] -> ShowS
$cshowList :: [PutConfigurationSetReputationOptions] -> ShowS
show :: PutConfigurationSetReputationOptions -> String
$cshow :: PutConfigurationSetReputationOptions -> String
showsPrec :: Int -> PutConfigurationSetReputationOptions -> ShowS
$cshowsPrec :: Int -> PutConfigurationSetReputationOptions -> ShowS
Prelude.Show, (forall x.
 PutConfigurationSetReputationOptions
 -> Rep PutConfigurationSetReputationOptions x)
-> (forall x.
    Rep PutConfigurationSetReputationOptions x
    -> PutConfigurationSetReputationOptions)
-> Generic PutConfigurationSetReputationOptions
forall x.
Rep PutConfigurationSetReputationOptions x
-> PutConfigurationSetReputationOptions
forall x.
PutConfigurationSetReputationOptions
-> Rep PutConfigurationSetReputationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationSetReputationOptions x
-> PutConfigurationSetReputationOptions
$cfrom :: forall x.
PutConfigurationSetReputationOptions
-> Rep PutConfigurationSetReputationOptions x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationSetReputationOptions' 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:
--
-- 'reputationMetricsEnabled', 'putConfigurationSetReputationOptions_reputationMetricsEnabled' - If @true@, tracking of reputation metrics is enabled for the
-- configuration set. If @false@, tracking of reputation metrics is
-- disabled for the configuration set.
--
-- 'configurationSetName', 'putConfigurationSetReputationOptions_configurationSetName' - The name of the configuration set that you want to enable or disable
-- reputation metric tracking for.
newPutConfigurationSetReputationOptions ::
  -- | 'configurationSetName'
  Prelude.Text ->
  PutConfigurationSetReputationOptions
newPutConfigurationSetReputationOptions :: Text -> PutConfigurationSetReputationOptions
newPutConfigurationSetReputationOptions
  Text
pConfigurationSetName_ =
    PutConfigurationSetReputationOptions' :: Maybe Bool -> Text -> PutConfigurationSetReputationOptions
PutConfigurationSetReputationOptions'
      { $sel:reputationMetricsEnabled:PutConfigurationSetReputationOptions' :: Maybe Bool
reputationMetricsEnabled =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationSetName:PutConfigurationSetReputationOptions' :: Text
configurationSetName =
          Text
pConfigurationSetName_
      }

-- | If @true@, tracking of reputation metrics is enabled for the
-- configuration set. If @false@, tracking of reputation metrics is
-- disabled for the configuration set.
putConfigurationSetReputationOptions_reputationMetricsEnabled :: Lens.Lens' PutConfigurationSetReputationOptions (Prelude.Maybe Prelude.Bool)
putConfigurationSetReputationOptions_reputationMetricsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> PutConfigurationSetReputationOptions
-> f PutConfigurationSetReputationOptions
putConfigurationSetReputationOptions_reputationMetricsEnabled = (PutConfigurationSetReputationOptions -> Maybe Bool)
-> (PutConfigurationSetReputationOptions
    -> Maybe Bool -> PutConfigurationSetReputationOptions)
-> Lens
     PutConfigurationSetReputationOptions
     PutConfigurationSetReputationOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetReputationOptions' {Maybe Bool
reputationMetricsEnabled :: Maybe Bool
$sel:reputationMetricsEnabled:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Maybe Bool
reputationMetricsEnabled} -> Maybe Bool
reputationMetricsEnabled) (\s :: PutConfigurationSetReputationOptions
s@PutConfigurationSetReputationOptions' {} Maybe Bool
a -> PutConfigurationSetReputationOptions
s {$sel:reputationMetricsEnabled:PutConfigurationSetReputationOptions' :: Maybe Bool
reputationMetricsEnabled = Maybe Bool
a} :: PutConfigurationSetReputationOptions)

-- | The name of the configuration set that you want to enable or disable
-- reputation metric tracking for.
putConfigurationSetReputationOptions_configurationSetName :: Lens.Lens' PutConfigurationSetReputationOptions Prelude.Text
putConfigurationSetReputationOptions_configurationSetName :: (Text -> f Text)
-> PutConfigurationSetReputationOptions
-> f PutConfigurationSetReputationOptions
putConfigurationSetReputationOptions_configurationSetName = (PutConfigurationSetReputationOptions -> Text)
-> (PutConfigurationSetReputationOptions
    -> Text -> PutConfigurationSetReputationOptions)
-> Lens
     PutConfigurationSetReputationOptions
     PutConfigurationSetReputationOptions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetReputationOptions' {Text
configurationSetName :: Text
$sel:configurationSetName:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Text
configurationSetName} -> Text
configurationSetName) (\s :: PutConfigurationSetReputationOptions
s@PutConfigurationSetReputationOptions' {} Text
a -> PutConfigurationSetReputationOptions
s {$sel:configurationSetName:PutConfigurationSetReputationOptions' :: Text
configurationSetName = Text
a} :: PutConfigurationSetReputationOptions)

instance
  Core.AWSRequest
    PutConfigurationSetReputationOptions
  where
  type
    AWSResponse PutConfigurationSetReputationOptions =
      PutConfigurationSetReputationOptionsResponse
  request :: PutConfigurationSetReputationOptions
-> Request PutConfigurationSetReputationOptions
request = Service
-> PutConfigurationSetReputationOptions
-> Request PutConfigurationSetReputationOptions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutConfigurationSetReputationOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutConfigurationSetReputationOptions)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either
      String (AWSResponse PutConfigurationSetReputationOptions))
-> Logger
-> Service
-> Proxy PutConfigurationSetReputationOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutConfigurationSetReputationOptions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutConfigurationSetReputationOptionsResponse
PutConfigurationSetReputationOptionsResponse'
            (Int -> PutConfigurationSetReputationOptionsResponse)
-> Either String Int
-> Either String PutConfigurationSetReputationOptionsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    PutConfigurationSetReputationOptions

instance
  Prelude.NFData
    PutConfigurationSetReputationOptions

instance
  Core.ToHeaders
    PutConfigurationSetReputationOptions
  where
  toHeaders :: PutConfigurationSetReputationOptions -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> PutConfigurationSetReputationOptions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    PutConfigurationSetReputationOptions
  where
  toJSON :: PutConfigurationSetReputationOptions -> Value
toJSON PutConfigurationSetReputationOptions' {Maybe Bool
Text
configurationSetName :: Text
reputationMetricsEnabled :: Maybe Bool
$sel:configurationSetName:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Text
$sel:reputationMetricsEnabled:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReputationMetricsEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
reputationMetricsEnabled
          ]
      )

instance
  Core.ToPath
    PutConfigurationSetReputationOptions
  where
  toPath :: PutConfigurationSetReputationOptions -> ByteString
toPath PutConfigurationSetReputationOptions' {Maybe Bool
Text
configurationSetName :: Text
reputationMetricsEnabled :: Maybe Bool
$sel:configurationSetName:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Text
$sel:reputationMetricsEnabled:PutConfigurationSetReputationOptions' :: PutConfigurationSetReputationOptions -> Maybe Bool
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/email/configuration-sets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
configurationSetName,
        ByteString
"/reputation-options"
      ]

instance
  Core.ToQuery
    PutConfigurationSetReputationOptions
  where
  toQuery :: PutConfigurationSetReputationOptions -> QueryString
toQuery = QueryString -> PutConfigurationSetReputationOptions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | An HTTP 200 response if the request succeeds, or an error message if the
-- request fails.
--
-- /See:/ 'newPutConfigurationSetReputationOptionsResponse' smart constructor.
data PutConfigurationSetReputationOptionsResponse = PutConfigurationSetReputationOptionsResponse'
  { -- | The response's http status code.
    PutConfigurationSetReputationOptionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutConfigurationSetReputationOptionsResponse
-> PutConfigurationSetReputationOptionsResponse -> Bool
(PutConfigurationSetReputationOptionsResponse
 -> PutConfigurationSetReputationOptionsResponse -> Bool)
-> (PutConfigurationSetReputationOptionsResponse
    -> PutConfigurationSetReputationOptionsResponse -> Bool)
-> Eq PutConfigurationSetReputationOptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutConfigurationSetReputationOptionsResponse
-> PutConfigurationSetReputationOptionsResponse -> Bool
$c/= :: PutConfigurationSetReputationOptionsResponse
-> PutConfigurationSetReputationOptionsResponse -> Bool
== :: PutConfigurationSetReputationOptionsResponse
-> PutConfigurationSetReputationOptionsResponse -> Bool
$c== :: PutConfigurationSetReputationOptionsResponse
-> PutConfigurationSetReputationOptionsResponse -> Bool
Prelude.Eq, ReadPrec [PutConfigurationSetReputationOptionsResponse]
ReadPrec PutConfigurationSetReputationOptionsResponse
Int -> ReadS PutConfigurationSetReputationOptionsResponse
ReadS [PutConfigurationSetReputationOptionsResponse]
(Int -> ReadS PutConfigurationSetReputationOptionsResponse)
-> ReadS [PutConfigurationSetReputationOptionsResponse]
-> ReadPrec PutConfigurationSetReputationOptionsResponse
-> ReadPrec [PutConfigurationSetReputationOptionsResponse]
-> Read PutConfigurationSetReputationOptionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutConfigurationSetReputationOptionsResponse]
$creadListPrec :: ReadPrec [PutConfigurationSetReputationOptionsResponse]
readPrec :: ReadPrec PutConfigurationSetReputationOptionsResponse
$creadPrec :: ReadPrec PutConfigurationSetReputationOptionsResponse
readList :: ReadS [PutConfigurationSetReputationOptionsResponse]
$creadList :: ReadS [PutConfigurationSetReputationOptionsResponse]
readsPrec :: Int -> ReadS PutConfigurationSetReputationOptionsResponse
$creadsPrec :: Int -> ReadS PutConfigurationSetReputationOptionsResponse
Prelude.Read, Int -> PutConfigurationSetReputationOptionsResponse -> ShowS
[PutConfigurationSetReputationOptionsResponse] -> ShowS
PutConfigurationSetReputationOptionsResponse -> String
(Int -> PutConfigurationSetReputationOptionsResponse -> ShowS)
-> (PutConfigurationSetReputationOptionsResponse -> String)
-> ([PutConfigurationSetReputationOptionsResponse] -> ShowS)
-> Show PutConfigurationSetReputationOptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutConfigurationSetReputationOptionsResponse] -> ShowS
$cshowList :: [PutConfigurationSetReputationOptionsResponse] -> ShowS
show :: PutConfigurationSetReputationOptionsResponse -> String
$cshow :: PutConfigurationSetReputationOptionsResponse -> String
showsPrec :: Int -> PutConfigurationSetReputationOptionsResponse -> ShowS
$cshowsPrec :: Int -> PutConfigurationSetReputationOptionsResponse -> ShowS
Prelude.Show, (forall x.
 PutConfigurationSetReputationOptionsResponse
 -> Rep PutConfigurationSetReputationOptionsResponse x)
-> (forall x.
    Rep PutConfigurationSetReputationOptionsResponse x
    -> PutConfigurationSetReputationOptionsResponse)
-> Generic PutConfigurationSetReputationOptionsResponse
forall x.
Rep PutConfigurationSetReputationOptionsResponse x
-> PutConfigurationSetReputationOptionsResponse
forall x.
PutConfigurationSetReputationOptionsResponse
-> Rep PutConfigurationSetReputationOptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutConfigurationSetReputationOptionsResponse x
-> PutConfigurationSetReputationOptionsResponse
$cfrom :: forall x.
PutConfigurationSetReputationOptionsResponse
-> Rep PutConfigurationSetReputationOptionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutConfigurationSetReputationOptionsResponse' 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:
--
-- 'httpStatus', 'putConfigurationSetReputationOptionsResponse_httpStatus' - The response's http status code.
newPutConfigurationSetReputationOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutConfigurationSetReputationOptionsResponse
newPutConfigurationSetReputationOptionsResponse :: Int -> PutConfigurationSetReputationOptionsResponse
newPutConfigurationSetReputationOptionsResponse
  Int
pHttpStatus_ =
    PutConfigurationSetReputationOptionsResponse' :: Int -> PutConfigurationSetReputationOptionsResponse
PutConfigurationSetReputationOptionsResponse'
      { $sel:httpStatus:PutConfigurationSetReputationOptionsResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
putConfigurationSetReputationOptionsResponse_httpStatus :: Lens.Lens' PutConfigurationSetReputationOptionsResponse Prelude.Int
putConfigurationSetReputationOptionsResponse_httpStatus :: (Int -> f Int)
-> PutConfigurationSetReputationOptionsResponse
-> f PutConfigurationSetReputationOptionsResponse
putConfigurationSetReputationOptionsResponse_httpStatus = (PutConfigurationSetReputationOptionsResponse -> Int)
-> (PutConfigurationSetReputationOptionsResponse
    -> Int -> PutConfigurationSetReputationOptionsResponse)
-> Lens
     PutConfigurationSetReputationOptionsResponse
     PutConfigurationSetReputationOptionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutConfigurationSetReputationOptionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutConfigurationSetReputationOptionsResponse' :: PutConfigurationSetReputationOptionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutConfigurationSetReputationOptionsResponse
s@PutConfigurationSetReputationOptionsResponse' {} Int
a -> PutConfigurationSetReputationOptionsResponse
s {$sel:httpStatus:PutConfigurationSetReputationOptionsResponse' :: Int
httpStatus = Int
a} :: PutConfigurationSetReputationOptionsResponse)

instance
  Prelude.NFData
    PutConfigurationSetReputationOptionsResponse