{-# 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.NetworkManager.Types.GlobalNetwork
-- 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.NetworkManager.Types.GlobalNetwork where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types.GlobalNetworkState
import Amazonka.NetworkManager.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a global network.
--
-- /See:/ 'newGlobalNetwork' smart constructor.
data GlobalNetwork = GlobalNetwork'
  { -- | The state of the global network.
    GlobalNetwork -> Maybe GlobalNetworkState
state :: Prelude.Maybe GlobalNetworkState,
    -- | The date and time that the global network was created.
    GlobalNetwork -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the global network.
    GlobalNetwork -> Maybe Text
globalNetworkArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the global network.
    GlobalNetwork -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The description of the global network.
    GlobalNetwork -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags for the global network.
    GlobalNetwork -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (GlobalNetwork -> GlobalNetwork -> Bool
(GlobalNetwork -> GlobalNetwork -> Bool)
-> (GlobalNetwork -> GlobalNetwork -> Bool) -> Eq GlobalNetwork
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlobalNetwork -> GlobalNetwork -> Bool
$c/= :: GlobalNetwork -> GlobalNetwork -> Bool
== :: GlobalNetwork -> GlobalNetwork -> Bool
$c== :: GlobalNetwork -> GlobalNetwork -> Bool
Prelude.Eq, ReadPrec [GlobalNetwork]
ReadPrec GlobalNetwork
Int -> ReadS GlobalNetwork
ReadS [GlobalNetwork]
(Int -> ReadS GlobalNetwork)
-> ReadS [GlobalNetwork]
-> ReadPrec GlobalNetwork
-> ReadPrec [GlobalNetwork]
-> Read GlobalNetwork
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GlobalNetwork]
$creadListPrec :: ReadPrec [GlobalNetwork]
readPrec :: ReadPrec GlobalNetwork
$creadPrec :: ReadPrec GlobalNetwork
readList :: ReadS [GlobalNetwork]
$creadList :: ReadS [GlobalNetwork]
readsPrec :: Int -> ReadS GlobalNetwork
$creadsPrec :: Int -> ReadS GlobalNetwork
Prelude.Read, Int -> GlobalNetwork -> ShowS
[GlobalNetwork] -> ShowS
GlobalNetwork -> String
(Int -> GlobalNetwork -> ShowS)
-> (GlobalNetwork -> String)
-> ([GlobalNetwork] -> ShowS)
-> Show GlobalNetwork
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GlobalNetwork] -> ShowS
$cshowList :: [GlobalNetwork] -> ShowS
show :: GlobalNetwork -> String
$cshow :: GlobalNetwork -> String
showsPrec :: Int -> GlobalNetwork -> ShowS
$cshowsPrec :: Int -> GlobalNetwork -> ShowS
Prelude.Show, (forall x. GlobalNetwork -> Rep GlobalNetwork x)
-> (forall x. Rep GlobalNetwork x -> GlobalNetwork)
-> Generic GlobalNetwork
forall x. Rep GlobalNetwork x -> GlobalNetwork
forall x. GlobalNetwork -> Rep GlobalNetwork x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GlobalNetwork x -> GlobalNetwork
$cfrom :: forall x. GlobalNetwork -> Rep GlobalNetwork x
Prelude.Generic)

-- |
-- Create a value of 'GlobalNetwork' 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:
--
-- 'state', 'globalNetwork_state' - The state of the global network.
--
-- 'createdAt', 'globalNetwork_createdAt' - The date and time that the global network was created.
--
-- 'globalNetworkArn', 'globalNetwork_globalNetworkArn' - The Amazon Resource Name (ARN) of the global network.
--
-- 'globalNetworkId', 'globalNetwork_globalNetworkId' - The ID of the global network.
--
-- 'description', 'globalNetwork_description' - The description of the global network.
--
-- 'tags', 'globalNetwork_tags' - The tags for the global network.
newGlobalNetwork ::
  GlobalNetwork
newGlobalNetwork :: GlobalNetwork
newGlobalNetwork =
  GlobalNetwork' :: Maybe GlobalNetworkState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> GlobalNetwork
GlobalNetwork'
    { $sel:state:GlobalNetwork' :: Maybe GlobalNetworkState
state = Maybe GlobalNetworkState
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:GlobalNetwork' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkArn:GlobalNetwork' :: Maybe Text
globalNetworkArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GlobalNetwork' :: Maybe Text
globalNetworkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:GlobalNetwork' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:GlobalNetwork' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the global network.
globalNetwork_state :: Lens.Lens' GlobalNetwork (Prelude.Maybe GlobalNetworkState)
globalNetwork_state :: (Maybe GlobalNetworkState -> f (Maybe GlobalNetworkState))
-> GlobalNetwork -> f GlobalNetwork
globalNetwork_state = (GlobalNetwork -> Maybe GlobalNetworkState)
-> (GlobalNetwork -> Maybe GlobalNetworkState -> GlobalNetwork)
-> Lens
     GlobalNetwork
     GlobalNetwork
     (Maybe GlobalNetworkState)
     (Maybe GlobalNetworkState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalNetwork' {Maybe GlobalNetworkState
state :: Maybe GlobalNetworkState
$sel:state:GlobalNetwork' :: GlobalNetwork -> Maybe GlobalNetworkState
state} -> Maybe GlobalNetworkState
state) (\s :: GlobalNetwork
s@GlobalNetwork' {} Maybe GlobalNetworkState
a -> GlobalNetwork
s {$sel:state:GlobalNetwork' :: Maybe GlobalNetworkState
state = Maybe GlobalNetworkState
a} :: GlobalNetwork)

-- | The date and time that the global network was created.
globalNetwork_createdAt :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.UTCTime)
globalNetwork_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GlobalNetwork -> f GlobalNetwork
globalNetwork_createdAt = (GlobalNetwork -> Maybe POSIX)
-> (GlobalNetwork -> Maybe POSIX -> GlobalNetwork)
-> Lens GlobalNetwork GlobalNetwork (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalNetwork' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:GlobalNetwork' :: GlobalNetwork -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: GlobalNetwork
s@GlobalNetwork' {} Maybe POSIX
a -> GlobalNetwork
s {$sel:createdAt:GlobalNetwork' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: GlobalNetwork) ((Maybe POSIX -> f (Maybe POSIX))
 -> GlobalNetwork -> f GlobalNetwork)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GlobalNetwork
-> f GlobalNetwork
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the global network.
globalNetwork_globalNetworkArn :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.Text)
globalNetwork_globalNetworkArn :: (Maybe Text -> f (Maybe Text)) -> GlobalNetwork -> f GlobalNetwork
globalNetwork_globalNetworkArn = (GlobalNetwork -> Maybe Text)
-> (GlobalNetwork -> Maybe Text -> GlobalNetwork)
-> Lens GlobalNetwork GlobalNetwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalNetwork' {Maybe Text
globalNetworkArn :: Maybe Text
$sel:globalNetworkArn:GlobalNetwork' :: GlobalNetwork -> Maybe Text
globalNetworkArn} -> Maybe Text
globalNetworkArn) (\s :: GlobalNetwork
s@GlobalNetwork' {} Maybe Text
a -> GlobalNetwork
s {$sel:globalNetworkArn:GlobalNetwork' :: Maybe Text
globalNetworkArn = Maybe Text
a} :: GlobalNetwork)

-- | The ID of the global network.
globalNetwork_globalNetworkId :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.Text)
globalNetwork_globalNetworkId :: (Maybe Text -> f (Maybe Text)) -> GlobalNetwork -> f GlobalNetwork
globalNetwork_globalNetworkId = (GlobalNetwork -> Maybe Text)
-> (GlobalNetwork -> Maybe Text -> GlobalNetwork)
-> Lens GlobalNetwork GlobalNetwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalNetwork' {Maybe Text
globalNetworkId :: Maybe Text
$sel:globalNetworkId:GlobalNetwork' :: GlobalNetwork -> Maybe Text
globalNetworkId} -> Maybe Text
globalNetworkId) (\s :: GlobalNetwork
s@GlobalNetwork' {} Maybe Text
a -> GlobalNetwork
s {$sel:globalNetworkId:GlobalNetwork' :: Maybe Text
globalNetworkId = Maybe Text
a} :: GlobalNetwork)

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

-- | The tags for the global network.
globalNetwork_tags :: Lens.Lens' GlobalNetwork (Prelude.Maybe [Tag])
globalNetwork_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> GlobalNetwork -> f GlobalNetwork
globalNetwork_tags = (GlobalNetwork -> Maybe [Tag])
-> (GlobalNetwork -> Maybe [Tag] -> GlobalNetwork)
-> Lens GlobalNetwork GlobalNetwork (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalNetwork' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:GlobalNetwork' :: GlobalNetwork -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: GlobalNetwork
s@GlobalNetwork' {} Maybe [Tag]
a -> GlobalNetwork
s {$sel:tags:GlobalNetwork' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: GlobalNetwork) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> GlobalNetwork -> f GlobalNetwork)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> GlobalNetwork
-> f GlobalNetwork
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON GlobalNetwork where
  parseJSON :: Value -> Parser GlobalNetwork
parseJSON =
    String
-> (Object -> Parser GlobalNetwork)
-> Value
-> Parser GlobalNetwork
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GlobalNetwork"
      ( \Object
x ->
          Maybe GlobalNetworkState
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> GlobalNetwork
GlobalNetwork'
            (Maybe GlobalNetworkState
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Tag]
 -> GlobalNetwork)
-> Parser (Maybe GlobalNetworkState)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> GlobalNetwork)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GlobalNetworkState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> GlobalNetwork)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe [Tag] -> GlobalNetwork)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedAt")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe [Tag] -> GlobalNetwork)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe [Tag] -> GlobalNetwork)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GlobalNetworkArn")
            Parser (Maybe Text -> Maybe Text -> Maybe [Tag] -> GlobalNetwork)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Tag] -> GlobalNetwork)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GlobalNetworkId")
            Parser (Maybe Text -> Maybe [Tag] -> GlobalNetwork)
-> Parser (Maybe Text) -> Parser (Maybe [Tag] -> GlobalNetwork)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser (Maybe [Tag] -> GlobalNetwork)
-> Parser (Maybe [Tag]) -> Parser GlobalNetwork
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe [Tag])) -> Maybe [Tag] -> Parser (Maybe [Tag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GlobalNetwork

instance Prelude.NFData GlobalNetwork