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

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

-- | Describes a global network. This is a single private network acting as a
-- high-level container for your network objects, including an Amazon Web
-- Services-managed Core Network.
--
-- /See:/ 'newGlobalNetwork' smart constructor.
data GlobalNetwork = GlobalNetwork'
  { -- | The date and time that the global network was created.
    GlobalNetwork -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The description of the global network.
    GlobalNetwork -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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 state of the global network.
    GlobalNetwork -> Maybe GlobalNetworkState
state :: Prelude.Maybe GlobalNetworkState,
    -- | The tags for the global network.
    GlobalNetwork -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (GlobalNetwork -> GlobalNetwork -> Bool
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]
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
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. 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:
--
-- 'createdAt', 'globalNetwork_createdAt' - The date and time that the global network was created.
--
-- 'description', 'globalNetwork_description' - The description of the global network.
--
-- 'globalNetworkArn', 'globalNetwork_globalNetworkArn' - The Amazon Resource Name (ARN) of the global network.
--
-- 'globalNetworkId', 'globalNetwork_globalNetworkId' - The ID of the global network.
--
-- 'state', 'globalNetwork_state' - The state of the global network.
--
-- 'tags', 'globalNetwork_tags' - The tags for the global network.
newGlobalNetwork ::
  GlobalNetwork
newGlobalNetwork :: GlobalNetwork
newGlobalNetwork =
  GlobalNetwork'
    { $sel:createdAt:GlobalNetwork' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:description:GlobalNetwork' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkArn:GlobalNetwork' :: Maybe Text
globalNetworkArn = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GlobalNetwork' :: Maybe Text
globalNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:GlobalNetwork' :: Maybe GlobalNetworkState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:GlobalNetwork' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that the global network was created.
globalNetwork_createdAt :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.UTCTime)
globalNetwork_createdAt :: Lens' GlobalNetwork (Maybe UTCTime)
globalNetwork_createdAt = 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) 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 global network.
globalNetwork_description :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.Text)
globalNetwork_description :: Lens' GlobalNetwork (Maybe Text)
globalNetwork_description = 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 Amazon Resource Name (ARN) of the global network.
globalNetwork_globalNetworkArn :: Lens.Lens' GlobalNetwork (Prelude.Maybe Prelude.Text)
globalNetwork_globalNetworkArn :: Lens' GlobalNetwork (Maybe Text)
globalNetwork_globalNetworkArn = 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 :: Lens' GlobalNetwork (Maybe Text)
globalNetwork_globalNetworkId = 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 state of the global network.
globalNetwork_state :: Lens.Lens' GlobalNetwork (Prelude.Maybe GlobalNetworkState)
globalNetwork_state :: Lens' GlobalNetwork (Maybe GlobalNetworkState)
globalNetwork_state = 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 tags for the global network.
globalNetwork_tags :: Lens.Lens' GlobalNetwork (Prelude.Maybe [Tag])
globalNetwork_tags :: Lens' GlobalNetwork (Maybe [Tag])
globalNetwork_tags = 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) 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 GlobalNetwork where
  parseJSON :: Value -> Parser GlobalNetwork
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GlobalNetwork"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe GlobalNetworkState
-> Maybe [Tag]
-> GlobalNetwork
GlobalNetwork'
            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
"GlobalNetworkArn")
            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
"GlobalNetworkId")
            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
"State")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GlobalNetwork where
  hashWithSalt :: Int -> GlobalNetwork -> Int
hashWithSalt Int
_salt GlobalNetwork' {Maybe [Tag]
Maybe Text
Maybe POSIX
Maybe GlobalNetworkState
tags :: Maybe [Tag]
state :: Maybe GlobalNetworkState
globalNetworkId :: Maybe Text
globalNetworkArn :: Maybe Text
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tags:GlobalNetwork' :: GlobalNetwork -> Maybe [Tag]
$sel:state:GlobalNetwork' :: GlobalNetwork -> Maybe GlobalNetworkState
$sel:globalNetworkId:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:globalNetworkArn:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:description:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:createdAt:GlobalNetwork' :: GlobalNetwork -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
globalNetworkArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
globalNetworkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GlobalNetworkState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData GlobalNetwork where
  rnf :: GlobalNetwork -> ()
rnf GlobalNetwork' {Maybe [Tag]
Maybe Text
Maybe POSIX
Maybe GlobalNetworkState
tags :: Maybe [Tag]
state :: Maybe GlobalNetworkState
globalNetworkId :: Maybe Text
globalNetworkArn :: Maybe Text
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tags:GlobalNetwork' :: GlobalNetwork -> Maybe [Tag]
$sel:state:GlobalNetwork' :: GlobalNetwork -> Maybe GlobalNetworkState
$sel:globalNetworkId:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:globalNetworkArn:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:description:GlobalNetwork' :: GlobalNetwork -> Maybe Text
$sel:createdAt:GlobalNetwork' :: GlobalNetwork -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
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
globalNetworkArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
globalNetworkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GlobalNetworkState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags