{-# 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.PutAccountDedicatedIpWarmupAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enable or disable the automatic warm-up feature for dedicated IP
-- addresses.
module Amazonka.PinpointEmail.PutAccountDedicatedIpWarmupAttributes
  ( -- * Creating a Request
    PutAccountDedicatedIpWarmupAttributes (..),
    newPutAccountDedicatedIpWarmupAttributes,

    -- * Request Lenses
    putAccountDedicatedIpWarmupAttributes_autoWarmupEnabled,

    -- * Destructuring the Response
    PutAccountDedicatedIpWarmupAttributesResponse (..),
    newPutAccountDedicatedIpWarmupAttributesResponse,

    -- * Response Lenses
    putAccountDedicatedIpWarmupAttributesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 the automatic IP address warm-up feature.
--
-- /See:/ 'newPutAccountDedicatedIpWarmupAttributes' smart constructor.
data PutAccountDedicatedIpWarmupAttributes = PutAccountDedicatedIpWarmupAttributes'
  { -- | Enables or disables the automatic warm-up feature for dedicated IP
    -- addresses that are associated with your Amazon Pinpoint account in the
    -- current AWS Region. Set to @true@ to enable the automatic warm-up
    -- feature, or set to @false@ to disable it.
    PutAccountDedicatedIpWarmupAttributes -> Maybe Bool
autoWarmupEnabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (PutAccountDedicatedIpWarmupAttributes
-> PutAccountDedicatedIpWarmupAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAccountDedicatedIpWarmupAttributes
-> PutAccountDedicatedIpWarmupAttributes -> Bool
$c/= :: PutAccountDedicatedIpWarmupAttributes
-> PutAccountDedicatedIpWarmupAttributes -> Bool
== :: PutAccountDedicatedIpWarmupAttributes
-> PutAccountDedicatedIpWarmupAttributes -> Bool
$c== :: PutAccountDedicatedIpWarmupAttributes
-> PutAccountDedicatedIpWarmupAttributes -> Bool
Prelude.Eq, ReadPrec [PutAccountDedicatedIpWarmupAttributes]
ReadPrec PutAccountDedicatedIpWarmupAttributes
Int -> ReadS PutAccountDedicatedIpWarmupAttributes
ReadS [PutAccountDedicatedIpWarmupAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAccountDedicatedIpWarmupAttributes]
$creadListPrec :: ReadPrec [PutAccountDedicatedIpWarmupAttributes]
readPrec :: ReadPrec PutAccountDedicatedIpWarmupAttributes
$creadPrec :: ReadPrec PutAccountDedicatedIpWarmupAttributes
readList :: ReadS [PutAccountDedicatedIpWarmupAttributes]
$creadList :: ReadS [PutAccountDedicatedIpWarmupAttributes]
readsPrec :: Int -> ReadS PutAccountDedicatedIpWarmupAttributes
$creadsPrec :: Int -> ReadS PutAccountDedicatedIpWarmupAttributes
Prelude.Read, Int -> PutAccountDedicatedIpWarmupAttributes -> ShowS
[PutAccountDedicatedIpWarmupAttributes] -> ShowS
PutAccountDedicatedIpWarmupAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAccountDedicatedIpWarmupAttributes] -> ShowS
$cshowList :: [PutAccountDedicatedIpWarmupAttributes] -> ShowS
show :: PutAccountDedicatedIpWarmupAttributes -> String
$cshow :: PutAccountDedicatedIpWarmupAttributes -> String
showsPrec :: Int -> PutAccountDedicatedIpWarmupAttributes -> ShowS
$cshowsPrec :: Int -> PutAccountDedicatedIpWarmupAttributes -> ShowS
Prelude.Show, forall x.
Rep PutAccountDedicatedIpWarmupAttributes x
-> PutAccountDedicatedIpWarmupAttributes
forall x.
PutAccountDedicatedIpWarmupAttributes
-> Rep PutAccountDedicatedIpWarmupAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAccountDedicatedIpWarmupAttributes x
-> PutAccountDedicatedIpWarmupAttributes
$cfrom :: forall x.
PutAccountDedicatedIpWarmupAttributes
-> Rep PutAccountDedicatedIpWarmupAttributes x
Prelude.Generic)

-- |
-- Create a value of 'PutAccountDedicatedIpWarmupAttributes' 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:
--
-- 'autoWarmupEnabled', 'putAccountDedicatedIpWarmupAttributes_autoWarmupEnabled' - Enables or disables the automatic warm-up feature for dedicated IP
-- addresses that are associated with your Amazon Pinpoint account in the
-- current AWS Region. Set to @true@ to enable the automatic warm-up
-- feature, or set to @false@ to disable it.
newPutAccountDedicatedIpWarmupAttributes ::
  PutAccountDedicatedIpWarmupAttributes
newPutAccountDedicatedIpWarmupAttributes :: PutAccountDedicatedIpWarmupAttributes
newPutAccountDedicatedIpWarmupAttributes =
  PutAccountDedicatedIpWarmupAttributes'
    { $sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: Maybe Bool
autoWarmupEnabled =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Enables or disables the automatic warm-up feature for dedicated IP
-- addresses that are associated with your Amazon Pinpoint account in the
-- current AWS Region. Set to @true@ to enable the automatic warm-up
-- feature, or set to @false@ to disable it.
putAccountDedicatedIpWarmupAttributes_autoWarmupEnabled :: Lens.Lens' PutAccountDedicatedIpWarmupAttributes (Prelude.Maybe Prelude.Bool)
putAccountDedicatedIpWarmupAttributes_autoWarmupEnabled :: Lens' PutAccountDedicatedIpWarmupAttributes (Maybe Bool)
putAccountDedicatedIpWarmupAttributes_autoWarmupEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAccountDedicatedIpWarmupAttributes' {Maybe Bool
autoWarmupEnabled :: Maybe Bool
$sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: PutAccountDedicatedIpWarmupAttributes -> Maybe Bool
autoWarmupEnabled} -> Maybe Bool
autoWarmupEnabled) (\s :: PutAccountDedicatedIpWarmupAttributes
s@PutAccountDedicatedIpWarmupAttributes' {} Maybe Bool
a -> PutAccountDedicatedIpWarmupAttributes
s {$sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: Maybe Bool
autoWarmupEnabled = Maybe Bool
a} :: PutAccountDedicatedIpWarmupAttributes)

instance
  Core.AWSRequest
    PutAccountDedicatedIpWarmupAttributes
  where
  type
    AWSResponse
      PutAccountDedicatedIpWarmupAttributes =
      PutAccountDedicatedIpWarmupAttributesResponse
  request :: (Service -> Service)
-> PutAccountDedicatedIpWarmupAttributes
-> Request PutAccountDedicatedIpWarmupAttributes
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutAccountDedicatedIpWarmupAttributes
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutAccountDedicatedIpWarmupAttributes)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutAccountDedicatedIpWarmupAttributesResponse
PutAccountDedicatedIpWarmupAttributesResponse'
            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
    PutAccountDedicatedIpWarmupAttributes
  where
  hashWithSalt :: Int -> PutAccountDedicatedIpWarmupAttributes -> Int
hashWithSalt
    Int
_salt
    PutAccountDedicatedIpWarmupAttributes' {Maybe Bool
autoWarmupEnabled :: Maybe Bool
$sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: PutAccountDedicatedIpWarmupAttributes -> Maybe Bool
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
autoWarmupEnabled

instance
  Prelude.NFData
    PutAccountDedicatedIpWarmupAttributes
  where
  rnf :: PutAccountDedicatedIpWarmupAttributes -> ()
rnf PutAccountDedicatedIpWarmupAttributes' {Maybe Bool
autoWarmupEnabled :: Maybe Bool
$sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: PutAccountDedicatedIpWarmupAttributes -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
autoWarmupEnabled

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

instance
  Data.ToJSON
    PutAccountDedicatedIpWarmupAttributes
  where
  toJSON :: PutAccountDedicatedIpWarmupAttributes -> Value
toJSON PutAccountDedicatedIpWarmupAttributes' {Maybe Bool
autoWarmupEnabled :: Maybe Bool
$sel:autoWarmupEnabled:PutAccountDedicatedIpWarmupAttributes' :: PutAccountDedicatedIpWarmupAttributes -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AutoWarmupEnabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoWarmupEnabled
          ]
      )

instance
  Data.ToPath
    PutAccountDedicatedIpWarmupAttributes
  where
  toPath :: PutAccountDedicatedIpWarmupAttributes -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/v1/email/account/dedicated-ips/warmup"

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

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

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

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

instance
  Prelude.NFData
    PutAccountDedicatedIpWarmupAttributesResponse
  where
  rnf :: PutAccountDedicatedIpWarmupAttributesResponse -> ()
rnf
    PutAccountDedicatedIpWarmupAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAccountDedicatedIpWarmupAttributesResponse' :: PutAccountDedicatedIpWarmupAttributesResponse -> Int
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus