{-# 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-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)
module Amazonka.SESV2.Types.DedicatedIp where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DedicatedIp -> DedicatedIp -> Bool)
-> (DedicatedIp -> DedicatedIp -> Bool) -> Eq DedicatedIp
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]
(Int -> ReadS DedicatedIp)
-> ReadS [DedicatedIp]
-> ReadPrec DedicatedIp
-> ReadPrec [DedicatedIp]
-> Read 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
(Int -> DedicatedIp -> ShowS)
-> (DedicatedIp -> String)
-> ([DedicatedIp] -> ShowS)
-> Show DedicatedIp
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. DedicatedIp -> Rep DedicatedIp x)
-> (forall x. Rep DedicatedIp x -> DedicatedIp)
-> Generic DedicatedIp
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' :: Maybe Text -> Text -> WarmupStatus -> Int -> DedicatedIp
DedicatedIp'
    { $sel:poolName:DedicatedIp' :: Maybe Text
poolName = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> DedicatedIp -> f DedicatedIp
dedicatedIp_poolName = (DedicatedIp -> Maybe Text)
-> (DedicatedIp -> Maybe Text -> DedicatedIp)
-> Lens DedicatedIp DedicatedIp (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> DedicatedIp -> f DedicatedIp
dedicatedIp_ip = (DedicatedIp -> Text)
-> (DedicatedIp -> Text -> DedicatedIp)
-> Lens DedicatedIp DedicatedIp Text Text
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 :: (WarmupStatus -> f WarmupStatus) -> DedicatedIp -> f DedicatedIp
dedicatedIp_warmupStatus = (DedicatedIp -> WarmupStatus)
-> (DedicatedIp -> WarmupStatus -> DedicatedIp)
-> Lens DedicatedIp DedicatedIp WarmupStatus 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 :: (Int -> f Int) -> DedicatedIp -> f DedicatedIp
dedicatedIp_warmupPercentage = (DedicatedIp -> Int)
-> (DedicatedIp -> Int -> DedicatedIp)
-> Lens DedicatedIp DedicatedIp Int Int
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 Core.FromJSON DedicatedIp where
  parseJSON :: Value -> Parser DedicatedIp
parseJSON =
    String
-> (Object -> Parser DedicatedIp) -> Value -> Parser DedicatedIp
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DedicatedIp"
      ( \Object
x ->
          Maybe Text -> Text -> WarmupStatus -> Int -> DedicatedIp
DedicatedIp'
            (Maybe Text -> Text -> WarmupStatus -> Int -> DedicatedIp)
-> Parser (Maybe Text)
-> Parser (Text -> WarmupStatus -> Int -> DedicatedIp)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PoolName")
            Parser (Text -> WarmupStatus -> Int -> DedicatedIp)
-> Parser Text -> Parser (WarmupStatus -> Int -> DedicatedIp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Ip")
            Parser (WarmupStatus -> Int -> DedicatedIp)
-> Parser WarmupStatus -> Parser (Int -> DedicatedIp)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WarmupStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"WarmupStatus")
            Parser (Int -> DedicatedIp) -> Parser Int -> Parser DedicatedIp
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"WarmupPercentage")
      )

instance Prelude.Hashable DedicatedIp

instance Prelude.NFData DedicatedIp