{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $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 :: Lens' CreateConfigurationSetTrackingOptions Text
createConfigurationSetTrackingOptions_configurationSetName = 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 :: Lens' CreateConfigurationSetTrackingOptions TrackingOptions
createConfigurationSetTrackingOptions_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 :: (Service -> Service)
-> CreateConfigurationSetTrackingOptions
-> Request CreateConfigurationSetTrackingOptions
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateConfigurationSetTrackingOptions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateConfigurationSetTrackingOptions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateConfigurationSetTrackingOptionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> CreateConfigurationSetTrackingOptionsResponse
CreateConfigurationSetTrackingOptionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateConfigurationSetTrackingOptions
  where
  hashWithSalt :: Int -> CreateConfigurationSetTrackingOptions -> Int
hashWithSalt
    Int
_salt
    CreateConfigurationSetTrackingOptions' {Text
TrackingOptions
trackingOptions :: TrackingOptions
configurationSetName :: Text
$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> TrackingOptions
$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrackingOptions
trackingOptions

instance
  Prelude.NFData
    CreateConfigurationSetTrackingOptions
  where
  rnf :: CreateConfigurationSetTrackingOptions -> ()
rnf CreateConfigurationSetTrackingOptions' {Text
TrackingOptions
trackingOptions :: TrackingOptions
configurationSetName :: Text
$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> TrackingOptions
$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrackingOptions
trackingOptions

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

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

instance
  Data.ToQuery
    CreateConfigurationSetTrackingOptions
  where
  toQuery :: CreateConfigurationSetTrackingOptions -> QueryString
toQuery CreateConfigurationSetTrackingOptions' {Text
TrackingOptions
trackingOptions :: TrackingOptions
configurationSetName :: Text
$sel:trackingOptions:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> TrackingOptions
$sel:configurationSetName:CreateConfigurationSetTrackingOptions' :: CreateConfigurationSetTrackingOptions -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"CreateConfigurationSetTrackingOptions" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"ConfigurationSetName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
configurationSetName,
        ByteString
"TrackingOptions" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: 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
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]
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
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.
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'
      { $sel:httpStatus:CreateConfigurationSetTrackingOptionsResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
createConfigurationSetTrackingOptionsResponse_httpStatus :: Lens.Lens' CreateConfigurationSetTrackingOptionsResponse Prelude.Int
createConfigurationSetTrackingOptionsResponse_httpStatus :: Lens' CreateConfigurationSetTrackingOptionsResponse Int
createConfigurationSetTrackingOptionsResponse_httpStatus = 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
  where
  rnf :: CreateConfigurationSetTrackingOptionsResponse -> ()
rnf
    CreateConfigurationSetTrackingOptionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateConfigurationSetTrackingOptionsResponse' :: CreateConfigurationSetTrackingOptionsResponse -> Int
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus