{-# 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.Glue.Types.ConnectionsList
-- 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.Glue.Types.ConnectionsList where

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

-- | Specifies the connections used by a job.
--
-- /See:/ 'newConnectionsList' smart constructor.
data ConnectionsList = ConnectionsList'
  { -- | A list of connections used by the job.
    ConnectionsList -> Maybe [Text]
connections :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ConnectionsList -> ConnectionsList -> Bool
(ConnectionsList -> ConnectionsList -> Bool)
-> (ConnectionsList -> ConnectionsList -> Bool)
-> Eq ConnectionsList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionsList -> ConnectionsList -> Bool
$c/= :: ConnectionsList -> ConnectionsList -> Bool
== :: ConnectionsList -> ConnectionsList -> Bool
$c== :: ConnectionsList -> ConnectionsList -> Bool
Prelude.Eq, ReadPrec [ConnectionsList]
ReadPrec ConnectionsList
Int -> ReadS ConnectionsList
ReadS [ConnectionsList]
(Int -> ReadS ConnectionsList)
-> ReadS [ConnectionsList]
-> ReadPrec ConnectionsList
-> ReadPrec [ConnectionsList]
-> Read ConnectionsList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionsList]
$creadListPrec :: ReadPrec [ConnectionsList]
readPrec :: ReadPrec ConnectionsList
$creadPrec :: ReadPrec ConnectionsList
readList :: ReadS [ConnectionsList]
$creadList :: ReadS [ConnectionsList]
readsPrec :: Int -> ReadS ConnectionsList
$creadsPrec :: Int -> ReadS ConnectionsList
Prelude.Read, Int -> ConnectionsList -> ShowS
[ConnectionsList] -> ShowS
ConnectionsList -> String
(Int -> ConnectionsList -> ShowS)
-> (ConnectionsList -> String)
-> ([ConnectionsList] -> ShowS)
-> Show ConnectionsList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionsList] -> ShowS
$cshowList :: [ConnectionsList] -> ShowS
show :: ConnectionsList -> String
$cshow :: ConnectionsList -> String
showsPrec :: Int -> ConnectionsList -> ShowS
$cshowsPrec :: Int -> ConnectionsList -> ShowS
Prelude.Show, (forall x. ConnectionsList -> Rep ConnectionsList x)
-> (forall x. Rep ConnectionsList x -> ConnectionsList)
-> Generic ConnectionsList
forall x. Rep ConnectionsList x -> ConnectionsList
forall x. ConnectionsList -> Rep ConnectionsList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionsList x -> ConnectionsList
$cfrom :: forall x. ConnectionsList -> Rep ConnectionsList x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionsList' 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:
--
-- 'connections', 'connectionsList_connections' - A list of connections used by the job.
newConnectionsList ::
  ConnectionsList
newConnectionsList :: ConnectionsList
newConnectionsList =
  ConnectionsList' :: Maybe [Text] -> ConnectionsList
ConnectionsList' {$sel:connections:ConnectionsList' :: Maybe [Text]
connections = Maybe [Text]
forall a. Maybe a
Prelude.Nothing}

-- | A list of connections used by the job.
connectionsList_connections :: Lens.Lens' ConnectionsList (Prelude.Maybe [Prelude.Text])
connectionsList_connections :: (Maybe [Text] -> f (Maybe [Text]))
-> ConnectionsList -> f ConnectionsList
connectionsList_connections = (ConnectionsList -> Maybe [Text])
-> (ConnectionsList -> Maybe [Text] -> ConnectionsList)
-> Lens
     ConnectionsList ConnectionsList (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionsList' {Maybe [Text]
connections :: Maybe [Text]
$sel:connections:ConnectionsList' :: ConnectionsList -> Maybe [Text]
connections} -> Maybe [Text]
connections) (\s :: ConnectionsList
s@ConnectionsList' {} Maybe [Text]
a -> ConnectionsList
s {$sel:connections:ConnectionsList' :: Maybe [Text]
connections = Maybe [Text]
a} :: ConnectionsList) ((Maybe [Text] -> f (Maybe [Text]))
 -> ConnectionsList -> f ConnectionsList)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ConnectionsList
-> f ConnectionsList
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

instance Core.FromJSON ConnectionsList where
  parseJSON :: Value -> Parser ConnectionsList
parseJSON =
    String
-> (Object -> Parser ConnectionsList)
-> Value
-> Parser ConnectionsList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionsList"
      ( \Object
x ->
          Maybe [Text] -> ConnectionsList
ConnectionsList'
            (Maybe [Text] -> ConnectionsList)
-> Parser (Maybe [Text]) -> Parser ConnectionsList
forall (f :: * -> *) a b. Functor 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
"Connections" 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)
      )

instance Prelude.Hashable ConnectionsList

instance Prelude.NFData ConnectionsList

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