{-# 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.EC2.Types.ScheduledInstancesPrivateIpAddressConfig
-- 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.EC2.Types.ScheduledInstancesPrivateIpAddressConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Describes a private IPv4 address for a Scheduled Instance.
--
-- /See:/ 'newScheduledInstancesPrivateIpAddressConfig' smart constructor.
data ScheduledInstancesPrivateIpAddressConfig = ScheduledInstancesPrivateIpAddressConfig'
  { -- | Indicates whether this is a primary IPv4 address. Otherwise, this is a
    -- secondary IPv4 address.
    ScheduledInstancesPrivateIpAddressConfig -> Maybe Bool
primary :: Prelude.Maybe Prelude.Bool,
    -- | The IPv4 address.
    ScheduledInstancesPrivateIpAddressConfig -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (ScheduledInstancesPrivateIpAddressConfig
-> ScheduledInstancesPrivateIpAddressConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduledInstancesPrivateIpAddressConfig
-> ScheduledInstancesPrivateIpAddressConfig -> Bool
$c/= :: ScheduledInstancesPrivateIpAddressConfig
-> ScheduledInstancesPrivateIpAddressConfig -> Bool
== :: ScheduledInstancesPrivateIpAddressConfig
-> ScheduledInstancesPrivateIpAddressConfig -> Bool
$c== :: ScheduledInstancesPrivateIpAddressConfig
-> ScheduledInstancesPrivateIpAddressConfig -> Bool
Prelude.Eq, ReadPrec [ScheduledInstancesPrivateIpAddressConfig]
ReadPrec ScheduledInstancesPrivateIpAddressConfig
Int -> ReadS ScheduledInstancesPrivateIpAddressConfig
ReadS [ScheduledInstancesPrivateIpAddressConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduledInstancesPrivateIpAddressConfig]
$creadListPrec :: ReadPrec [ScheduledInstancesPrivateIpAddressConfig]
readPrec :: ReadPrec ScheduledInstancesPrivateIpAddressConfig
$creadPrec :: ReadPrec ScheduledInstancesPrivateIpAddressConfig
readList :: ReadS [ScheduledInstancesPrivateIpAddressConfig]
$creadList :: ReadS [ScheduledInstancesPrivateIpAddressConfig]
readsPrec :: Int -> ReadS ScheduledInstancesPrivateIpAddressConfig
$creadsPrec :: Int -> ReadS ScheduledInstancesPrivateIpAddressConfig
Prelude.Read, Int -> ScheduledInstancesPrivateIpAddressConfig -> ShowS
[ScheduledInstancesPrivateIpAddressConfig] -> ShowS
ScheduledInstancesPrivateIpAddressConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduledInstancesPrivateIpAddressConfig] -> ShowS
$cshowList :: [ScheduledInstancesPrivateIpAddressConfig] -> ShowS
show :: ScheduledInstancesPrivateIpAddressConfig -> String
$cshow :: ScheduledInstancesPrivateIpAddressConfig -> String
showsPrec :: Int -> ScheduledInstancesPrivateIpAddressConfig -> ShowS
$cshowsPrec :: Int -> ScheduledInstancesPrivateIpAddressConfig -> ShowS
Prelude.Show, forall x.
Rep ScheduledInstancesPrivateIpAddressConfig x
-> ScheduledInstancesPrivateIpAddressConfig
forall x.
ScheduledInstancesPrivateIpAddressConfig
-> Rep ScheduledInstancesPrivateIpAddressConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScheduledInstancesPrivateIpAddressConfig x
-> ScheduledInstancesPrivateIpAddressConfig
$cfrom :: forall x.
ScheduledInstancesPrivateIpAddressConfig
-> Rep ScheduledInstancesPrivateIpAddressConfig x
Prelude.Generic)

-- |
-- Create a value of 'ScheduledInstancesPrivateIpAddressConfig' 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:
--
-- 'primary', 'scheduledInstancesPrivateIpAddressConfig_primary' - Indicates whether this is a primary IPv4 address. Otherwise, this is a
-- secondary IPv4 address.
--
-- 'privateIpAddress', 'scheduledInstancesPrivateIpAddressConfig_privateIpAddress' - The IPv4 address.
newScheduledInstancesPrivateIpAddressConfig ::
  ScheduledInstancesPrivateIpAddressConfig
newScheduledInstancesPrivateIpAddressConfig :: ScheduledInstancesPrivateIpAddressConfig
newScheduledInstancesPrivateIpAddressConfig =
  ScheduledInstancesPrivateIpAddressConfig'
    { $sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: Maybe Bool
primary =
        forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: Maybe Text
privateIpAddress =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether this is a primary IPv4 address. Otherwise, this is a
-- secondary IPv4 address.
scheduledInstancesPrivateIpAddressConfig_primary :: Lens.Lens' ScheduledInstancesPrivateIpAddressConfig (Prelude.Maybe Prelude.Bool)
scheduledInstancesPrivateIpAddressConfig_primary :: Lens' ScheduledInstancesPrivateIpAddressConfig (Maybe Bool)
scheduledInstancesPrivateIpAddressConfig_primary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesPrivateIpAddressConfig' {Maybe Bool
primary :: Maybe Bool
$sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Bool
primary} -> Maybe Bool
primary) (\s :: ScheduledInstancesPrivateIpAddressConfig
s@ScheduledInstancesPrivateIpAddressConfig' {} Maybe Bool
a -> ScheduledInstancesPrivateIpAddressConfig
s {$sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: Maybe Bool
primary = Maybe Bool
a} :: ScheduledInstancesPrivateIpAddressConfig)

-- | The IPv4 address.
scheduledInstancesPrivateIpAddressConfig_privateIpAddress :: Lens.Lens' ScheduledInstancesPrivateIpAddressConfig (Prelude.Maybe Prelude.Text)
scheduledInstancesPrivateIpAddressConfig_privateIpAddress :: Lens' ScheduledInstancesPrivateIpAddressConfig (Maybe Text)
scheduledInstancesPrivateIpAddressConfig_privateIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduledInstancesPrivateIpAddressConfig' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: ScheduledInstancesPrivateIpAddressConfig
s@ScheduledInstancesPrivateIpAddressConfig' {} Maybe Text
a -> ScheduledInstancesPrivateIpAddressConfig
s {$sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: Maybe Text
privateIpAddress = Maybe Text
a} :: ScheduledInstancesPrivateIpAddressConfig)

instance
  Prelude.Hashable
    ScheduledInstancesPrivateIpAddressConfig
  where
  hashWithSalt :: Int -> ScheduledInstancesPrivateIpAddressConfig -> Int
hashWithSalt
    Int
_salt
    ScheduledInstancesPrivateIpAddressConfig' {Maybe Bool
Maybe Text
privateIpAddress :: Maybe Text
primary :: Maybe Bool
$sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Text
$sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
primary
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIpAddress

instance
  Prelude.NFData
    ScheduledInstancesPrivateIpAddressConfig
  where
  rnf :: ScheduledInstancesPrivateIpAddressConfig -> ()
rnf ScheduledInstancesPrivateIpAddressConfig' {Maybe Bool
Maybe Text
privateIpAddress :: Maybe Text
primary :: Maybe Bool
$sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Text
$sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
primary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIpAddress

instance
  Data.ToQuery
    ScheduledInstancesPrivateIpAddressConfig
  where
  toQuery :: ScheduledInstancesPrivateIpAddressConfig -> QueryString
toQuery ScheduledInstancesPrivateIpAddressConfig' {Maybe Bool
Maybe Text
privateIpAddress :: Maybe Text
primary :: Maybe Bool
$sel:privateIpAddress:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Text
$sel:primary:ScheduledInstancesPrivateIpAddressConfig' :: ScheduledInstancesPrivateIpAddressConfig -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Primary" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
primary,
        ByteString
"PrivateIpAddress" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
privateIpAddress
      ]