{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.ConnectionsList 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

-- | 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
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]
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
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. 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' {$sel:connections:ConnectionsList' :: Maybe [Text]
connections = 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 :: Lens' ConnectionsList (Maybe [Text])
connectionsList_connections = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ConnectionsList where
  parseJSON :: Value -> Parser ConnectionsList
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectionsList"
      ( \Object
x ->
          Maybe [Text] -> ConnectionsList
ConnectionsList'
            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
"Connections" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ConnectionsList where
  hashWithSalt :: Int -> ConnectionsList -> Int
hashWithSalt Int
_salt ConnectionsList' {Maybe [Text]
connections :: Maybe [Text]
$sel:connections:ConnectionsList' :: ConnectionsList -> Maybe [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
connections

instance Prelude.NFData ConnectionsList where
  rnf :: ConnectionsList -> ()
rnf ConnectionsList' {Maybe [Text]
connections :: Maybe [Text]
$sel:connections:ConnectionsList' :: ConnectionsList -> Maybe [Text]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
connections

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