{-# 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.SES.CreateConfigurationSetTrackingOptions
-- 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)
--
-- Creates an association between a configuration set and a custom domain
-- for open and click event tracking.
--
-- By default, images and links used for tracking open and click events are
-- hosted on domains operated by Amazon SES. You can configure a subdomain
-- of your own to handle these events. For information about using custom
-- domains, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/configure-custom-open-click-domains.html Amazon SES Developer Guide>.
module Amazonka.SES.CreateConfigurationSetTrackingOptions
  ( -- * Creating a Request
    CreateConfigurationSetTrackingOptions (..),
    newCreateConfigurationSetTrackingOptions,

    -- * Request Lenses
    createConfigurationSetTrackingOptions_configurationSetName,
    createConfigurationSetTrackingOptions_trackingOptions,

    -- * Destructuring the Response
    CreateConfigurationSetTrackingOptionsResponse (..),
    newCreateConfigurationSetTrackingOptionsResponse,

    -- * Response Lenses
    createConfigurationSetTrackingOptionsResponse_httpStatus,
  )
where

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

-- | Represents a request to create an open and click tracking option object
-- in a configuration set.
--
-- /See:/ 'newCreateConfigurationSetTrackingOptions' smart constructor.
data CreateConfigurationSetTrackingOptions = CreateConfigurationSetTrackingOptions'
  { -- | The name of the configuration set that the tracking options should be
    -- associated with.
    CreateConfigurationSetTrackingOptions -> Text
configurationSetName :: Prelude.Text,
    CreateConfigurationSetTrackingOptions -> TrackingOptions
trackingOptions :: TrackingOptions
  }
  deriving (CreateConfigurationSetTrackingOptions
-> CreateConfigurationSetTrackingOptions -> Bool
(CreateConfigurationSetTrackingOptions
 -> CreateConfigurationSetTrackingOptions -> Bool)
-> (CreateConfigurationSetTrackingOptions
    -> CreateConfigurationSetTrackingOptions -> Bool)
-> Eq CreateConfigurationSetTrackingOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfigurationSetTrackingOptions
-> CreateConfigurationSetTrackingOptions -> Bool
$c/= :: CreateConfigurationSetTrackingOptions
-> CreateConfigurationSetTrackingOptions -> Bool
== :: CreateConfigurationSetTrackingOptions
-> CreateConfigurationSetTrackingOptions -> Bool
$c== :: CreateConfigurationSetTrackingOptions
-> CreateConfigurationSetTrackingOptions -> Bool
Prelude.Eq, ReadPrec [CreateConfigurationSetTrackingOptions]
ReadPrec CreateConfigurationSetTrackingOptions
Int -> ReadS CreateConfigurationSetTrackingOptions
ReadS [CreateConfigurationSetTrackingOptions]
(Int -> ReadS CreateConfigurationSetTrackingOptions)
-> ReadS [CreateConfigurationSetTrackingOptions]
-> ReadPrec CreateConfigurationSetTrackingOptions
-> ReadPrec [CreateConfigurationSetTrackingOptions]
-> Read CreateConfigurationSetTrackingOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConfigurationSetTrackingOptions]
$creadListPrec :: ReadPrec [CreateConfigurationSetTrackingOptions]
readPrec :: ReadPrec CreateConfigurationSetTrackingOptions
$creadPrec :: ReadPrec CreateConfigurationSetTrackingOptions
readList :: ReadS [CreateConfigurationSetTrackingOptions]
$creadList :: ReadS [CreateConfigurationSetTrackingOptions]
readsPrec :: Int -> ReadS CreateConfigurationSetTrackingOptions
$creadsPrec :: Int -> ReadS CreateConfigurationSetTrackingOptions
Prelude.Read, Int -> CreateConfigurationSetTrackingOptions -> ShowS
[CreateConfigurationSetTrackingOptions] -> ShowS
CreateConfigurationSetTrackingOptions -> String
(Int -> CreateConfigurationSetTrackingOptions -> ShowS)
-> (CreateConfigurationSetTrackingOptions -> String)
-> ([CreateConfigurationSetTrackingOptions] -> ShowS)
-> Show CreateConfigurationSetTrackingOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConfigurationSetTrackingOptions] -> ShowS
$cshowList :: [CreateConfigurationSetTrackingOptions] -> ShowS
show :: CreateConfigurationSetTrackingOptions -> String
$cshow :: CreateConfigurationSetTrackingOptions -> String
showsPrec :: Int -> CreateConfigurationSetTrackingOptions -> ShowS
$cshowsPrec :: Int -> CreateConfigurationSetTrackingOptions -> ShowS
Prelude.Show, (forall x.
 CreateConfigurationSetTrackingOptions
 -> Rep CreateConfigurationSetTrackingOptions x)
-> (forall x.
    Rep CreateConfigurationSetTrackingOptions x
    -> CreateConfigurationSetTrackingOptions)
-> Generic CreateConfigurationSetTrackingOptions
forall x.
Rep CreateConfigurationSetTrackingOptions x
-> CreateConfigurationSetTrackingOptions
forall x.
CreateConfigurationSetTrackingOptions
-> Rep CreateConfigurationSetTrackingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConfigurationSetTrackingOptions x
-> CreateConfigurationSetTrackingOptions
$cfrom :: forall x.
CreateConfigurationSetTrackingOptions
-> Rep CreateConfigurationSetTrackingOptions x
Prelude.Generic)

-- |
-- Create a value of 'CreateConfigurationSetTrackingOptions' 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:
--
-- 'configurationSetName', 'createConfigurationSetTrackingOptions_configurationSetName' - The name of the configuration set that the tracking options should be
-- associated with.
--
-- 'trackingOptions', 'createConfigurationSetTrackingOptions_trackingOptions' - Undocumented member.
newCreateConfigurationSetTrackingOptions ::
  -- | 'configurationSetName'
  Prelude.Text ->
  -- | 'trackingOptions'
  TrackingOptions ->
  CreateConfigurationSetTrackingOptions
newCreateConfigurationSetTrackingOptions :: Text -> TrackingOptions -> CreateConfigurationSetTrackingOptions
newCreateConfigurationSetTrackingOptions
  Text
pConfigurationSetName_
  TrackingOptions
pTrackingOptions_ =
    CreateConfigurationSetTrackingOptions' :: Text -> TrackingOptions -> CreateConfigurationSetTrackingOptions
CreateConfigurationSetTrackingOptions'
      { $sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: Text
configurationSetName =
          Text
pConfigurationSetName_,
        $sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: TrackingOptions
trackingOptions = TrackingOptions
pTrackingOptions_
      }

-- | The name of the configuration set that the tracking options should be
-- associated with.
createConfigurationSetTrackingOptions_configurationSetName :: Lens.Lens' CreateConfigurationSetTrackingOptions Prelude.Text
createConfigurationSetTrackingOptions_configurationSetName :: (Text -> f Text)
-> CreateConfigurationSetTrackingOptions
-> f CreateConfigurationSetTrackingOptions
createConfigurationSetTrackingOptions_configurationSetName = (CreateConfigurationSetTrackingOptions -> Text)
-> (CreateConfigurationSetTrackingOptions
    -> Text -> CreateConfigurationSetTrackingOptions)
-> Lens
     CreateConfigurationSetTrackingOptions
     CreateConfigurationSetTrackingOptions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationSetTrackingOptions' {Text
configurationSetName :: Text
$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> Text
configurationSetName} -> Text
configurationSetName) (\s :: CreateConfigurationSetTrackingOptions
s@CreateConfigurationSetTrackingOptions' {} Text
a -> CreateConfigurationSetTrackingOptions
s {$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: Text
configurationSetName = Text
a} :: CreateConfigurationSetTrackingOptions)

-- | Undocumented member.
createConfigurationSetTrackingOptions_trackingOptions :: Lens.Lens' CreateConfigurationSetTrackingOptions TrackingOptions
createConfigurationSetTrackingOptions_trackingOptions :: (TrackingOptions -> f TrackingOptions)
-> CreateConfigurationSetTrackingOptions
-> f CreateConfigurationSetTrackingOptions
createConfigurationSetTrackingOptions_trackingOptions = (CreateConfigurationSetTrackingOptions -> TrackingOptions)
-> (CreateConfigurationSetTrackingOptions
    -> TrackingOptions -> CreateConfigurationSetTrackingOptions)
-> Lens
     CreateConfigurationSetTrackingOptions
     CreateConfigurationSetTrackingOptions
     TrackingOptions
     TrackingOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationSetTrackingOptions' {TrackingOptions
trackingOptions :: TrackingOptions
$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> TrackingOptions
trackingOptions} -> TrackingOptions
trackingOptions) (\s :: CreateConfigurationSetTrackingOptions
s@CreateConfigurationSetTrackingOptions' {} TrackingOptions
a -> CreateConfigurationSetTrackingOptions
s {$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: TrackingOptions
trackingOptions = TrackingOptions
a} :: CreateConfigurationSetTrackingOptions)

instance
  Core.AWSRequest
    CreateConfigurationSetTrackingOptions
  where
  type
    AWSResponse
      CreateConfigurationSetTrackingOptions =
      CreateConfigurationSetTrackingOptionsResponse
  request :: CreateConfigurationSetTrackingOptions
-> Request CreateConfigurationSetTrackingOptions
request = Service
-> CreateConfigurationSetTrackingOptions
-> Request CreateConfigurationSetTrackingOptions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateConfigurationSetTrackingOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateConfigurationSetTrackingOptions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either
         String (AWSResponse CreateConfigurationSetTrackingOptions))
-> Logger
-> Service
-> Proxy CreateConfigurationSetTrackingOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateConfigurationSetTrackingOptions)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateConfigurationSetTrackingOptionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> CreateConfigurationSetTrackingOptionsResponse
CreateConfigurationSetTrackingOptionsResponse'
            (Int -> CreateConfigurationSetTrackingOptionsResponse)
-> Either String Int
-> Either String CreateConfigurationSetTrackingOptionsResponse
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
    CreateConfigurationSetTrackingOptions

instance
  Prelude.NFData
    CreateConfigurationSetTrackingOptions

instance
  Core.ToHeaders
    CreateConfigurationSetTrackingOptions
  where
  toHeaders :: CreateConfigurationSetTrackingOptions -> ResponseHeaders
toHeaders = ResponseHeaders
-> CreateConfigurationSetTrackingOptions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToPath
    CreateConfigurationSetTrackingOptions
  where
  toPath :: CreateConfigurationSetTrackingOptions -> ByteString
toPath = ByteString -> CreateConfigurationSetTrackingOptions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    CreateConfigurationSetTrackingOptions
  where
  toQuery :: CreateConfigurationSetTrackingOptions -> QueryString
toQuery CreateConfigurationSetTrackingOptions' {Text
TrackingOptions
trackingOptions :: TrackingOptions
configurationSetName :: Text
$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> TrackingOptions
$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"CreateConfigurationSetTrackingOptions" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"ConfigurationSetName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
configurationSetName,
        ByteString
"TrackingOptions" ByteString -> TrackingOptions -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: TrackingOptions
trackingOptions
      ]

-- | An empty element returned on a successful request.
--
-- /See:/ 'newCreateConfigurationSetTrackingOptionsResponse' smart constructor.
data CreateConfigurationSetTrackingOptionsResponse = CreateConfigurationSetTrackingOptionsResponse'
  { -- | The response's http status code.
    CreateConfigurationSetTrackingOptionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateConfigurationSetTrackingOptionsResponse
-> CreateConfigurationSetTrackingOptionsResponse -> Bool
(CreateConfigurationSetTrackingOptionsResponse
 -> CreateConfigurationSetTrackingOptionsResponse -> Bool)
-> (CreateConfigurationSetTrackingOptionsResponse
    -> CreateConfigurationSetTrackingOptionsResponse -> Bool)
-> Eq CreateConfigurationSetTrackingOptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfigurationSetTrackingOptionsResponse
-> CreateConfigurationSetTrackingOptionsResponse -> Bool
$c/= :: CreateConfigurationSetTrackingOptionsResponse
-> CreateConfigurationSetTrackingOptionsResponse -> Bool
== :: CreateConfigurationSetTrackingOptionsResponse
-> CreateConfigurationSetTrackingOptionsResponse -> Bool
$c== :: CreateConfigurationSetTrackingOptionsResponse
-> CreateConfigurationSetTrackingOptionsResponse -> Bool
Prelude.Eq, ReadPrec [CreateConfigurationSetTrackingOptionsResponse]
ReadPrec CreateConfigurationSetTrackingOptionsResponse
Int -> ReadS CreateConfigurationSetTrackingOptionsResponse
ReadS [CreateConfigurationSetTrackingOptionsResponse]
(Int -> ReadS CreateConfigurationSetTrackingOptionsResponse)
-> ReadS [CreateConfigurationSetTrackingOptionsResponse]
-> ReadPrec CreateConfigurationSetTrackingOptionsResponse
-> ReadPrec [CreateConfigurationSetTrackingOptionsResponse]
-> Read CreateConfigurationSetTrackingOptionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConfigurationSetTrackingOptionsResponse]
$creadListPrec :: ReadPrec [CreateConfigurationSetTrackingOptionsResponse]
readPrec :: ReadPrec CreateConfigurationSetTrackingOptionsResponse
$creadPrec :: ReadPrec CreateConfigurationSetTrackingOptionsResponse
readList :: ReadS [CreateConfigurationSetTrackingOptionsResponse]
$creadList :: ReadS [CreateConfigurationSetTrackingOptionsResponse]
readsPrec :: Int -> ReadS CreateConfigurationSetTrackingOptionsResponse
$creadsPrec :: Int -> ReadS CreateConfigurationSetTrackingOptionsResponse
Prelude.Read, Int -> CreateConfigurationSetTrackingOptionsResponse -> ShowS
[CreateConfigurationSetTrackingOptionsResponse] -> ShowS
CreateConfigurationSetTrackingOptionsResponse -> String
(Int -> CreateConfigurationSetTrackingOptionsResponse -> ShowS)
-> (CreateConfigurationSetTrackingOptionsResponse -> String)
-> ([CreateConfigurationSetTrackingOptionsResponse] -> ShowS)
-> Show CreateConfigurationSetTrackingOptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConfigurationSetTrackingOptionsResponse] -> ShowS
$cshowList :: [CreateConfigurationSetTrackingOptionsResponse] -> ShowS
show :: CreateConfigurationSetTrackingOptionsResponse -> String
$cshow :: CreateConfigurationSetTrackingOptionsResponse -> String
showsPrec :: Int -> CreateConfigurationSetTrackingOptionsResponse -> ShowS
$cshowsPrec :: Int -> CreateConfigurationSetTrackingOptionsResponse -> ShowS
Prelude.Show, (forall x.
 CreateConfigurationSetTrackingOptionsResponse
 -> Rep CreateConfigurationSetTrackingOptionsResponse x)
-> (forall x.
    Rep CreateConfigurationSetTrackingOptionsResponse x
    -> CreateConfigurationSetTrackingOptionsResponse)
-> Generic CreateConfigurationSetTrackingOptionsResponse
forall x.
Rep CreateConfigurationSetTrackingOptionsResponse x
-> CreateConfigurationSetTrackingOptionsResponse
forall x.
CreateConfigurationSetTrackingOptionsResponse
-> Rep CreateConfigurationSetTrackingOptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConfigurationSetTrackingOptionsResponse x
-> CreateConfigurationSetTrackingOptionsResponse
$cfrom :: forall x.
CreateConfigurationSetTrackingOptionsResponse
-> Rep CreateConfigurationSetTrackingOptionsResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    CreateConfigurationSetTrackingOptionsResponse