{-# 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.DirectConnect.Types.Connections
-- 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.DirectConnect.Types.Connections where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types.Connection
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newConnections' smart constructor.
data Connections = Connections'
  { -- | The connections.
    Connections -> Maybe [Connection]
connections :: Prelude.Maybe [Connection]
  }
  deriving (Connections -> Connections -> Bool
(Connections -> Connections -> Bool)
-> (Connections -> Connections -> Bool) -> Eq Connections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Connections -> Connections -> Bool
$c/= :: Connections -> Connections -> Bool
== :: Connections -> Connections -> Bool
$c== :: Connections -> Connections -> Bool
Prelude.Eq, ReadPrec [Connections]
ReadPrec Connections
Int -> ReadS Connections
ReadS [Connections]
(Int -> ReadS Connections)
-> ReadS [Connections]
-> ReadPrec Connections
-> ReadPrec [Connections]
-> Read Connections
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Connections]
$creadListPrec :: ReadPrec [Connections]
readPrec :: ReadPrec Connections
$creadPrec :: ReadPrec Connections
readList :: ReadS [Connections]
$creadList :: ReadS [Connections]
readsPrec :: Int -> ReadS Connections
$creadsPrec :: Int -> ReadS Connections
Prelude.Read, Int -> Connections -> ShowS
[Connections] -> ShowS
Connections -> String
(Int -> Connections -> ShowS)
-> (Connections -> String)
-> ([Connections] -> ShowS)
-> Show Connections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Connections] -> ShowS
$cshowList :: [Connections] -> ShowS
show :: Connections -> String
$cshow :: Connections -> String
showsPrec :: Int -> Connections -> ShowS
$cshowsPrec :: Int -> Connections -> ShowS
Prelude.Show, (forall x. Connections -> Rep Connections x)
-> (forall x. Rep Connections x -> Connections)
-> Generic Connections
forall x. Rep Connections x -> Connections
forall x. Connections -> Rep Connections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Connections x -> Connections
$cfrom :: forall x. Connections -> Rep Connections x
Prelude.Generic)

-- |
-- Create a value of 'Connections' 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', 'connections_connections' - The connections.
newConnections ::
  Connections
newConnections :: Connections
newConnections =
  Connections' :: Maybe [Connection] -> Connections
Connections' {$sel:connections:Connections' :: Maybe [Connection]
connections = Maybe [Connection]
forall a. Maybe a
Prelude.Nothing}

-- | The connections.
connections_connections :: Lens.Lens' Connections (Prelude.Maybe [Connection])
connections_connections :: (Maybe [Connection] -> f (Maybe [Connection]))
-> Connections -> f Connections
connections_connections = (Connections -> Maybe [Connection])
-> (Connections -> Maybe [Connection] -> Connections)
-> Lens
     Connections Connections (Maybe [Connection]) (Maybe [Connection])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Connections' {Maybe [Connection]
connections :: Maybe [Connection]
$sel:connections:Connections' :: Connections -> Maybe [Connection]
connections} -> Maybe [Connection]
connections) (\s :: Connections
s@Connections' {} Maybe [Connection]
a -> Connections
s {$sel:connections:Connections' :: Maybe [Connection]
connections = Maybe [Connection]
a} :: Connections) ((Maybe [Connection] -> f (Maybe [Connection]))
 -> Connections -> f Connections)
-> ((Maybe [Connection] -> f (Maybe [Connection]))
    -> Maybe [Connection] -> f (Maybe [Connection]))
-> (Maybe [Connection] -> f (Maybe [Connection]))
-> Connections
-> f Connections
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Connection] [Connection] [Connection] [Connection]
-> Iso
     (Maybe [Connection])
     (Maybe [Connection])
     (Maybe [Connection])
     (Maybe [Connection])
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 [Connection] [Connection] [Connection] [Connection]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Connections where
  parseJSON :: Value -> Parser Connections
parseJSON =
    String
-> (Object -> Parser Connections) -> Value -> Parser Connections
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Connections"
      ( \Object
x ->
          Maybe [Connection] -> Connections
Connections'
            (Maybe [Connection] -> Connections)
-> Parser (Maybe [Connection]) -> Parser Connections
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Connection]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"connections" Parser (Maybe (Maybe [Connection]))
-> Maybe [Connection] -> Parser (Maybe [Connection])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Connection]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Connections

instance Prelude.NFData Connections