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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types.Connection
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
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]
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
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. 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' {$sel:connections:Connections' :: Maybe [Connection]
connections = forall a. Maybe a
Prelude.Nothing}

-- | The connections.
connections_connections :: Lens.Lens' Connections (Prelude.Maybe [Connection])
connections_connections :: Lens' Connections (Maybe [Connection])
connections_connections = 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) 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 Connections where
  parseJSON :: Value -> Parser Connections
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Connections"
      ( \Object
x ->
          Maybe [Connection] -> Connections
Connections'
            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 Connections where
  hashWithSalt :: Int -> Connections -> Int
hashWithSalt Int
_salt Connections' {Maybe [Connection]
connections :: Maybe [Connection]
$sel:connections:Connections' :: Connections -> Maybe [Connection]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Connection]
connections

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