{-# 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.InputWhitelistRule
-- 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.InputWhitelistRule 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

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

-- |
-- Create a value of 'InputWhitelistRule' 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', 'inputWhitelistRule_cidr' - The IPv4 CIDR that\'s whitelisted.
newInputWhitelistRule ::
  InputWhitelistRule
newInputWhitelistRule :: InputWhitelistRule
newInputWhitelistRule =
  InputWhitelistRule' {$sel:cidr:InputWhitelistRule' :: Maybe Text
cidr = forall a. Maybe a
Prelude.Nothing}

-- | The IPv4 CIDR that\'s whitelisted.
inputWhitelistRule_cidr :: Lens.Lens' InputWhitelistRule (Prelude.Maybe Prelude.Text)
inputWhitelistRule_cidr :: Lens' InputWhitelistRule (Maybe Text)
inputWhitelistRule_cidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputWhitelistRule' {Maybe Text
cidr :: Maybe Text
$sel:cidr:InputWhitelistRule' :: InputWhitelistRule -> Maybe Text
cidr} -> Maybe Text
cidr) (\s :: InputWhitelistRule
s@InputWhitelistRule' {} Maybe Text
a -> InputWhitelistRule
s {$sel:cidr:InputWhitelistRule' :: Maybe Text
cidr = Maybe Text
a} :: InputWhitelistRule)

instance Data.FromJSON InputWhitelistRule where
  parseJSON :: Value -> Parser InputWhitelistRule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputWhitelistRule"
      ( \Object
x ->
          Maybe Text -> InputWhitelistRule
InputWhitelistRule' 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
"cidr")
      )

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

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