{-# 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.IoT1ClickProjects.Types.ProjectDescription
-- 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.IoT1ClickProjects.Types.ProjectDescription where

import qualified Amazonka.Core as Core
import Amazonka.IoT1ClickProjects.Types.PlacementTemplate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object providing detailed information for a particular project
-- associated with an AWS account and region.
--
-- /See:/ 'newProjectDescription' smart constructor.
data ProjectDescription = ProjectDescription'
  { -- | The ARN of the project.
    ProjectDescription -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | An object describing the project\'s placement specifications.
    ProjectDescription -> Maybe PlacementTemplate
placementTemplate :: Prelude.Maybe PlacementTemplate,
    -- | The description of the project.
    ProjectDescription -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags (metadata key\/value pairs) associated with the project.
    ProjectDescription -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the project for which to obtain information from.
    ProjectDescription -> Text
projectName :: Prelude.Text,
    -- | The date when the project was originally created, in UNIX epoch time
    -- format.
    ProjectDescription -> POSIX
createdDate :: Core.POSIX,
    -- | The date when the project was last updated, in UNIX epoch time format.
    -- If the project was not updated, then @createdDate@ and @updatedDate@ are
    -- the same.
    ProjectDescription -> POSIX
updatedDate :: Core.POSIX
  }
  deriving (ProjectDescription -> ProjectDescription -> Bool
(ProjectDescription -> ProjectDescription -> Bool)
-> (ProjectDescription -> ProjectDescription -> Bool)
-> Eq ProjectDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectDescription -> ProjectDescription -> Bool
$c/= :: ProjectDescription -> ProjectDescription -> Bool
== :: ProjectDescription -> ProjectDescription -> Bool
$c== :: ProjectDescription -> ProjectDescription -> Bool
Prelude.Eq, ReadPrec [ProjectDescription]
ReadPrec ProjectDescription
Int -> ReadS ProjectDescription
ReadS [ProjectDescription]
(Int -> ReadS ProjectDescription)
-> ReadS [ProjectDescription]
-> ReadPrec ProjectDescription
-> ReadPrec [ProjectDescription]
-> Read ProjectDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectDescription]
$creadListPrec :: ReadPrec [ProjectDescription]
readPrec :: ReadPrec ProjectDescription
$creadPrec :: ReadPrec ProjectDescription
readList :: ReadS [ProjectDescription]
$creadList :: ReadS [ProjectDescription]
readsPrec :: Int -> ReadS ProjectDescription
$creadsPrec :: Int -> ReadS ProjectDescription
Prelude.Read, Int -> ProjectDescription -> ShowS
[ProjectDescription] -> ShowS
ProjectDescription -> String
(Int -> ProjectDescription -> ShowS)
-> (ProjectDescription -> String)
-> ([ProjectDescription] -> ShowS)
-> Show ProjectDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectDescription] -> ShowS
$cshowList :: [ProjectDescription] -> ShowS
show :: ProjectDescription -> String
$cshow :: ProjectDescription -> String
showsPrec :: Int -> ProjectDescription -> ShowS
$cshowsPrec :: Int -> ProjectDescription -> ShowS
Prelude.Show, (forall x. ProjectDescription -> Rep ProjectDescription x)
-> (forall x. Rep ProjectDescription x -> ProjectDescription)
-> Generic ProjectDescription
forall x. Rep ProjectDescription x -> ProjectDescription
forall x. ProjectDescription -> Rep ProjectDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectDescription x -> ProjectDescription
$cfrom :: forall x. ProjectDescription -> Rep ProjectDescription x
Prelude.Generic)

-- |
-- Create a value of 'ProjectDescription' 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:
--
-- 'arn', 'projectDescription_arn' - The ARN of the project.
--
-- 'placementTemplate', 'projectDescription_placementTemplate' - An object describing the project\'s placement specifications.
--
-- 'description', 'projectDescription_description' - The description of the project.
--
-- 'tags', 'projectDescription_tags' - The tags (metadata key\/value pairs) associated with the project.
--
-- 'projectName', 'projectDescription_projectName' - The name of the project for which to obtain information from.
--
-- 'createdDate', 'projectDescription_createdDate' - The date when the project was originally created, in UNIX epoch time
-- format.
--
-- 'updatedDate', 'projectDescription_updatedDate' - The date when the project was last updated, in UNIX epoch time format.
-- If the project was not updated, then @createdDate@ and @updatedDate@ are
-- the same.
newProjectDescription ::
  -- | 'projectName'
  Prelude.Text ->
  -- | 'createdDate'
  Prelude.UTCTime ->
  -- | 'updatedDate'
  Prelude.UTCTime ->
  ProjectDescription
newProjectDescription :: Text -> UTCTime -> UTCTime -> ProjectDescription
newProjectDescription
  Text
pProjectName_
  UTCTime
pCreatedDate_
  UTCTime
pUpdatedDate_ =
    ProjectDescription' :: Maybe Text
-> Maybe PlacementTemplate
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectDescription
ProjectDescription'
      { $sel:arn:ProjectDescription' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:placementTemplate:ProjectDescription' :: Maybe PlacementTemplate
placementTemplate = Maybe PlacementTemplate
forall a. Maybe a
Prelude.Nothing,
        $sel:description:ProjectDescription' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ProjectDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:projectName:ProjectDescription' :: Text
projectName = Text
pProjectName_,
        $sel:createdDate:ProjectDescription' :: POSIX
createdDate = 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
pCreatedDate_,
        $sel:updatedDate:ProjectDescription' :: POSIX
updatedDate = 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
pUpdatedDate_
      }

-- | The ARN of the project.
projectDescription_arn :: Lens.Lens' ProjectDescription (Prelude.Maybe Prelude.Text)
projectDescription_arn :: (Maybe Text -> f (Maybe Text))
-> ProjectDescription -> f ProjectDescription
projectDescription_arn = (ProjectDescription -> Maybe Text)
-> (ProjectDescription -> Maybe Text -> ProjectDescription)
-> Lens
     ProjectDescription ProjectDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Maybe Text
arn :: Maybe Text
$sel:arn:ProjectDescription' :: ProjectDescription -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ProjectDescription
s@ProjectDescription' {} Maybe Text
a -> ProjectDescription
s {$sel:arn:ProjectDescription' :: Maybe Text
arn = Maybe Text
a} :: ProjectDescription)

-- | An object describing the project\'s placement specifications.
projectDescription_placementTemplate :: Lens.Lens' ProjectDescription (Prelude.Maybe PlacementTemplate)
projectDescription_placementTemplate :: (Maybe PlacementTemplate -> f (Maybe PlacementTemplate))
-> ProjectDescription -> f ProjectDescription
projectDescription_placementTemplate = (ProjectDescription -> Maybe PlacementTemplate)
-> (ProjectDescription
    -> Maybe PlacementTemplate -> ProjectDescription)
-> Lens
     ProjectDescription
     ProjectDescription
     (Maybe PlacementTemplate)
     (Maybe PlacementTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Maybe PlacementTemplate
placementTemplate :: Maybe PlacementTemplate
$sel:placementTemplate:ProjectDescription' :: ProjectDescription -> Maybe PlacementTemplate
placementTemplate} -> Maybe PlacementTemplate
placementTemplate) (\s :: ProjectDescription
s@ProjectDescription' {} Maybe PlacementTemplate
a -> ProjectDescription
s {$sel:placementTemplate:ProjectDescription' :: Maybe PlacementTemplate
placementTemplate = Maybe PlacementTemplate
a} :: ProjectDescription)

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

-- | The tags (metadata key\/value pairs) associated with the project.
projectDescription_tags :: Lens.Lens' ProjectDescription (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
projectDescription_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProjectDescription -> f ProjectDescription
projectDescription_tags = (ProjectDescription -> Maybe (HashMap Text Text))
-> (ProjectDescription
    -> Maybe (HashMap Text Text) -> ProjectDescription)
-> Lens
     ProjectDescription
     ProjectDescription
     (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 (\ProjectDescription' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ProjectDescription' :: ProjectDescription -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ProjectDescription
s@ProjectDescription' {} Maybe (HashMap Text Text)
a -> ProjectDescription
s {$sel:tags:ProjectDescription' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ProjectDescription) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ProjectDescription -> f ProjectDescription)
-> ((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)))
-> ProjectDescription
-> f ProjectDescription
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 name of the project for which to obtain information from.
projectDescription_projectName :: Lens.Lens' ProjectDescription Prelude.Text
projectDescription_projectName :: (Text -> f Text) -> ProjectDescription -> f ProjectDescription
projectDescription_projectName = (ProjectDescription -> Text)
-> (ProjectDescription -> Text -> ProjectDescription)
-> Lens ProjectDescription ProjectDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {Text
projectName :: Text
$sel:projectName:ProjectDescription' :: ProjectDescription -> Text
projectName} -> Text
projectName) (\s :: ProjectDescription
s@ProjectDescription' {} Text
a -> ProjectDescription
s {$sel:projectName:ProjectDescription' :: Text
projectName = Text
a} :: ProjectDescription)

-- | The date when the project was originally created, in UNIX epoch time
-- format.
projectDescription_createdDate :: Lens.Lens' ProjectDescription Prelude.UTCTime
projectDescription_createdDate :: (UTCTime -> f UTCTime)
-> ProjectDescription -> f ProjectDescription
projectDescription_createdDate = (ProjectDescription -> POSIX)
-> (ProjectDescription -> POSIX -> ProjectDescription)
-> Lens ProjectDescription ProjectDescription POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {POSIX
createdDate :: POSIX
$sel:createdDate:ProjectDescription' :: ProjectDescription -> POSIX
createdDate} -> POSIX
createdDate) (\s :: ProjectDescription
s@ProjectDescription' {} POSIX
a -> ProjectDescription
s {$sel:createdDate:ProjectDescription' :: POSIX
createdDate = POSIX
a} :: ProjectDescription) ((POSIX -> f POSIX) -> ProjectDescription -> f ProjectDescription)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ProjectDescription
-> f ProjectDescription
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 date when the project was last updated, in UNIX epoch time format.
-- If the project was not updated, then @createdDate@ and @updatedDate@ are
-- the same.
projectDescription_updatedDate :: Lens.Lens' ProjectDescription Prelude.UTCTime
projectDescription_updatedDate :: (UTCTime -> f UTCTime)
-> ProjectDescription -> f ProjectDescription
projectDescription_updatedDate = (ProjectDescription -> POSIX)
-> (ProjectDescription -> POSIX -> ProjectDescription)
-> Lens ProjectDescription ProjectDescription POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectDescription' {POSIX
updatedDate :: POSIX
$sel:updatedDate:ProjectDescription' :: ProjectDescription -> POSIX
updatedDate} -> POSIX
updatedDate) (\s :: ProjectDescription
s@ProjectDescription' {} POSIX
a -> ProjectDescription
s {$sel:updatedDate:ProjectDescription' :: POSIX
updatedDate = POSIX
a} :: ProjectDescription) ((POSIX -> f POSIX) -> ProjectDescription -> f ProjectDescription)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ProjectDescription
-> f ProjectDescription
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

instance Core.FromJSON ProjectDescription where
  parseJSON :: Value -> Parser ProjectDescription
parseJSON =
    String
-> (Object -> Parser ProjectDescription)
-> Value
-> Parser ProjectDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProjectDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe PlacementTemplate
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> POSIX
-> POSIX
-> ProjectDescription
ProjectDescription'
            (Maybe Text
 -> Maybe PlacementTemplate
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> POSIX
 -> POSIX
 -> ProjectDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe PlacementTemplate
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> POSIX
      -> POSIX
      -> ProjectDescription)
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
"arn")
            Parser
  (Maybe PlacementTemplate
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> POSIX
   -> POSIX
   -> ProjectDescription)
-> Parser (Maybe PlacementTemplate)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Text
      -> POSIX
      -> POSIX
      -> ProjectDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PlacementTemplate)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"placementTemplate")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Text
   -> POSIX
   -> POSIX
   -> ProjectDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text -> POSIX -> POSIX -> ProjectDescription)
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)
   -> Text -> POSIX -> POSIX -> ProjectDescription)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> POSIX -> POSIX -> ProjectDescription)
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 -> POSIX -> ProjectDescription)
-> Parser Text -> Parser (POSIX -> POSIX -> ProjectDescription)
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
"projectName")
            Parser (POSIX -> POSIX -> ProjectDescription)
-> Parser POSIX -> Parser (POSIX -> ProjectDescription)
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
"createdDate")
            Parser (POSIX -> ProjectDescription)
-> Parser POSIX -> Parser ProjectDescription
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
"updatedDate")
      )

instance Prelude.Hashable ProjectDescription

instance Prelude.NFData ProjectDescription