{-# 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.Site
-- 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.Site where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types.Location
import Amazonka.NetworkManager.Types.SiteState
import Amazonka.NetworkManager.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a site.
--
-- /See:/ 'newSite' smart constructor.
data Site = Site'
  { -- | The state of the site.
    Site -> Maybe SiteState
state :: Prelude.Maybe SiteState,
    -- | The location of the site.
    Site -> Maybe (Sensitive Location)
location :: Prelude.Maybe (Core.Sensitive Location),
    -- | The date and time that the site was created.
    Site -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The ID of the global network.
    Site -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the site.
    Site -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the site.
    Site -> Maybe Text
siteArn :: Prelude.Maybe Prelude.Text,
    -- | The description of the site.
    Site -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags for the site.
    Site -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Site -> Site -> Bool
(Site -> Site -> Bool) -> (Site -> Site -> Bool) -> Eq Site
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Site -> Site -> Bool
$c/= :: Site -> Site -> Bool
== :: Site -> Site -> Bool
$c== :: Site -> Site -> Bool
Prelude.Eq, Int -> Site -> ShowS
[Site] -> ShowS
Site -> String
(Int -> Site -> ShowS)
-> (Site -> String) -> ([Site] -> ShowS) -> Show Site
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Site] -> ShowS
$cshowList :: [Site] -> ShowS
show :: Site -> String
$cshow :: Site -> String
showsPrec :: Int -> Site -> ShowS
$cshowsPrec :: Int -> Site -> ShowS
Prelude.Show, (forall x. Site -> Rep Site x)
-> (forall x. Rep Site x -> Site) -> Generic Site
forall x. Rep Site x -> Site
forall x. Site -> Rep Site x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Site x -> Site
$cfrom :: forall x. Site -> Rep Site x
Prelude.Generic)

-- |
-- Create a value of 'Site' 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', 'site_state' - The state of the site.
--
-- 'location', 'site_location' - The location of the site.
--
-- 'createdAt', 'site_createdAt' - The date and time that the site was created.
--
-- 'globalNetworkId', 'site_globalNetworkId' - The ID of the global network.
--
-- 'siteId', 'site_siteId' - The ID of the site.
--
-- 'siteArn', 'site_siteArn' - The Amazon Resource Name (ARN) of the site.
--
-- 'description', 'site_description' - The description of the site.
--
-- 'tags', 'site_tags' - The tags for the site.
newSite ::
  Site
newSite :: Site
newSite =
  Site' :: Maybe SiteState
-> Maybe (Sensitive Location)
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Site
Site'
    { $sel:state:Site' :: Maybe SiteState
state = Maybe SiteState
forall a. Maybe a
Prelude.Nothing,
      $sel:location:Site' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Site' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:Site' :: Maybe Text
globalNetworkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:siteId:Site' :: Maybe Text
siteId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:siteArn:Site' :: Maybe Text
siteArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Site' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Site' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the site.
site_state :: Lens.Lens' Site (Prelude.Maybe SiteState)
site_state :: (Maybe SiteState -> f (Maybe SiteState)) -> Site -> f Site
site_state = (Site -> Maybe SiteState)
-> (Site -> Maybe SiteState -> Site)
-> Lens Site Site (Maybe SiteState) (Maybe SiteState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe SiteState
state :: Maybe SiteState
$sel:state:Site' :: Site -> Maybe SiteState
state} -> Maybe SiteState
state) (\s :: Site
s@Site' {} Maybe SiteState
a -> Site
s {$sel:state:Site' :: Maybe SiteState
state = Maybe SiteState
a} :: Site)

-- | The location of the site.
site_location :: Lens.Lens' Site (Prelude.Maybe Location)
site_location :: (Maybe Location -> f (Maybe Location)) -> Site -> f Site
site_location = (Site -> Maybe (Sensitive Location))
-> (Site -> Maybe (Sensitive Location) -> Site)
-> Lens
     Site Site (Maybe (Sensitive Location)) (Maybe (Sensitive Location))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe (Sensitive Location)
location :: Maybe (Sensitive Location)
$sel:location:Site' :: Site -> Maybe (Sensitive Location)
location} -> Maybe (Sensitive Location)
location) (\s :: Site
s@Site' {} Maybe (Sensitive Location)
a -> Site
s {$sel:location:Site' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
a} :: Site) ((Maybe (Sensitive Location) -> f (Maybe (Sensitive Location)))
 -> Site -> f Site)
-> ((Maybe Location -> f (Maybe Location))
    -> Maybe (Sensitive Location) -> f (Maybe (Sensitive Location)))
-> (Maybe Location -> f (Maybe Location))
-> Site
-> f Site
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Location) (Sensitive Location) Location Location
-> Iso
     (Maybe (Sensitive Location))
     (Maybe (Sensitive Location))
     (Maybe Location)
     (Maybe Location)
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 (Sensitive Location) (Sensitive Location) Location Location
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The date and time that the site was created.
site_createdAt :: Lens.Lens' Site (Prelude.Maybe Prelude.UTCTime)
site_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Site -> f Site
site_createdAt = (Site -> Maybe POSIX)
-> (Site -> Maybe POSIX -> Site)
-> Lens Site Site (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Site' :: Site -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Site
s@Site' {} Maybe POSIX
a -> Site
s {$sel:createdAt:Site' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Site) ((Maybe POSIX -> f (Maybe POSIX)) -> Site -> f Site)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Site
-> f Site
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 ID of the global network.
site_globalNetworkId :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_globalNetworkId :: (Maybe Text -> f (Maybe Text)) -> Site -> f Site
site_globalNetworkId = (Site -> Maybe Text)
-> (Site -> Maybe Text -> Site)
-> Lens Site Site (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
globalNetworkId :: Maybe Text
$sel:globalNetworkId:Site' :: Site -> Maybe Text
globalNetworkId} -> Maybe Text
globalNetworkId) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:globalNetworkId:Site' :: Maybe Text
globalNetworkId = Maybe Text
a} :: Site)

-- | The ID of the site.
site_siteId :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_siteId :: (Maybe Text -> f (Maybe Text)) -> Site -> f Site
site_siteId = (Site -> Maybe Text)
-> (Site -> Maybe Text -> Site)
-> Lens Site Site (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
siteId :: Maybe Text
$sel:siteId:Site' :: Site -> Maybe Text
siteId} -> Maybe Text
siteId) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:siteId:Site' :: Maybe Text
siteId = Maybe Text
a} :: Site)

-- | The Amazon Resource Name (ARN) of the site.
site_siteArn :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_siteArn :: (Maybe Text -> f (Maybe Text)) -> Site -> f Site
site_siteArn = (Site -> Maybe Text)
-> (Site -> Maybe Text -> Site)
-> Lens Site Site (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
siteArn :: Maybe Text
$sel:siteArn:Site' :: Site -> Maybe Text
siteArn} -> Maybe Text
siteArn) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:siteArn:Site' :: Maybe Text
siteArn = Maybe Text
a} :: Site)

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

-- | The tags for the site.
site_tags :: Lens.Lens' Site (Prelude.Maybe [Tag])
site_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> Site -> f Site
site_tags = (Site -> Maybe [Tag])
-> (Site -> Maybe [Tag] -> Site)
-> Lens Site Site (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Site' :: Site -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Site
s@Site' {} Maybe [Tag]
a -> Site
s {$sel:tags:Site' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Site) ((Maybe [Tag] -> f (Maybe [Tag])) -> Site -> f Site)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> Site
-> f Site
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 Site where
  parseJSON :: Value -> Parser Site
parseJSON =
    String -> (Object -> Parser Site) -> Value -> Parser Site
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Site"
      ( \Object
x ->
          Maybe SiteState
-> Maybe (Sensitive Location)
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Site
Site'
            (Maybe SiteState
 -> Maybe (Sensitive Location)
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Tag]
 -> Site)
-> Parser (Maybe SiteState)
-> Parser
     (Maybe (Sensitive Location)
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Site)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SiteState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe (Sensitive Location)
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Site)
-> Parser (Maybe (Sensitive Location))
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Tag]
      -> Site)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Location))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Location")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Tag]
   -> Site)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Site)
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 Text -> Maybe [Tag] -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> Maybe [Tag] -> Site)
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 Text -> Maybe Text -> Maybe [Tag] -> Site)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe [Tag] -> Site)
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
"SiteId")
            Parser (Maybe Text -> Maybe Text -> Maybe [Tag] -> Site)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Tag] -> Site)
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
"SiteArn")
            Parser (Maybe Text -> Maybe [Tag] -> Site)
-> Parser (Maybe Text) -> Parser (Maybe [Tag] -> Site)
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] -> Site) -> Parser (Maybe [Tag]) -> Parser Site
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 Site

instance Prelude.NFData Site