{-# 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.MediaLive.Types.InputWhitelistRuleCidr
-- 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.MediaLive.Types.InputWhitelistRuleCidr 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

-- | An IPv4 CIDR to whitelist.
--
-- /See:/ 'newInputWhitelistRuleCidr' smart constructor.
data InputWhitelistRuleCidr = InputWhitelistRuleCidr'
  { -- | The IPv4 CIDR to whitelist.
    InputWhitelistRuleCidr -> Maybe Text
cidr :: Prelude.Maybe Prelude.Text
  }
  deriving (InputWhitelistRuleCidr -> InputWhitelistRuleCidr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputWhitelistRuleCidr -> InputWhitelistRuleCidr -> Bool
$c/= :: InputWhitelistRuleCidr -> InputWhitelistRuleCidr -> Bool
== :: InputWhitelistRuleCidr -> InputWhitelistRuleCidr -> Bool
$c== :: InputWhitelistRuleCidr -> InputWhitelistRuleCidr -> Bool
Prelude.Eq, ReadPrec [InputWhitelistRuleCidr]
ReadPrec InputWhitelistRuleCidr
Int -> ReadS InputWhitelistRuleCidr
ReadS [InputWhitelistRuleCidr]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputWhitelistRuleCidr]
$creadListPrec :: ReadPrec [InputWhitelistRuleCidr]
readPrec :: ReadPrec InputWhitelistRuleCidr
$creadPrec :: ReadPrec InputWhitelistRuleCidr
readList :: ReadS [InputWhitelistRuleCidr]
$creadList :: ReadS [InputWhitelistRuleCidr]
readsPrec :: Int -> ReadS InputWhitelistRuleCidr
$creadsPrec :: Int -> ReadS InputWhitelistRuleCidr
Prelude.Read, Int -> InputWhitelistRuleCidr -> ShowS
[InputWhitelistRuleCidr] -> ShowS
InputWhitelistRuleCidr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputWhitelistRuleCidr] -> ShowS
$cshowList :: [InputWhitelistRuleCidr] -> ShowS
show :: InputWhitelistRuleCidr -> String
$cshow :: InputWhitelistRuleCidr -> String
showsPrec :: Int -> InputWhitelistRuleCidr -> ShowS
$cshowsPrec :: Int -> InputWhitelistRuleCidr -> ShowS
Prelude.Show, forall x. Rep InputWhitelistRuleCidr x -> InputWhitelistRuleCidr
forall x. InputWhitelistRuleCidr -> Rep InputWhitelistRuleCidr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputWhitelistRuleCidr x -> InputWhitelistRuleCidr
$cfrom :: forall x. InputWhitelistRuleCidr -> Rep InputWhitelistRuleCidr x
Prelude.Generic)

-- |
-- Create a value of 'InputWhitelistRuleCidr' 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:
--
-- 'cidr', 'inputWhitelistRuleCidr_cidr' - The IPv4 CIDR to whitelist.
newInputWhitelistRuleCidr ::
  InputWhitelistRuleCidr
newInputWhitelistRuleCidr :: InputWhitelistRuleCidr
newInputWhitelistRuleCidr =
  InputWhitelistRuleCidr' {$sel:cidr:InputWhitelistRuleCidr' :: Maybe Text
cidr = forall a. Maybe a
Prelude.Nothing}

-- | The IPv4 CIDR to whitelist.
inputWhitelistRuleCidr_cidr :: Lens.Lens' InputWhitelistRuleCidr (Prelude.Maybe Prelude.Text)
inputWhitelistRuleCidr_cidr :: Lens' InputWhitelistRuleCidr (Maybe Text)
inputWhitelistRuleCidr_cidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputWhitelistRuleCidr' {Maybe Text
cidr :: Maybe Text
$sel:cidr:InputWhitelistRuleCidr' :: InputWhitelistRuleCidr -> Maybe Text
cidr} -> Maybe Text
cidr) (\s :: InputWhitelistRuleCidr
s@InputWhitelistRuleCidr' {} Maybe Text
a -> InputWhitelistRuleCidr
s {$sel:cidr:InputWhitelistRuleCidr' :: Maybe Text
cidr = Maybe Text
a} :: InputWhitelistRuleCidr)

instance Prelude.Hashable InputWhitelistRuleCidr where
  hashWithSalt :: Int -> InputWhitelistRuleCidr -> Int
hashWithSalt Int
_salt InputWhitelistRuleCidr' {Maybe Text
cidr :: Maybe Text
$sel:cidr:InputWhitelistRuleCidr' :: InputWhitelistRuleCidr -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cidr

instance Prelude.NFData InputWhitelistRuleCidr where
  rnf :: InputWhitelistRuleCidr -> ()
rnf InputWhitelistRuleCidr' {Maybe Text
cidr :: Maybe Text
$sel:cidr:InputWhitelistRuleCidr' :: InputWhitelistRuleCidr -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cidr

instance Data.ToJSON InputWhitelistRuleCidr where
  toJSON :: InputWhitelistRuleCidr -> Value
toJSON InputWhitelistRuleCidr' {Maybe Text
cidr :: Maybe Text
$sel:cidr:InputWhitelistRuleCidr' :: InputWhitelistRuleCidr -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"cidr" 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 Text
cidr]
      )