{-# 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.FMS.Types.ProtocolsListData
-- 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.FMS.Types.ProtocolsListData where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An Firewall Manager protocols list.
--
-- /See:/ 'newProtocolsListData' smart constructor.
data ProtocolsListData = ProtocolsListData'
  { -- | A unique identifier for each update to the list. When you update the
    -- list, the update token must match the token of the current version of
    -- the application list. You can retrieve the update token by getting the
    -- list.
    ProtocolsListData -> Maybe Text
listUpdateToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Firewall Manager protocols list.
    ProtocolsListData -> Maybe Text
listId :: Prelude.Maybe Prelude.Text,
    -- | The time that the Firewall Manager protocols list was last updated.
    ProtocolsListData -> Maybe POSIX
lastUpdateTime :: Prelude.Maybe Core.POSIX,
    -- | A map of previous version numbers to their corresponding protocol
    -- arrays.
    ProtocolsListData -> Maybe (HashMap Text [Text])
previousProtocolsList :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The time that the Firewall Manager protocols list was created.
    ProtocolsListData -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the Firewall Manager protocols list.
    ProtocolsListData -> Text
listName :: Prelude.Text,
    -- | An array of protocols in the Firewall Manager protocols list.
    ProtocolsListData -> [Text]
protocolsList :: [Prelude.Text]
  }
  deriving (ProtocolsListData -> ProtocolsListData -> Bool
(ProtocolsListData -> ProtocolsListData -> Bool)
-> (ProtocolsListData -> ProtocolsListData -> Bool)
-> Eq ProtocolsListData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProtocolsListData -> ProtocolsListData -> Bool
$c/= :: ProtocolsListData -> ProtocolsListData -> Bool
== :: ProtocolsListData -> ProtocolsListData -> Bool
$c== :: ProtocolsListData -> ProtocolsListData -> Bool
Prelude.Eq, ReadPrec [ProtocolsListData]
ReadPrec ProtocolsListData
Int -> ReadS ProtocolsListData
ReadS [ProtocolsListData]
(Int -> ReadS ProtocolsListData)
-> ReadS [ProtocolsListData]
-> ReadPrec ProtocolsListData
-> ReadPrec [ProtocolsListData]
-> Read ProtocolsListData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProtocolsListData]
$creadListPrec :: ReadPrec [ProtocolsListData]
readPrec :: ReadPrec ProtocolsListData
$creadPrec :: ReadPrec ProtocolsListData
readList :: ReadS [ProtocolsListData]
$creadList :: ReadS [ProtocolsListData]
readsPrec :: Int -> ReadS ProtocolsListData
$creadsPrec :: Int -> ReadS ProtocolsListData
Prelude.Read, Int -> ProtocolsListData -> ShowS
[ProtocolsListData] -> ShowS
ProtocolsListData -> String
(Int -> ProtocolsListData -> ShowS)
-> (ProtocolsListData -> String)
-> ([ProtocolsListData] -> ShowS)
-> Show ProtocolsListData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProtocolsListData] -> ShowS
$cshowList :: [ProtocolsListData] -> ShowS
show :: ProtocolsListData -> String
$cshow :: ProtocolsListData -> String
showsPrec :: Int -> ProtocolsListData -> ShowS
$cshowsPrec :: Int -> ProtocolsListData -> ShowS
Prelude.Show, (forall x. ProtocolsListData -> Rep ProtocolsListData x)
-> (forall x. Rep ProtocolsListData x -> ProtocolsListData)
-> Generic ProtocolsListData
forall x. Rep ProtocolsListData x -> ProtocolsListData
forall x. ProtocolsListData -> Rep ProtocolsListData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProtocolsListData x -> ProtocolsListData
$cfrom :: forall x. ProtocolsListData -> Rep ProtocolsListData x
Prelude.Generic)

-- |
-- Create a value of 'ProtocolsListData' 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:
--
-- 'listUpdateToken', 'protocolsListData_listUpdateToken' - A unique identifier for each update to the list. When you update the
-- list, the update token must match the token of the current version of
-- the application list. You can retrieve the update token by getting the
-- list.
--
-- 'listId', 'protocolsListData_listId' - The ID of the Firewall Manager protocols list.
--
-- 'lastUpdateTime', 'protocolsListData_lastUpdateTime' - The time that the Firewall Manager protocols list was last updated.
--
-- 'previousProtocolsList', 'protocolsListData_previousProtocolsList' - A map of previous version numbers to their corresponding protocol
-- arrays.
--
-- 'createTime', 'protocolsListData_createTime' - The time that the Firewall Manager protocols list was created.
--
-- 'listName', 'protocolsListData_listName' - The name of the Firewall Manager protocols list.
--
-- 'protocolsList', 'protocolsListData_protocolsList' - An array of protocols in the Firewall Manager protocols list.
newProtocolsListData ::
  -- | 'listName'
  Prelude.Text ->
  ProtocolsListData
newProtocolsListData :: Text -> ProtocolsListData
newProtocolsListData Text
pListName_ =
  ProtocolsListData' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text [Text])
-> Maybe POSIX
-> Text
-> [Text]
-> ProtocolsListData
ProtocolsListData'
    { $sel:listUpdateToken:ProtocolsListData' :: Maybe Text
listUpdateToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:listId:ProtocolsListData' :: Maybe Text
listId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateTime:ProtocolsListData' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:previousProtocolsList:ProtocolsListData' :: Maybe (HashMap Text [Text])
previousProtocolsList = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:ProtocolsListData' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:listName:ProtocolsListData' :: Text
listName = Text
pListName_,
      $sel:protocolsList:ProtocolsListData' :: [Text]
protocolsList = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A unique identifier for each update to the list. When you update the
-- list, the update token must match the token of the current version of
-- the application list. You can retrieve the update token by getting the
-- list.
protocolsListData_listUpdateToken :: Lens.Lens' ProtocolsListData (Prelude.Maybe Prelude.Text)
protocolsListData_listUpdateToken :: (Maybe Text -> f (Maybe Text))
-> ProtocolsListData -> f ProtocolsListData
protocolsListData_listUpdateToken = (ProtocolsListData -> Maybe Text)
-> (ProtocolsListData -> Maybe Text -> ProtocolsListData)
-> Lens
     ProtocolsListData ProtocolsListData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {Maybe Text
listUpdateToken :: Maybe Text
$sel:listUpdateToken:ProtocolsListData' :: ProtocolsListData -> Maybe Text
listUpdateToken} -> Maybe Text
listUpdateToken) (\s :: ProtocolsListData
s@ProtocolsListData' {} Maybe Text
a -> ProtocolsListData
s {$sel:listUpdateToken:ProtocolsListData' :: Maybe Text
listUpdateToken = Maybe Text
a} :: ProtocolsListData)

-- | The ID of the Firewall Manager protocols list.
protocolsListData_listId :: Lens.Lens' ProtocolsListData (Prelude.Maybe Prelude.Text)
protocolsListData_listId :: (Maybe Text -> f (Maybe Text))
-> ProtocolsListData -> f ProtocolsListData
protocolsListData_listId = (ProtocolsListData -> Maybe Text)
-> (ProtocolsListData -> Maybe Text -> ProtocolsListData)
-> Lens
     ProtocolsListData ProtocolsListData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {Maybe Text
listId :: Maybe Text
$sel:listId:ProtocolsListData' :: ProtocolsListData -> Maybe Text
listId} -> Maybe Text
listId) (\s :: ProtocolsListData
s@ProtocolsListData' {} Maybe Text
a -> ProtocolsListData
s {$sel:listId:ProtocolsListData' :: Maybe Text
listId = Maybe Text
a} :: ProtocolsListData)

-- | The time that the Firewall Manager protocols list was last updated.
protocolsListData_lastUpdateTime :: Lens.Lens' ProtocolsListData (Prelude.Maybe Prelude.UTCTime)
protocolsListData_lastUpdateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProtocolsListData -> f ProtocolsListData
protocolsListData_lastUpdateTime = (ProtocolsListData -> Maybe POSIX)
-> (ProtocolsListData -> Maybe POSIX -> ProtocolsListData)
-> Lens
     ProtocolsListData ProtocolsListData (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {Maybe POSIX
lastUpdateTime :: Maybe POSIX
$sel:lastUpdateTime:ProtocolsListData' :: ProtocolsListData -> Maybe POSIX
lastUpdateTime} -> Maybe POSIX
lastUpdateTime) (\s :: ProtocolsListData
s@ProtocolsListData' {} Maybe POSIX
a -> ProtocolsListData
s {$sel:lastUpdateTime:ProtocolsListData' :: Maybe POSIX
lastUpdateTime = Maybe POSIX
a} :: ProtocolsListData) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProtocolsListData -> f ProtocolsListData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProtocolsListData
-> f ProtocolsListData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A map of previous version numbers to their corresponding protocol
-- arrays.
protocolsListData_previousProtocolsList :: Lens.Lens' ProtocolsListData (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
protocolsListData_previousProtocolsList :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> ProtocolsListData -> f ProtocolsListData
protocolsListData_previousProtocolsList = (ProtocolsListData -> Maybe (HashMap Text [Text]))
-> (ProtocolsListData
    -> Maybe (HashMap Text [Text]) -> ProtocolsListData)
-> Lens
     ProtocolsListData
     ProtocolsListData
     (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 (\ProtocolsListData' {Maybe (HashMap Text [Text])
previousProtocolsList :: Maybe (HashMap Text [Text])
$sel:previousProtocolsList:ProtocolsListData' :: ProtocolsListData -> Maybe (HashMap Text [Text])
previousProtocolsList} -> Maybe (HashMap Text [Text])
previousProtocolsList) (\s :: ProtocolsListData
s@ProtocolsListData' {} Maybe (HashMap Text [Text])
a -> ProtocolsListData
s {$sel:previousProtocolsList:ProtocolsListData' :: Maybe (HashMap Text [Text])
previousProtocolsList = Maybe (HashMap Text [Text])
a} :: ProtocolsListData) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> ProtocolsListData -> f ProtocolsListData)
-> ((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])))
-> ProtocolsListData
-> f ProtocolsListData
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

-- | The time that the Firewall Manager protocols list was created.
protocolsListData_createTime :: Lens.Lens' ProtocolsListData (Prelude.Maybe Prelude.UTCTime)
protocolsListData_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProtocolsListData -> f ProtocolsListData
protocolsListData_createTime = (ProtocolsListData -> Maybe POSIX)
-> (ProtocolsListData -> Maybe POSIX -> ProtocolsListData)
-> Lens
     ProtocolsListData ProtocolsListData (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:ProtocolsListData' :: ProtocolsListData -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: ProtocolsListData
s@ProtocolsListData' {} Maybe POSIX
a -> ProtocolsListData
s {$sel:createTime:ProtocolsListData' :: Maybe POSIX
createTime = Maybe POSIX
a} :: ProtocolsListData) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProtocolsListData -> f ProtocolsListData)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProtocolsListData
-> f ProtocolsListData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the Firewall Manager protocols list.
protocolsListData_listName :: Lens.Lens' ProtocolsListData Prelude.Text
protocolsListData_listName :: (Text -> f Text) -> ProtocolsListData -> f ProtocolsListData
protocolsListData_listName = (ProtocolsListData -> Text)
-> (ProtocolsListData -> Text -> ProtocolsListData)
-> Lens ProtocolsListData ProtocolsListData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {Text
listName :: Text
$sel:listName:ProtocolsListData' :: ProtocolsListData -> Text
listName} -> Text
listName) (\s :: ProtocolsListData
s@ProtocolsListData' {} Text
a -> ProtocolsListData
s {$sel:listName:ProtocolsListData' :: Text
listName = Text
a} :: ProtocolsListData)

-- | An array of protocols in the Firewall Manager protocols list.
protocolsListData_protocolsList :: Lens.Lens' ProtocolsListData [Prelude.Text]
protocolsListData_protocolsList :: ([Text] -> f [Text]) -> ProtocolsListData -> f ProtocolsListData
protocolsListData_protocolsList = (ProtocolsListData -> [Text])
-> (ProtocolsListData -> [Text] -> ProtocolsListData)
-> Lens ProtocolsListData ProtocolsListData [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProtocolsListData' {[Text]
protocolsList :: [Text]
$sel:protocolsList:ProtocolsListData' :: ProtocolsListData -> [Text]
protocolsList} -> [Text]
protocolsList) (\s :: ProtocolsListData
s@ProtocolsListData' {} [Text]
a -> ProtocolsListData
s {$sel:protocolsList:ProtocolsListData' :: [Text]
protocolsList = [Text]
a} :: ProtocolsListData) (([Text] -> f [Text]) -> ProtocolsListData -> f ProtocolsListData)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ProtocolsListData
-> f ProtocolsListData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ProtocolsListData where
  parseJSON :: Value -> Parser ProtocolsListData
parseJSON =
    String
-> (Object -> Parser ProtocolsListData)
-> Value
-> Parser ProtocolsListData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProtocolsListData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text [Text])
-> Maybe POSIX
-> Text
-> [Text]
-> ProtocolsListData
ProtocolsListData'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe (HashMap Text [Text])
 -> Maybe POSIX
 -> Text
 -> [Text]
 -> ProtocolsListData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text [Text])
      -> Maybe POSIX
      -> Text
      -> [Text]
      -> ProtocolsListData)
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
"ListUpdateToken")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text [Text])
   -> Maybe POSIX
   -> Text
   -> [Text]
   -> ProtocolsListData)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe (HashMap Text [Text])
      -> Maybe POSIX
      -> Text
      -> [Text]
      -> ProtocolsListData)
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
"ListId")
            Parser
  (Maybe POSIX
   -> Maybe (HashMap Text [Text])
   -> Maybe POSIX
   -> Text
   -> [Text]
   -> ProtocolsListData)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe (HashMap Text [Text])
      -> Maybe POSIX -> Text -> [Text] -> ProtocolsListData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdateTime")
            Parser
  (Maybe (HashMap Text [Text])
   -> Maybe POSIX -> Text -> [Text] -> ProtocolsListData)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (Maybe POSIX -> Text -> [Text] -> ProtocolsListData)
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
"PreviousProtocolsList"
                            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
                        )
            Parser (Maybe POSIX -> Text -> [Text] -> ProtocolsListData)
-> Parser (Maybe POSIX)
-> Parser (Text -> [Text] -> ProtocolsListData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreateTime")
            Parser (Text -> [Text] -> ProtocolsListData)
-> Parser Text -> Parser ([Text] -> ProtocolsListData)
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
"ListName")
            Parser ([Text] -> ProtocolsListData)
-> Parser [Text] -> Parser ProtocolsListData
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
"ProtocolsList" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ProtocolsListData

instance Prelude.NFData ProtocolsListData

instance Core.ToJSON ProtocolsListData where
  toJSON :: ProtocolsListData -> Value
toJSON ProtocolsListData' {[Text]
Maybe Text
Maybe (HashMap Text [Text])
Maybe POSIX
Text
protocolsList :: [Text]
listName :: Text
createTime :: Maybe POSIX
previousProtocolsList :: Maybe (HashMap Text [Text])
lastUpdateTime :: Maybe POSIX
listId :: Maybe Text
listUpdateToken :: Maybe Text
$sel:protocolsList:ProtocolsListData' :: ProtocolsListData -> [Text]
$sel:listName:ProtocolsListData' :: ProtocolsListData -> Text
$sel:createTime:ProtocolsListData' :: ProtocolsListData -> Maybe POSIX
$sel:previousProtocolsList:ProtocolsListData' :: ProtocolsListData -> Maybe (HashMap Text [Text])
$sel:lastUpdateTime:ProtocolsListData' :: ProtocolsListData -> Maybe POSIX
$sel:listId:ProtocolsListData' :: ProtocolsListData -> Maybe Text
$sel:listUpdateToken:ProtocolsListData' :: ProtocolsListData -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ListUpdateToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
listUpdateToken,
            (Text
"ListId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
listId,
            (Text
"LastUpdateTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
lastUpdateTime,
            (Text
"PreviousProtocolsList" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
previousProtocolsList,
            (Text
"CreateTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
createTime,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ListName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ProtocolsList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
protocolsList)
          ]
      )