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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a site.
--
-- /See:/ 'newSite' smart constructor.
data Site = Site'
  { Site -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    Site -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    Site -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
    Site -> Maybe Text
siteArn :: Prelude.Maybe Prelude.Text,
    Site -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The site tags.
    Site -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  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, ReadPrec [Site]
ReadPrec Site
Int -> ReadS Site
ReadS [Site]
(Int -> ReadS Site)
-> ReadS [Site] -> ReadPrec Site -> ReadPrec [Site] -> Read Site
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Site]
$creadListPrec :: ReadPrec [Site]
readPrec :: ReadPrec Site
$creadPrec :: ReadPrec Site
readList :: ReadS [Site]
$creadList :: ReadS [Site]
readsPrec :: Int -> ReadS Site
$creadsPrec :: Int -> ReadS Site
Prelude.Read, 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:
--
-- 'accountId', 'site_accountId' - Undocumented member.
--
-- 'name', 'site_name' - Undocumented member.
--
-- 'siteId', 'site_siteId' - Undocumented member.
--
-- 'siteArn', 'site_siteArn' - Undocumented member.
--
-- 'description', 'site_description' - Undocumented member.
--
-- 'tags', 'site_tags' - The site tags.
newSite ::
  Site
newSite :: Site
newSite =
  Site' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Site
Site'
    { $sel:accountId:Site' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Site' :: Maybe Text
name = 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 (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
site_accountId :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_accountId :: (Maybe Text -> f (Maybe Text)) -> Site -> f Site
site_accountId = (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
accountId :: Maybe Text
$sel:accountId:Site' :: Site -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:accountId:Site' :: Maybe Text
accountId = Maybe Text
a} :: Site)

-- | Undocumented member.
site_name :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_name :: (Maybe Text -> f (Maybe Text)) -> Site -> f Site
site_name = (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
name :: Maybe Text
$sel:name:Site' :: Site -> Maybe Text
name} -> Maybe Text
name) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:name:Site' :: Maybe Text
name = Maybe Text
a} :: Site)

-- | Undocumented member.
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)

-- | Undocumented member.
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)

-- | Undocumented member.
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 site tags.
site_tags :: Lens.Lens' Site (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
site_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Site -> f Site
site_tags = (Site -> Maybe (HashMap Text Text))
-> (Site -> Maybe (HashMap Text Text) -> Site)
-> Lens
     Site Site (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Site' :: Site -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Site
s@Site' {} Maybe (HashMap Text Text)
a -> Site
s {$sel:tags:Site' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Site) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Site -> f Site)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Site
-> f Site
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Site
Site'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Site)
forall (f :: * -> *) a b. Functor 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
"AccountId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe (HashMap Text Text) -> 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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe (HashMap Text Text) -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe (HashMap Text Text) -> 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 (HashMap Text Text) -> Site)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe (HashMap Text Text) -> 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 (HashMap Text Text) -> Site)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> 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 (HashMap Text Text) -> Site)
-> Parser (Maybe (HashMap Text Text)) -> Parser Site
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Site

instance Prelude.NFData Site