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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.InputSecurityGroupState
import Amazonka.MediaLive.Types.InputWhitelistRule
import qualified Amazonka.Prelude as Prelude

-- | An Input Security Group
--
-- /See:/ 'newInputSecurityGroup' smart constructor.
data InputSecurityGroup = InputSecurityGroup'
  { -- | The current state of the Input Security Group.
    InputSecurityGroup -> Maybe InputSecurityGroupState
state :: Prelude.Maybe InputSecurityGroupState,
    -- | Unique ARN of Input Security Group
    InputSecurityGroup -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The list of inputs currently using this Input Security Group.
    InputSecurityGroup -> Maybe [Text]
inputs :: Prelude.Maybe [Prelude.Text],
    -- | The Id of the Input Security Group
    InputSecurityGroup -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Whitelist rules and their sync status
    InputSecurityGroup -> Maybe [InputWhitelistRule]
whitelistRules :: Prelude.Maybe [InputWhitelistRule],
    -- | A collection of key-value pairs.
    InputSecurityGroup -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (InputSecurityGroup -> InputSecurityGroup -> Bool
(InputSecurityGroup -> InputSecurityGroup -> Bool)
-> (InputSecurityGroup -> InputSecurityGroup -> Bool)
-> Eq InputSecurityGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputSecurityGroup -> InputSecurityGroup -> Bool
$c/= :: InputSecurityGroup -> InputSecurityGroup -> Bool
== :: InputSecurityGroup -> InputSecurityGroup -> Bool
$c== :: InputSecurityGroup -> InputSecurityGroup -> Bool
Prelude.Eq, ReadPrec [InputSecurityGroup]
ReadPrec InputSecurityGroup
Int -> ReadS InputSecurityGroup
ReadS [InputSecurityGroup]
(Int -> ReadS InputSecurityGroup)
-> ReadS [InputSecurityGroup]
-> ReadPrec InputSecurityGroup
-> ReadPrec [InputSecurityGroup]
-> Read InputSecurityGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputSecurityGroup]
$creadListPrec :: ReadPrec [InputSecurityGroup]
readPrec :: ReadPrec InputSecurityGroup
$creadPrec :: ReadPrec InputSecurityGroup
readList :: ReadS [InputSecurityGroup]
$creadList :: ReadS [InputSecurityGroup]
readsPrec :: Int -> ReadS InputSecurityGroup
$creadsPrec :: Int -> ReadS InputSecurityGroup
Prelude.Read, Int -> InputSecurityGroup -> ShowS
[InputSecurityGroup] -> ShowS
InputSecurityGroup -> String
(Int -> InputSecurityGroup -> ShowS)
-> (InputSecurityGroup -> String)
-> ([InputSecurityGroup] -> ShowS)
-> Show InputSecurityGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputSecurityGroup] -> ShowS
$cshowList :: [InputSecurityGroup] -> ShowS
show :: InputSecurityGroup -> String
$cshow :: InputSecurityGroup -> String
showsPrec :: Int -> InputSecurityGroup -> ShowS
$cshowsPrec :: Int -> InputSecurityGroup -> ShowS
Prelude.Show, (forall x. InputSecurityGroup -> Rep InputSecurityGroup x)
-> (forall x. Rep InputSecurityGroup x -> InputSecurityGroup)
-> Generic InputSecurityGroup
forall x. Rep InputSecurityGroup x -> InputSecurityGroup
forall x. InputSecurityGroup -> Rep InputSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputSecurityGroup x -> InputSecurityGroup
$cfrom :: forall x. InputSecurityGroup -> Rep InputSecurityGroup x
Prelude.Generic)

-- |
-- Create a value of 'InputSecurityGroup' 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:
--
-- 'state', 'inputSecurityGroup_state' - The current state of the Input Security Group.
--
-- 'arn', 'inputSecurityGroup_arn' - Unique ARN of Input Security Group
--
-- 'inputs', 'inputSecurityGroup_inputs' - The list of inputs currently using this Input Security Group.
--
-- 'id', 'inputSecurityGroup_id' - The Id of the Input Security Group
--
-- 'whitelistRules', 'inputSecurityGroup_whitelistRules' - Whitelist rules and their sync status
--
-- 'tags', 'inputSecurityGroup_tags' - A collection of key-value pairs.
newInputSecurityGroup ::
  InputSecurityGroup
newInputSecurityGroup :: InputSecurityGroup
newInputSecurityGroup =
  InputSecurityGroup' :: Maybe InputSecurityGroupState
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [InputWhitelistRule]
-> Maybe (HashMap Text Text)
-> InputSecurityGroup
InputSecurityGroup'
    { $sel:state:InputSecurityGroup' :: Maybe InputSecurityGroupState
state = Maybe InputSecurityGroupState
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:InputSecurityGroup' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inputs:InputSecurityGroup' :: Maybe [Text]
inputs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:id:InputSecurityGroup' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:whitelistRules:InputSecurityGroup' :: Maybe [InputWhitelistRule]
whitelistRules = Maybe [InputWhitelistRule]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:InputSecurityGroup' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the Input Security Group.
inputSecurityGroup_state :: Lens.Lens' InputSecurityGroup (Prelude.Maybe InputSecurityGroupState)
inputSecurityGroup_state :: (Maybe InputSecurityGroupState
 -> f (Maybe InputSecurityGroupState))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_state = (InputSecurityGroup -> Maybe InputSecurityGroupState)
-> (InputSecurityGroup
    -> Maybe InputSecurityGroupState -> InputSecurityGroup)
-> Lens
     InputSecurityGroup
     InputSecurityGroup
     (Maybe InputSecurityGroupState)
     (Maybe InputSecurityGroupState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe InputSecurityGroupState
state :: Maybe InputSecurityGroupState
$sel:state:InputSecurityGroup' :: InputSecurityGroup -> Maybe InputSecurityGroupState
state} -> Maybe InputSecurityGroupState
state) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe InputSecurityGroupState
a -> InputSecurityGroup
s {$sel:state:InputSecurityGroup' :: Maybe InputSecurityGroupState
state = Maybe InputSecurityGroupState
a} :: InputSecurityGroup)

-- | Unique ARN of Input Security Group
inputSecurityGroup_arn :: Lens.Lens' InputSecurityGroup (Prelude.Maybe Prelude.Text)
inputSecurityGroup_arn :: (Maybe Text -> f (Maybe Text))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_arn = (InputSecurityGroup -> Maybe Text)
-> (InputSecurityGroup -> Maybe Text -> InputSecurityGroup)
-> Lens
     InputSecurityGroup InputSecurityGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe Text
arn :: Maybe Text
$sel:arn:InputSecurityGroup' :: InputSecurityGroup -> Maybe Text
arn} -> Maybe Text
arn) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe Text
a -> InputSecurityGroup
s {$sel:arn:InputSecurityGroup' :: Maybe Text
arn = Maybe Text
a} :: InputSecurityGroup)

-- | The list of inputs currently using this Input Security Group.
inputSecurityGroup_inputs :: Lens.Lens' InputSecurityGroup (Prelude.Maybe [Prelude.Text])
inputSecurityGroup_inputs :: (Maybe [Text] -> f (Maybe [Text]))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_inputs = (InputSecurityGroup -> Maybe [Text])
-> (InputSecurityGroup -> Maybe [Text] -> InputSecurityGroup)
-> Lens
     InputSecurityGroup InputSecurityGroup (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe [Text]
inputs :: Maybe [Text]
$sel:inputs:InputSecurityGroup' :: InputSecurityGroup -> Maybe [Text]
inputs} -> Maybe [Text]
inputs) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe [Text]
a -> InputSecurityGroup
s {$sel:inputs:InputSecurityGroup' :: Maybe [Text]
inputs = Maybe [Text]
a} :: InputSecurityGroup) ((Maybe [Text] -> f (Maybe [Text]))
 -> InputSecurityGroup -> f InputSecurityGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InputSecurityGroup
-> f InputSecurityGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Id of the Input Security Group
inputSecurityGroup_id :: Lens.Lens' InputSecurityGroup (Prelude.Maybe Prelude.Text)
inputSecurityGroup_id :: (Maybe Text -> f (Maybe Text))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_id = (InputSecurityGroup -> Maybe Text)
-> (InputSecurityGroup -> Maybe Text -> InputSecurityGroup)
-> Lens
     InputSecurityGroup InputSecurityGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe Text
id :: Maybe Text
$sel:id:InputSecurityGroup' :: InputSecurityGroup -> Maybe Text
id} -> Maybe Text
id) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe Text
a -> InputSecurityGroup
s {$sel:id:InputSecurityGroup' :: Maybe Text
id = Maybe Text
a} :: InputSecurityGroup)

-- | Whitelist rules and their sync status
inputSecurityGroup_whitelistRules :: Lens.Lens' InputSecurityGroup (Prelude.Maybe [InputWhitelistRule])
inputSecurityGroup_whitelistRules :: (Maybe [InputWhitelistRule] -> f (Maybe [InputWhitelistRule]))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_whitelistRules = (InputSecurityGroup -> Maybe [InputWhitelistRule])
-> (InputSecurityGroup
    -> Maybe [InputWhitelistRule] -> InputSecurityGroup)
-> Lens
     InputSecurityGroup
     InputSecurityGroup
     (Maybe [InputWhitelistRule])
     (Maybe [InputWhitelistRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe [InputWhitelistRule]
whitelistRules :: Maybe [InputWhitelistRule]
$sel:whitelistRules:InputSecurityGroup' :: InputSecurityGroup -> Maybe [InputWhitelistRule]
whitelistRules} -> Maybe [InputWhitelistRule]
whitelistRules) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe [InputWhitelistRule]
a -> InputSecurityGroup
s {$sel:whitelistRules:InputSecurityGroup' :: Maybe [InputWhitelistRule]
whitelistRules = Maybe [InputWhitelistRule]
a} :: InputSecurityGroup) ((Maybe [InputWhitelistRule] -> f (Maybe [InputWhitelistRule]))
 -> InputSecurityGroup -> f InputSecurityGroup)
-> ((Maybe [InputWhitelistRule] -> f (Maybe [InputWhitelistRule]))
    -> Maybe [InputWhitelistRule] -> f (Maybe [InputWhitelistRule]))
-> (Maybe [InputWhitelistRule] -> f (Maybe [InputWhitelistRule]))
-> InputSecurityGroup
-> f InputSecurityGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InputWhitelistRule]
  [InputWhitelistRule]
  [InputWhitelistRule]
  [InputWhitelistRule]
-> Iso
     (Maybe [InputWhitelistRule])
     (Maybe [InputWhitelistRule])
     (Maybe [InputWhitelistRule])
     (Maybe [InputWhitelistRule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [InputWhitelistRule]
  [InputWhitelistRule]
  [InputWhitelistRule]
  [InputWhitelistRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A collection of key-value pairs.
inputSecurityGroup_tags :: Lens.Lens' InputSecurityGroup (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
inputSecurityGroup_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InputSecurityGroup -> f InputSecurityGroup
inputSecurityGroup_tags = (InputSecurityGroup -> Maybe (HashMap Text Text))
-> (InputSecurityGroup
    -> Maybe (HashMap Text Text) -> InputSecurityGroup)
-> Lens
     InputSecurityGroup
     InputSecurityGroup
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSecurityGroup' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:InputSecurityGroup' :: InputSecurityGroup -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: InputSecurityGroup
s@InputSecurityGroup' {} Maybe (HashMap Text Text)
a -> InputSecurityGroup
s {$sel:tags:InputSecurityGroup' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: InputSecurityGroup) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> InputSecurityGroup -> f InputSecurityGroup)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InputSecurityGroup
-> f InputSecurityGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON InputSecurityGroup where
  parseJSON :: Value -> Parser InputSecurityGroup
parseJSON =
    String
-> (Object -> Parser InputSecurityGroup)
-> Value
-> Parser InputSecurityGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputSecurityGroup"
      ( \Object
x ->
          Maybe InputSecurityGroupState
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [InputWhitelistRule]
-> Maybe (HashMap Text Text)
-> InputSecurityGroup
InputSecurityGroup'
            (Maybe InputSecurityGroupState
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe [InputWhitelistRule]
 -> Maybe (HashMap Text Text)
 -> InputSecurityGroup)
-> Parser (Maybe InputSecurityGroupState)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe [InputWhitelistRule]
      -> Maybe (HashMap Text Text)
      -> InputSecurityGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InputSecurityGroupState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe [InputWhitelistRule]
   -> Maybe (HashMap Text Text)
   -> InputSecurityGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe [InputWhitelistRule]
      -> Maybe (HashMap Text Text)
      -> InputSecurityGroup)
forall (f :: * -> *) a b. Applicative f => 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
"arn")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe [InputWhitelistRule]
   -> Maybe (HashMap Text Text)
   -> InputSecurityGroup)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe [InputWhitelistRule]
      -> Maybe (HashMap Text Text)
      -> InputSecurityGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputs" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe [InputWhitelistRule]
   -> Maybe (HashMap Text Text)
   -> InputSecurityGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe [InputWhitelistRule]
      -> Maybe (HashMap Text Text) -> InputSecurityGroup)
forall (f :: * -> *) a b. Applicative f => 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
"id")
            Parser
  (Maybe [InputWhitelistRule]
   -> Maybe (HashMap Text Text) -> InputSecurityGroup)
-> Parser (Maybe [InputWhitelistRule])
-> Parser (Maybe (HashMap Text Text) -> InputSecurityGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [InputWhitelistRule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"whitelistRules" Parser (Maybe (Maybe [InputWhitelistRule]))
-> Maybe [InputWhitelistRule]
-> Parser (Maybe [InputWhitelistRule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InputWhitelistRule]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe (HashMap Text Text) -> InputSecurityGroup)
-> Parser (Maybe (HashMap Text Text)) -> Parser InputSecurityGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable InputSecurityGroup

instance Prelude.NFData InputSecurityGroup