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

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

-- |
-- Module      : Amazonka.SESV2.Types.DedicatedIp
-- 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.SESV2.Types.DedicatedIp 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 Amazonka.SESV2.Types.WarmupStatus

-- | Contains information about a dedicated IP address that is associated
-- with your Amazon SES account.
--
-- To learn more about requesting dedicated IP addresses, see
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/dedicated-ip-case.html Requesting and Relinquishing Dedicated IP Addresses>
-- in the /Amazon SES Developer Guide/.
--
-- /See:/ 'newDedicatedIp' smart constructor.
data DedicatedIp = DedicatedIp'
  { -- | The name of the dedicated IP pool that the IP address is associated
    -- with.
    DedicatedIp -> Maybe Text
poolName :: Prelude.Maybe Prelude.Text,
    -- | An IPv4 address.
    DedicatedIp -> Text
ip :: Prelude.Text,
    -- | The warm-up status of a dedicated IP address. The status can have one of
    -- the following values:
    --
    -- -   @IN_PROGRESS@ – The IP address isn\'t ready to use because the
    --     dedicated IP warm-up process is ongoing.
    --
    -- -   @DONE@ – The dedicated IP warm-up process is complete, and the IP
    --     address is ready to use.
    DedicatedIp -> WarmupStatus
warmupStatus :: WarmupStatus,
    -- | Indicates how complete the dedicated IP warm-up process is. When this
    -- value equals 1, the address has completed the warm-up process and is
    -- ready for use.
    DedicatedIp -> Int
warmupPercentage :: Prelude.Int
  }
  deriving (DedicatedIp -> DedicatedIp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DedicatedIp -> DedicatedIp -> Bool
$c/= :: DedicatedIp -> DedicatedIp -> Bool
== :: DedicatedIp -> DedicatedIp -> Bool
$c== :: DedicatedIp -> DedicatedIp -> Bool
Prelude.Eq, ReadPrec [DedicatedIp]
ReadPrec DedicatedIp
Int -> ReadS DedicatedIp
ReadS [DedicatedIp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DedicatedIp]
$creadListPrec :: ReadPrec [DedicatedIp]
readPrec :: ReadPrec DedicatedIp
$creadPrec :: ReadPrec DedicatedIp
readList :: ReadS [DedicatedIp]
$creadList :: ReadS [DedicatedIp]
readsPrec :: Int -> ReadS DedicatedIp
$creadsPrec :: Int -> ReadS DedicatedIp
Prelude.Read, Int -> DedicatedIp -> ShowS
[DedicatedIp] -> ShowS
DedicatedIp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DedicatedIp] -> ShowS
$cshowList :: [DedicatedIp] -> ShowS
show :: DedicatedIp -> String
$cshow :: DedicatedIp -> String
showsPrec :: Int -> DedicatedIp -> ShowS
$cshowsPrec :: Int -> DedicatedIp -> ShowS
Prelude.Show, forall x. Rep DedicatedIp x -> DedicatedIp
forall x. DedicatedIp -> Rep DedicatedIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DedicatedIp x -> DedicatedIp
$cfrom :: forall x. DedicatedIp -> Rep DedicatedIp x
Prelude.Generic)

-- |
-- Create a value of 'DedicatedIp' 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:
--
-- 'poolName', 'dedicatedIp_poolName' - The name of the dedicated IP pool that the IP address is associated
-- with.
--
-- 'ip', 'dedicatedIp_ip' - An IPv4 address.
--
-- 'warmupStatus', 'dedicatedIp_warmupStatus' - The warm-up status of a dedicated IP address. The status can have one of
-- the following values:
--
-- -   @IN_PROGRESS@ – The IP address isn\'t ready to use because the
--     dedicated IP warm-up process is ongoing.
--
-- -   @DONE@ – The dedicated IP warm-up process is complete, and the IP
--     address is ready to use.
--
-- 'warmupPercentage', 'dedicatedIp_warmupPercentage' - Indicates how complete the dedicated IP warm-up process is. When this
-- value equals 1, the address has completed the warm-up process and is
-- ready for use.
newDedicatedIp ::
  -- | 'ip'
  Prelude.Text ->
  -- | 'warmupStatus'
  WarmupStatus ->
  -- | 'warmupPercentage'
  Prelude.Int ->
  DedicatedIp
newDedicatedIp :: Text -> WarmupStatus -> Int -> DedicatedIp
newDedicatedIp Text
pIp_ WarmupStatus
pWarmupStatus_ Int
pWarmupPercentage_ =
  DedicatedIp'
    { $sel:poolName:DedicatedIp' :: Maybe Text
poolName = forall a. Maybe a
Prelude.Nothing,
      $sel:ip:DedicatedIp' :: Text
ip = Text
pIp_,
      $sel:warmupStatus:DedicatedIp' :: WarmupStatus
warmupStatus = WarmupStatus
pWarmupStatus_,
      $sel:warmupPercentage:DedicatedIp' :: Int
warmupPercentage = Int
pWarmupPercentage_
    }

-- | The name of the dedicated IP pool that the IP address is associated
-- with.
dedicatedIp_poolName :: Lens.Lens' DedicatedIp (Prelude.Maybe Prelude.Text)
dedicatedIp_poolName :: Lens' DedicatedIp (Maybe Text)
dedicatedIp_poolName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DedicatedIp' {Maybe Text
poolName :: Maybe Text
$sel:poolName:DedicatedIp' :: DedicatedIp -> Maybe Text
poolName} -> Maybe Text
poolName) (\s :: DedicatedIp
s@DedicatedIp' {} Maybe Text
a -> DedicatedIp
s {$sel:poolName:DedicatedIp' :: Maybe Text
poolName = Maybe Text
a} :: DedicatedIp)

-- | An IPv4 address.
dedicatedIp_ip :: Lens.Lens' DedicatedIp Prelude.Text
dedicatedIp_ip :: Lens' DedicatedIp Text
dedicatedIp_ip = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DedicatedIp' {Text
ip :: Text
$sel:ip:DedicatedIp' :: DedicatedIp -> Text
ip} -> Text
ip) (\s :: DedicatedIp
s@DedicatedIp' {} Text
a -> DedicatedIp
s {$sel:ip:DedicatedIp' :: Text
ip = Text
a} :: DedicatedIp)

-- | The warm-up status of a dedicated IP address. The status can have one of
-- the following values:
--
-- -   @IN_PROGRESS@ – The IP address isn\'t ready to use because the
--     dedicated IP warm-up process is ongoing.
--
-- -   @DONE@ – The dedicated IP warm-up process is complete, and the IP
--     address is ready to use.
dedicatedIp_warmupStatus :: Lens.Lens' DedicatedIp WarmupStatus
dedicatedIp_warmupStatus :: Lens' DedicatedIp WarmupStatus
dedicatedIp_warmupStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DedicatedIp' {WarmupStatus
warmupStatus :: WarmupStatus
$sel:warmupStatus:DedicatedIp' :: DedicatedIp -> WarmupStatus
warmupStatus} -> WarmupStatus
warmupStatus) (\s :: DedicatedIp
s@DedicatedIp' {} WarmupStatus
a -> DedicatedIp
s {$sel:warmupStatus:DedicatedIp' :: WarmupStatus
warmupStatus = WarmupStatus
a} :: DedicatedIp)

-- | Indicates how complete the dedicated IP warm-up process is. When this
-- value equals 1, the address has completed the warm-up process and is
-- ready for use.
dedicatedIp_warmupPercentage :: Lens.Lens' DedicatedIp Prelude.Int
dedicatedIp_warmupPercentage :: Lens' DedicatedIp Int
dedicatedIp_warmupPercentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DedicatedIp' {Int
warmupPercentage :: Int
$sel:warmupPercentage:DedicatedIp' :: DedicatedIp -> Int
warmupPercentage} -> Int
warmupPercentage) (\s :: DedicatedIp
s@DedicatedIp' {} Int
a -> DedicatedIp
s {$sel:warmupPercentage:DedicatedIp' :: Int
warmupPercentage = Int
a} :: DedicatedIp)

instance Data.FromJSON DedicatedIp where
  parseJSON :: Value -> Parser DedicatedIp
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DedicatedIp"
      ( \Object
x ->
          Maybe Text -> Text -> WarmupStatus -> Int -> DedicatedIp
DedicatedIp'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PoolName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Ip")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"WarmupStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"WarmupPercentage")
      )

instance Prelude.Hashable DedicatedIp where
  hashWithSalt :: Int -> DedicatedIp -> Int
hashWithSalt Int
_salt DedicatedIp' {Int
Maybe Text
Text
WarmupStatus
warmupPercentage :: Int
warmupStatus :: WarmupStatus
ip :: Text
poolName :: Maybe Text
$sel:warmupPercentage:DedicatedIp' :: DedicatedIp -> Int
$sel:warmupStatus:DedicatedIp' :: DedicatedIp -> WarmupStatus
$sel:ip:DedicatedIp' :: DedicatedIp -> Text
$sel:poolName:DedicatedIp' :: DedicatedIp -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
poolName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ip
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WarmupStatus
warmupStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
warmupPercentage

instance Prelude.NFData DedicatedIp where
  rnf :: DedicatedIp -> ()
rnf DedicatedIp' {Int
Maybe Text
Text
WarmupStatus
warmupPercentage :: Int
warmupStatus :: WarmupStatus
ip :: Text
poolName :: Maybe Text
$sel:warmupPercentage:DedicatedIp' :: DedicatedIp -> Int
$sel:warmupStatus:DedicatedIp' :: DedicatedIp -> WarmupStatus
$sel:ip:DedicatedIp' :: DedicatedIp -> Text
$sel:poolName:DedicatedIp' :: DedicatedIp -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
poolName
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 WarmupStatus
warmupStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
warmupPercentage