{-# 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.AMP.Types.WorkspaceDescription
-- 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.AMP.Types.WorkspaceDescription where

import Amazonka.AMP.Types.WorkspaceStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the properties of a workspace.
--
-- /See:/ 'newWorkspaceDescription' smart constructor.
data WorkspaceDescription = WorkspaceDescription'
  { -- | Alias of this workspace.
    WorkspaceDescription -> Maybe Text
alias :: Prelude.Maybe Prelude.Text,
    -- | Prometheus endpoint URI.
    WorkspaceDescription -> Maybe Text
prometheusEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The tags of this workspace.
    WorkspaceDescription -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Name (ARN) of this workspace.
    WorkspaceDescription -> Text
arn :: Prelude.Text,
    -- | The time when the workspace was created.
    WorkspaceDescription -> POSIX
createdAt :: Core.POSIX,
    -- | The status of this workspace.
    WorkspaceDescription -> WorkspaceStatus
status :: WorkspaceStatus,
    -- | Unique string identifying this workspace.
    WorkspaceDescription -> Text
workspaceId :: Prelude.Text
  }
  deriving (WorkspaceDescription -> WorkspaceDescription -> Bool
(WorkspaceDescription -> WorkspaceDescription -> Bool)
-> (WorkspaceDescription -> WorkspaceDescription -> Bool)
-> Eq WorkspaceDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkspaceDescription -> WorkspaceDescription -> Bool
$c/= :: WorkspaceDescription -> WorkspaceDescription -> Bool
== :: WorkspaceDescription -> WorkspaceDescription -> Bool
$c== :: WorkspaceDescription -> WorkspaceDescription -> Bool
Prelude.Eq, ReadPrec [WorkspaceDescription]
ReadPrec WorkspaceDescription
Int -> ReadS WorkspaceDescription
ReadS [WorkspaceDescription]
(Int -> ReadS WorkspaceDescription)
-> ReadS [WorkspaceDescription]
-> ReadPrec WorkspaceDescription
-> ReadPrec [WorkspaceDescription]
-> Read WorkspaceDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkspaceDescription]
$creadListPrec :: ReadPrec [WorkspaceDescription]
readPrec :: ReadPrec WorkspaceDescription
$creadPrec :: ReadPrec WorkspaceDescription
readList :: ReadS [WorkspaceDescription]
$creadList :: ReadS [WorkspaceDescription]
readsPrec :: Int -> ReadS WorkspaceDescription
$creadsPrec :: Int -> ReadS WorkspaceDescription
Prelude.Read, Int -> WorkspaceDescription -> ShowS
[WorkspaceDescription] -> ShowS
WorkspaceDescription -> String
(Int -> WorkspaceDescription -> ShowS)
-> (WorkspaceDescription -> String)
-> ([WorkspaceDescription] -> ShowS)
-> Show WorkspaceDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkspaceDescription] -> ShowS
$cshowList :: [WorkspaceDescription] -> ShowS
show :: WorkspaceDescription -> String
$cshow :: WorkspaceDescription -> String
showsPrec :: Int -> WorkspaceDescription -> ShowS
$cshowsPrec :: Int -> WorkspaceDescription -> ShowS
Prelude.Show, (forall x. WorkspaceDescription -> Rep WorkspaceDescription x)
-> (forall x. Rep WorkspaceDescription x -> WorkspaceDescription)
-> Generic WorkspaceDescription
forall x. Rep WorkspaceDescription x -> WorkspaceDescription
forall x. WorkspaceDescription -> Rep WorkspaceDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkspaceDescription x -> WorkspaceDescription
$cfrom :: forall x. WorkspaceDescription -> Rep WorkspaceDescription x
Prelude.Generic)

-- |
-- Create a value of 'WorkspaceDescription' 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:
--
-- 'alias', 'workspaceDescription_alias' - Alias of this workspace.
--
-- 'prometheusEndpoint', 'workspaceDescription_prometheusEndpoint' - Prometheus endpoint URI.
--
-- 'tags', 'workspaceDescription_tags' - The tags of this workspace.
--
-- 'arn', 'workspaceDescription_arn' - The Amazon Resource Name (ARN) of this workspace.
--
-- 'createdAt', 'workspaceDescription_createdAt' - The time when the workspace was created.
--
-- 'status', 'workspaceDescription_status' - The status of this workspace.
--
-- 'workspaceId', 'workspaceDescription_workspaceId' - Unique string identifying this workspace.
newWorkspaceDescription ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'status'
  WorkspaceStatus ->
  -- | 'workspaceId'
  Prelude.Text ->
  WorkspaceDescription
newWorkspaceDescription :: Text -> UTCTime -> WorkspaceStatus -> Text -> WorkspaceDescription
newWorkspaceDescription
  Text
pArn_
  UTCTime
pCreatedAt_
  WorkspaceStatus
pStatus_
  Text
pWorkspaceId_ =
    WorkspaceDescription' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> WorkspaceStatus
-> Text
-> WorkspaceDescription
WorkspaceDescription'
      { $sel:alias:WorkspaceDescription' :: Maybe Text
alias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:prometheusEndpoint:WorkspaceDescription' :: Maybe Text
prometheusEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:WorkspaceDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:arn:WorkspaceDescription' :: Text
arn = Text
pArn_,
        $sel:createdAt:WorkspaceDescription' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:status:WorkspaceDescription' :: WorkspaceStatus
status = WorkspaceStatus
pStatus_,
        $sel:workspaceId:WorkspaceDescription' :: Text
workspaceId = Text
pWorkspaceId_
      }

-- | Alias of this workspace.
workspaceDescription_alias :: Lens.Lens' WorkspaceDescription (Prelude.Maybe Prelude.Text)
workspaceDescription_alias :: (Maybe Text -> f (Maybe Text))
-> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_alias = (WorkspaceDescription -> Maybe Text)
-> (WorkspaceDescription -> Maybe Text -> WorkspaceDescription)
-> Lens
     WorkspaceDescription WorkspaceDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {Maybe Text
alias :: Maybe Text
$sel:alias:WorkspaceDescription' :: WorkspaceDescription -> Maybe Text
alias} -> Maybe Text
alias) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} Maybe Text
a -> WorkspaceDescription
s {$sel:alias:WorkspaceDescription' :: Maybe Text
alias = Maybe Text
a} :: WorkspaceDescription)

-- | Prometheus endpoint URI.
workspaceDescription_prometheusEndpoint :: Lens.Lens' WorkspaceDescription (Prelude.Maybe Prelude.Text)
workspaceDescription_prometheusEndpoint :: (Maybe Text -> f (Maybe Text))
-> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_prometheusEndpoint = (WorkspaceDescription -> Maybe Text)
-> (WorkspaceDescription -> Maybe Text -> WorkspaceDescription)
-> Lens
     WorkspaceDescription WorkspaceDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {Maybe Text
prometheusEndpoint :: Maybe Text
$sel:prometheusEndpoint:WorkspaceDescription' :: WorkspaceDescription -> Maybe Text
prometheusEndpoint} -> Maybe Text
prometheusEndpoint) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} Maybe Text
a -> WorkspaceDescription
s {$sel:prometheusEndpoint:WorkspaceDescription' :: Maybe Text
prometheusEndpoint = Maybe Text
a} :: WorkspaceDescription)

-- | The tags of this workspace.
workspaceDescription_tags :: Lens.Lens' WorkspaceDescription (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
workspaceDescription_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_tags = (WorkspaceDescription -> Maybe (HashMap Text Text))
-> (WorkspaceDescription
    -> Maybe (HashMap Text Text) -> WorkspaceDescription)
-> Lens
     WorkspaceDescription
     WorkspaceDescription
     (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 (\WorkspaceDescription' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:WorkspaceDescription' :: WorkspaceDescription -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} Maybe (HashMap Text Text)
a -> WorkspaceDescription
s {$sel:tags:WorkspaceDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: WorkspaceDescription) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> WorkspaceDescription -> f WorkspaceDescription)
-> ((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)))
-> WorkspaceDescription
-> f WorkspaceDescription
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

-- | The Amazon Resource Name (ARN) of this workspace.
workspaceDescription_arn :: Lens.Lens' WorkspaceDescription Prelude.Text
workspaceDescription_arn :: (Text -> f Text) -> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_arn = (WorkspaceDescription -> Text)
-> (WorkspaceDescription -> Text -> WorkspaceDescription)
-> Lens WorkspaceDescription WorkspaceDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {Text
arn :: Text
$sel:arn:WorkspaceDescription' :: WorkspaceDescription -> Text
arn} -> Text
arn) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} Text
a -> WorkspaceDescription
s {$sel:arn:WorkspaceDescription' :: Text
arn = Text
a} :: WorkspaceDescription)

-- | The time when the workspace was created.
workspaceDescription_createdAt :: Lens.Lens' WorkspaceDescription Prelude.UTCTime
workspaceDescription_createdAt :: (UTCTime -> f UTCTime)
-> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_createdAt = (WorkspaceDescription -> POSIX)
-> (WorkspaceDescription -> POSIX -> WorkspaceDescription)
-> Lens WorkspaceDescription WorkspaceDescription POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {POSIX
createdAt :: POSIX
$sel:createdAt:WorkspaceDescription' :: WorkspaceDescription -> POSIX
createdAt} -> POSIX
createdAt) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} POSIX
a -> WorkspaceDescription
s {$sel:createdAt:WorkspaceDescription' :: POSIX
createdAt = POSIX
a} :: WorkspaceDescription) ((POSIX -> f POSIX)
 -> WorkspaceDescription -> f WorkspaceDescription)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> WorkspaceDescription
-> f WorkspaceDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of this workspace.
workspaceDescription_status :: Lens.Lens' WorkspaceDescription WorkspaceStatus
workspaceDescription_status :: (WorkspaceStatus -> f WorkspaceStatus)
-> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_status = (WorkspaceDescription -> WorkspaceStatus)
-> (WorkspaceDescription
    -> WorkspaceStatus -> WorkspaceDescription)
-> Lens
     WorkspaceDescription
     WorkspaceDescription
     WorkspaceStatus
     WorkspaceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {WorkspaceStatus
status :: WorkspaceStatus
$sel:status:WorkspaceDescription' :: WorkspaceDescription -> WorkspaceStatus
status} -> WorkspaceStatus
status) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} WorkspaceStatus
a -> WorkspaceDescription
s {$sel:status:WorkspaceDescription' :: WorkspaceStatus
status = WorkspaceStatus
a} :: WorkspaceDescription)

-- | Unique string identifying this workspace.
workspaceDescription_workspaceId :: Lens.Lens' WorkspaceDescription Prelude.Text
workspaceDescription_workspaceId :: (Text -> f Text) -> WorkspaceDescription -> f WorkspaceDescription
workspaceDescription_workspaceId = (WorkspaceDescription -> Text)
-> (WorkspaceDescription -> Text -> WorkspaceDescription)
-> Lens WorkspaceDescription WorkspaceDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkspaceDescription' {Text
workspaceId :: Text
$sel:workspaceId:WorkspaceDescription' :: WorkspaceDescription -> Text
workspaceId} -> Text
workspaceId) (\s :: WorkspaceDescription
s@WorkspaceDescription' {} Text
a -> WorkspaceDescription
s {$sel:workspaceId:WorkspaceDescription' :: Text
workspaceId = Text
a} :: WorkspaceDescription)

instance Core.FromJSON WorkspaceDescription where
  parseJSON :: Value -> Parser WorkspaceDescription
parseJSON =
    String
-> (Object -> Parser WorkspaceDescription)
-> Value
-> Parser WorkspaceDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkspaceDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> WorkspaceStatus
-> Text
-> WorkspaceDescription
WorkspaceDescription'
            (Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> POSIX
 -> WorkspaceStatus
 -> Text
 -> WorkspaceDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> POSIX
      -> WorkspaceStatus
      -> Text
      -> WorkspaceDescription)
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
"alias")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> POSIX
   -> WorkspaceStatus
   -> Text
   -> WorkspaceDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text
      -> POSIX
      -> WorkspaceStatus
      -> Text
      -> WorkspaceDescription)
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
"prometheusEndpoint")
            Parser
  (Maybe (HashMap Text Text)
   -> Text
   -> POSIX
   -> WorkspaceStatus
   -> Text
   -> WorkspaceDescription)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Text -> POSIX -> WorkspaceStatus -> Text -> WorkspaceDescription)
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)
            Parser
  (Text -> POSIX -> WorkspaceStatus -> Text -> WorkspaceDescription)
-> Parser Text
-> Parser
     (POSIX -> WorkspaceStatus -> Text -> WorkspaceDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"arn")
            Parser (POSIX -> WorkspaceStatus -> Text -> WorkspaceDescription)
-> Parser POSIX
-> Parser (WorkspaceStatus -> Text -> WorkspaceDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createdAt")
            Parser (WorkspaceStatus -> Text -> WorkspaceDescription)
-> Parser WorkspaceStatus -> Parser (Text -> WorkspaceDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WorkspaceStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (Text -> WorkspaceDescription)
-> Parser Text -> Parser WorkspaceDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"workspaceId")
      )

instance Prelude.Hashable WorkspaceDescription

instance Prelude.NFData WorkspaceDescription