{-# 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.PutDedicatedIpWarmupAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.PinpointEmail.PutDedicatedIpWarmupAttributes
  ( -- * Creating a Request
    PutDedicatedIpWarmupAttributes (..),
    newPutDedicatedIpWarmupAttributes,

    -- * Request Lenses
    putDedicatedIpWarmupAttributes_ip,
    putDedicatedIpWarmupAttributes_warmupPercentage,

    -- * Destructuring the Response
    PutDedicatedIpWarmupAttributesResponse (..),
    newPutDedicatedIpWarmupAttributesResponse,

    -- * Response Lenses
    putDedicatedIpWarmupAttributesResponse_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 change the warm-up attributes for a dedicated IP address.
-- This operation is useful when you want to resume the warm-up process for
-- an existing IP address.
--
-- /See:/ 'newPutDedicatedIpWarmupAttributes' smart constructor.
data PutDedicatedIpWarmupAttributes = PutDedicatedIpWarmupAttributes'
  { -- | The dedicated IP address that you want to update the warm-up attributes
    -- for.
    PutDedicatedIpWarmupAttributes -> Text
ip :: Prelude.Text,
    -- | The warm-up percentage that you want to associate with the dedicated IP
    -- address.
    PutDedicatedIpWarmupAttributes -> Int
warmupPercentage :: Prelude.Int
  }
  deriving (PutDedicatedIpWarmupAttributes
-> PutDedicatedIpWarmupAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDedicatedIpWarmupAttributes
-> PutDedicatedIpWarmupAttributes -> Bool
$c/= :: PutDedicatedIpWarmupAttributes
-> PutDedicatedIpWarmupAttributes -> Bool
== :: PutDedicatedIpWarmupAttributes
-> PutDedicatedIpWarmupAttributes -> Bool
$c== :: PutDedicatedIpWarmupAttributes
-> PutDedicatedIpWarmupAttributes -> Bool
Prelude.Eq, ReadPrec [PutDedicatedIpWarmupAttributes]
ReadPrec PutDedicatedIpWarmupAttributes
Int -> ReadS PutDedicatedIpWarmupAttributes
ReadS [PutDedicatedIpWarmupAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDedicatedIpWarmupAttributes]
$creadListPrec :: ReadPrec [PutDedicatedIpWarmupAttributes]
readPrec :: ReadPrec PutDedicatedIpWarmupAttributes
$creadPrec :: ReadPrec PutDedicatedIpWarmupAttributes
readList :: ReadS [PutDedicatedIpWarmupAttributes]
$creadList :: ReadS [PutDedicatedIpWarmupAttributes]
readsPrec :: Int -> ReadS PutDedicatedIpWarmupAttributes
$creadsPrec :: Int -> ReadS PutDedicatedIpWarmupAttributes
Prelude.Read, Int -> PutDedicatedIpWarmupAttributes -> ShowS
[PutDedicatedIpWarmupAttributes] -> ShowS
PutDedicatedIpWarmupAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDedicatedIpWarmupAttributes] -> ShowS
$cshowList :: [PutDedicatedIpWarmupAttributes] -> ShowS
show :: PutDedicatedIpWarmupAttributes -> String
$cshow :: PutDedicatedIpWarmupAttributes -> String
showsPrec :: Int -> PutDedicatedIpWarmupAttributes -> ShowS
$cshowsPrec :: Int -> PutDedicatedIpWarmupAttributes -> ShowS
Prelude.Show, forall x.
Rep PutDedicatedIpWarmupAttributes x
-> PutDedicatedIpWarmupAttributes
forall x.
PutDedicatedIpWarmupAttributes
-> Rep PutDedicatedIpWarmupAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutDedicatedIpWarmupAttributes x
-> PutDedicatedIpWarmupAttributes
$cfrom :: forall x.
PutDedicatedIpWarmupAttributes
-> Rep PutDedicatedIpWarmupAttributes x
Prelude.Generic)

-- |
-- Create a value of 'PutDedicatedIpWarmupAttributes' 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:
--
-- 'ip', 'putDedicatedIpWarmupAttributes_ip' - The dedicated IP address that you want to update the warm-up attributes
-- for.
--
-- 'warmupPercentage', 'putDedicatedIpWarmupAttributes_warmupPercentage' - The warm-up percentage that you want to associate with the dedicated IP
-- address.
newPutDedicatedIpWarmupAttributes ::
  -- | 'ip'
  Prelude.Text ->
  -- | 'warmupPercentage'
  Prelude.Int ->
  PutDedicatedIpWarmupAttributes
newPutDedicatedIpWarmupAttributes :: Text -> Int -> PutDedicatedIpWarmupAttributes
newPutDedicatedIpWarmupAttributes
  Text
pIp_
  Int
pWarmupPercentage_ =
    PutDedicatedIpWarmupAttributes'
      { $sel:ip:PutDedicatedIpWarmupAttributes' :: Text
ip = Text
pIp_,
        $sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: Int
warmupPercentage = Int
pWarmupPercentage_
      }

-- | The dedicated IP address that you want to update the warm-up attributes
-- for.
putDedicatedIpWarmupAttributes_ip :: Lens.Lens' PutDedicatedIpWarmupAttributes Prelude.Text
putDedicatedIpWarmupAttributes_ip :: Lens' PutDedicatedIpWarmupAttributes Text
putDedicatedIpWarmupAttributes_ip = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDedicatedIpWarmupAttributes' {Text
ip :: Text
$sel:ip:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Text
ip} -> Text
ip) (\s :: PutDedicatedIpWarmupAttributes
s@PutDedicatedIpWarmupAttributes' {} Text
a -> PutDedicatedIpWarmupAttributes
s {$sel:ip:PutDedicatedIpWarmupAttributes' :: Text
ip = Text
a} :: PutDedicatedIpWarmupAttributes)

-- | The warm-up percentage that you want to associate with the dedicated IP
-- address.
putDedicatedIpWarmupAttributes_warmupPercentage :: Lens.Lens' PutDedicatedIpWarmupAttributes Prelude.Int
putDedicatedIpWarmupAttributes_warmupPercentage :: Lens' PutDedicatedIpWarmupAttributes Int
putDedicatedIpWarmupAttributes_warmupPercentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDedicatedIpWarmupAttributes' {Int
warmupPercentage :: Int
$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Int
warmupPercentage} -> Int
warmupPercentage) (\s :: PutDedicatedIpWarmupAttributes
s@PutDedicatedIpWarmupAttributes' {} Int
a -> PutDedicatedIpWarmupAttributes
s {$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: Int
warmupPercentage = Int
a} :: PutDedicatedIpWarmupAttributes)

instance
  Core.AWSRequest
    PutDedicatedIpWarmupAttributes
  where
  type
    AWSResponse PutDedicatedIpWarmupAttributes =
      PutDedicatedIpWarmupAttributesResponse
  request :: (Service -> Service)
-> PutDedicatedIpWarmupAttributes
-> Request PutDedicatedIpWarmupAttributes
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 PutDedicatedIpWarmupAttributes
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutDedicatedIpWarmupAttributes)))
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 -> PutDedicatedIpWarmupAttributesResponse
PutDedicatedIpWarmupAttributesResponse'
            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
    PutDedicatedIpWarmupAttributes
  where
  hashWithSalt :: Int -> PutDedicatedIpWarmupAttributes -> Int
hashWithSalt
    Int
_salt
    PutDedicatedIpWarmupAttributes' {Int
Text
warmupPercentage :: Int
ip :: Text
$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Int
$sel:ip:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ip
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
warmupPercentage

instance
  Prelude.NFData
    PutDedicatedIpWarmupAttributes
  where
  rnf :: PutDedicatedIpWarmupAttributes -> ()
rnf PutDedicatedIpWarmupAttributes' {Int
Text
warmupPercentage :: Int
ip :: Text
$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Int
$sel:ip:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
ip
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
warmupPercentage

instance
  Data.ToHeaders
    PutDedicatedIpWarmupAttributes
  where
  toHeaders :: PutDedicatedIpWarmupAttributes -> 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 PutDedicatedIpWarmupAttributes where
  toJSON :: PutDedicatedIpWarmupAttributes -> Value
toJSON PutDedicatedIpWarmupAttributes' {Int
Text
warmupPercentage :: Int
ip :: Text
$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Int
$sel:ip:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"WarmupPercentage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
warmupPercentage)
          ]
      )

instance Data.ToPath PutDedicatedIpWarmupAttributes where
  toPath :: PutDedicatedIpWarmupAttributes -> ByteString
toPath PutDedicatedIpWarmupAttributes' {Int
Text
warmupPercentage :: Int
ip :: Text
$sel:warmupPercentage:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Int
$sel:ip:PutDedicatedIpWarmupAttributes' :: PutDedicatedIpWarmupAttributes -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/email/dedicated-ips/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
ip, ByteString
"/warmup"]

instance Data.ToQuery PutDedicatedIpWarmupAttributes where
  toQuery :: PutDedicatedIpWarmupAttributes -> 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:/ 'newPutDedicatedIpWarmupAttributesResponse' smart constructor.
data PutDedicatedIpWarmupAttributesResponse = PutDedicatedIpWarmupAttributesResponse'
  { -- | The response's http status code.
    PutDedicatedIpWarmupAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutDedicatedIpWarmupAttributesResponse
-> PutDedicatedIpWarmupAttributesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDedicatedIpWarmupAttributesResponse
-> PutDedicatedIpWarmupAttributesResponse -> Bool
$c/= :: PutDedicatedIpWarmupAttributesResponse
-> PutDedicatedIpWarmupAttributesResponse -> Bool
== :: PutDedicatedIpWarmupAttributesResponse
-> PutDedicatedIpWarmupAttributesResponse -> Bool
$c== :: PutDedicatedIpWarmupAttributesResponse
-> PutDedicatedIpWarmupAttributesResponse -> Bool
Prelude.Eq, ReadPrec [PutDedicatedIpWarmupAttributesResponse]
ReadPrec PutDedicatedIpWarmupAttributesResponse
Int -> ReadS PutDedicatedIpWarmupAttributesResponse
ReadS [PutDedicatedIpWarmupAttributesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDedicatedIpWarmupAttributesResponse]
$creadListPrec :: ReadPrec [PutDedicatedIpWarmupAttributesResponse]
readPrec :: ReadPrec PutDedicatedIpWarmupAttributesResponse
$creadPrec :: ReadPrec PutDedicatedIpWarmupAttributesResponse
readList :: ReadS [PutDedicatedIpWarmupAttributesResponse]
$creadList :: ReadS [PutDedicatedIpWarmupAttributesResponse]
readsPrec :: Int -> ReadS PutDedicatedIpWarmupAttributesResponse
$creadsPrec :: Int -> ReadS PutDedicatedIpWarmupAttributesResponse
Prelude.Read, Int -> PutDedicatedIpWarmupAttributesResponse -> ShowS
[PutDedicatedIpWarmupAttributesResponse] -> ShowS
PutDedicatedIpWarmupAttributesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDedicatedIpWarmupAttributesResponse] -> ShowS
$cshowList :: [PutDedicatedIpWarmupAttributesResponse] -> ShowS
show :: PutDedicatedIpWarmupAttributesResponse -> String
$cshow :: PutDedicatedIpWarmupAttributesResponse -> String
showsPrec :: Int -> PutDedicatedIpWarmupAttributesResponse -> ShowS
$cshowsPrec :: Int -> PutDedicatedIpWarmupAttributesResponse -> ShowS
Prelude.Show, forall x.
Rep PutDedicatedIpWarmupAttributesResponse x
-> PutDedicatedIpWarmupAttributesResponse
forall x.
PutDedicatedIpWarmupAttributesResponse
-> Rep PutDedicatedIpWarmupAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutDedicatedIpWarmupAttributesResponse x
-> PutDedicatedIpWarmupAttributesResponse
$cfrom :: forall x.
PutDedicatedIpWarmupAttributesResponse
-> Rep PutDedicatedIpWarmupAttributesResponse x
Prelude.Generic)

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

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

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