{-# 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.PrivateNetworks.Types.Network
-- 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.PrivateNetworks.Types.Network 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
import Amazonka.PrivateNetworks.Types.NetworkStatus

-- | Information about a network.
--
-- /See:/ 'newNetwork' smart constructor.
data Network = Network'
  { -- | The creation time of the network.
    Network -> Maybe ISO8601
createdAt :: Prelude.Maybe Data.ISO8601,
    -- | The description of the network.
    Network -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The status reason of the network.
    Network -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the network.
    Network -> Text
networkArn :: Prelude.Text,
    -- | The name of the network.
    Network -> Text
networkName :: Prelude.Text,
    -- | The status of the network.
    Network -> NetworkStatus
status :: NetworkStatus
  }
  deriving (Network -> Network -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Network -> Network -> Bool
$c/= :: Network -> Network -> Bool
== :: Network -> Network -> Bool
$c== :: Network -> Network -> Bool
Prelude.Eq, ReadPrec [Network]
ReadPrec Network
Int -> ReadS Network
ReadS [Network]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Network]
$creadListPrec :: ReadPrec [Network]
readPrec :: ReadPrec Network
$creadPrec :: ReadPrec Network
readList :: ReadS [Network]
$creadList :: ReadS [Network]
readsPrec :: Int -> ReadS Network
$creadsPrec :: Int -> ReadS Network
Prelude.Read, Int -> Network -> ShowS
[Network] -> ShowS
Network -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Network] -> ShowS
$cshowList :: [Network] -> ShowS
show :: Network -> String
$cshow :: Network -> String
showsPrec :: Int -> Network -> ShowS
$cshowsPrec :: Int -> Network -> ShowS
Prelude.Show, forall x. Rep Network x -> Network
forall x. Network -> Rep Network x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Network x -> Network
$cfrom :: forall x. Network -> Rep Network x
Prelude.Generic)

-- |
-- Create a value of 'Network' 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:
--
-- 'createdAt', 'network_createdAt' - The creation time of the network.
--
-- 'description', 'network_description' - The description of the network.
--
-- 'statusReason', 'network_statusReason' - The status reason of the network.
--
-- 'networkArn', 'network_networkArn' - The Amazon Resource Name (ARN) of the network.
--
-- 'networkName', 'network_networkName' - The name of the network.
--
-- 'status', 'network_status' - The status of the network.
newNetwork ::
  -- | 'networkArn'
  Prelude.Text ->
  -- | 'networkName'
  Prelude.Text ->
  -- | 'status'
  NetworkStatus ->
  Network
newNetwork :: Text -> Text -> NetworkStatus -> Network
newNetwork Text
pNetworkArn_ Text
pNetworkName_ NetworkStatus
pStatus_ =
  Network'
    { $sel:createdAt:Network' :: Maybe ISO8601
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Network' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:Network' :: Maybe Text
statusReason = forall a. Maybe a
Prelude.Nothing,
      $sel:networkArn:Network' :: Text
networkArn = Text
pNetworkArn_,
      $sel:networkName:Network' :: Text
networkName = Text
pNetworkName_,
      $sel:status:Network' :: NetworkStatus
status = NetworkStatus
pStatus_
    }

-- | The creation time of the network.
network_createdAt :: Lens.Lens' Network (Prelude.Maybe Prelude.UTCTime)
network_createdAt :: Lens' Network (Maybe UTCTime)
network_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:Network' :: Network -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: Network
s@Network' {} Maybe ISO8601
a -> Network
s {$sel:createdAt:Network' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: Network) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the network.
network_description :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_description :: Lens' Network (Maybe Text)
network_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
description :: Maybe Text
$sel:description:Network' :: Network -> Maybe Text
description} -> Maybe Text
description) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:description:Network' :: Maybe Text
description = Maybe Text
a} :: Network)

-- | The status reason of the network.
network_statusReason :: Lens.Lens' Network (Prelude.Maybe Prelude.Text)
network_statusReason :: Lens' Network (Maybe Text)
network_statusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:Network' :: Network -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: Network
s@Network' {} Maybe Text
a -> Network
s {$sel:statusReason:Network' :: Maybe Text
statusReason = Maybe Text
a} :: Network)

-- | The Amazon Resource Name (ARN) of the network.
network_networkArn :: Lens.Lens' Network Prelude.Text
network_networkArn :: Lens' Network Text
network_networkArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Text
networkArn :: Text
$sel:networkArn:Network' :: Network -> Text
networkArn} -> Text
networkArn) (\s :: Network
s@Network' {} Text
a -> Network
s {$sel:networkArn:Network' :: Text
networkArn = Text
a} :: Network)

-- | The name of the network.
network_networkName :: Lens.Lens' Network Prelude.Text
network_networkName :: Lens' Network Text
network_networkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {Text
networkName :: Text
$sel:networkName:Network' :: Network -> Text
networkName} -> Text
networkName) (\s :: Network
s@Network' {} Text
a -> Network
s {$sel:networkName:Network' :: Text
networkName = Text
a} :: Network)

-- | The status of the network.
network_status :: Lens.Lens' Network NetworkStatus
network_status :: Lens' Network NetworkStatus
network_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Network' {NetworkStatus
status :: NetworkStatus
$sel:status:Network' :: Network -> NetworkStatus
status} -> NetworkStatus
status) (\s :: Network
s@Network' {} NetworkStatus
a -> Network
s {$sel:status:Network' :: NetworkStatus
status = NetworkStatus
a} :: Network)

instance Data.FromJSON Network where
  parseJSON :: Value -> Parser Network
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Network"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> NetworkStatus
-> Network
Network'
            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
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"statusReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"networkArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"networkName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
      )

instance Prelude.Hashable Network where
  hashWithSalt :: Int -> Network -> Int
hashWithSalt Int
_salt Network' {Maybe Text
Maybe ISO8601
Text
NetworkStatus
status :: NetworkStatus
networkName :: Text
networkArn :: Text
statusReason :: Maybe Text
description :: Maybe Text
createdAt :: Maybe ISO8601
$sel:status:Network' :: Network -> NetworkStatus
$sel:networkName:Network' :: Network -> Text
$sel:networkArn:Network' :: Network -> Text
$sel:statusReason:Network' :: Network -> Maybe Text
$sel:description:Network' :: Network -> Maybe Text
$sel:createdAt:Network' :: Network -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NetworkStatus
status

instance Prelude.NFData Network where
  rnf :: Network -> ()
rnf Network' {Maybe Text
Maybe ISO8601
Text
NetworkStatus
status :: NetworkStatus
networkName :: Text
networkArn :: Text
statusReason :: Maybe Text
description :: Maybe Text
createdAt :: Maybe ISO8601
$sel:status:Network' :: Network -> NetworkStatus
$sel:networkName:Network' :: Network -> Text
$sel:networkArn:Network' :: Network -> Text
$sel:statusReason:Network' :: Network -> Maybe Text
$sel:description:Network' :: Network -> Maybe Text
$sel:createdAt:Network' :: Network -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
networkArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
networkName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NetworkStatus
status