{-# 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.DeviceFarm.Types.Project
-- 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.DeviceFarm.Types.Project where

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

-- | Represents an operating-system neutral workspace for running and
-- managing tests.
--
-- /See:/ 'newProject' smart constructor.
data Project = Project'
  { -- | The project\'s ARN.
    Project -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | When the project was created.
    Project -> Maybe POSIX
created :: Prelude.Maybe Core.POSIX,
    -- | The project\'s name.
    Project -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The default number of minutes (at the project level) a test run executes
    -- before it times out. The default value is 150 minutes.
    Project -> Maybe Int
defaultJobTimeoutMinutes :: Prelude.Maybe Prelude.Int
  }
  deriving (Project -> Project -> Bool
(Project -> Project -> Bool)
-> (Project -> Project -> Bool) -> Eq Project
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Project -> Project -> Bool
$c/= :: Project -> Project -> Bool
== :: Project -> Project -> Bool
$c== :: Project -> Project -> Bool
Prelude.Eq, ReadPrec [Project]
ReadPrec Project
Int -> ReadS Project
ReadS [Project]
(Int -> ReadS Project)
-> ReadS [Project]
-> ReadPrec Project
-> ReadPrec [Project]
-> Read Project
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Project]
$creadListPrec :: ReadPrec [Project]
readPrec :: ReadPrec Project
$creadPrec :: ReadPrec Project
readList :: ReadS [Project]
$creadList :: ReadS [Project]
readsPrec :: Int -> ReadS Project
$creadsPrec :: Int -> ReadS Project
Prelude.Read, Int -> Project -> ShowS
[Project] -> ShowS
Project -> String
(Int -> Project -> ShowS)
-> (Project -> String) -> ([Project] -> ShowS) -> Show Project
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Project] -> ShowS
$cshowList :: [Project] -> ShowS
show :: Project -> String
$cshow :: Project -> String
showsPrec :: Int -> Project -> ShowS
$cshowsPrec :: Int -> Project -> ShowS
Prelude.Show, (forall x. Project -> Rep Project x)
-> (forall x. Rep Project x -> Project) -> Generic Project
forall x. Rep Project x -> Project
forall x. Project -> Rep Project x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Project x -> Project
$cfrom :: forall x. Project -> Rep Project x
Prelude.Generic)

-- |
-- Create a value of 'Project' 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', 'project_arn' - The project\'s ARN.
--
-- 'created', 'project_created' - When the project was created.
--
-- 'name', 'project_name' - The project\'s name.
--
-- 'defaultJobTimeoutMinutes', 'project_defaultJobTimeoutMinutes' - The default number of minutes (at the project level) a test run executes
-- before it times out. The default value is 150 minutes.
newProject ::
  Project
newProject :: Project
newProject =
  Project' :: Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Int -> Project
Project'
    { $sel:arn:Project' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:created:Project' :: Maybe POSIX
created = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Project' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultJobTimeoutMinutes:Project' :: Maybe Int
defaultJobTimeoutMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

-- | When the project was created.
project_created :: Lens.Lens' Project (Prelude.Maybe Prelude.UTCTime)
project_created :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Project -> f Project
project_created = (Project -> Maybe POSIX)
-> (Project -> Maybe POSIX -> Project)
-> Lens Project Project (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Project' {Maybe POSIX
created :: Maybe POSIX
$sel:created:Project' :: Project -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: Project
s@Project' {} Maybe POSIX
a -> Project
s {$sel:created:Project' :: Maybe POSIX
created = Maybe POSIX
a} :: Project) ((Maybe POSIX -> f (Maybe POSIX)) -> Project -> f Project)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Project
-> f Project
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 project\'s name.
project_name :: Lens.Lens' Project (Prelude.Maybe Prelude.Text)
project_name :: (Maybe Text -> f (Maybe Text)) -> Project -> f Project
project_name = (Project -> Maybe Text)
-> (Project -> Maybe Text -> Project)
-> Lens Project Project (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Project' {Maybe Text
name :: Maybe Text
$sel:name:Project' :: Project -> Maybe Text
name} -> Maybe Text
name) (\s :: Project
s@Project' {} Maybe Text
a -> Project
s {$sel:name:Project' :: Maybe Text
name = Maybe Text
a} :: Project)

-- | The default number of minutes (at the project level) a test run executes
-- before it times out. The default value is 150 minutes.
project_defaultJobTimeoutMinutes :: Lens.Lens' Project (Prelude.Maybe Prelude.Int)
project_defaultJobTimeoutMinutes :: (Maybe Int -> f (Maybe Int)) -> Project -> f Project
project_defaultJobTimeoutMinutes = (Project -> Maybe Int)
-> (Project -> Maybe Int -> Project)
-> Lens Project Project (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Project' {Maybe Int
defaultJobTimeoutMinutes :: Maybe Int
$sel:defaultJobTimeoutMinutes:Project' :: Project -> Maybe Int
defaultJobTimeoutMinutes} -> Maybe Int
defaultJobTimeoutMinutes) (\s :: Project
s@Project' {} Maybe Int
a -> Project
s {$sel:defaultJobTimeoutMinutes:Project' :: Maybe Int
defaultJobTimeoutMinutes = Maybe Int
a} :: Project)

instance Core.FromJSON Project where
  parseJSON :: Value -> Parser Project
parseJSON =
    String -> (Object -> Parser Project) -> Value -> Parser Project
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Project"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Int -> Project
Project'
            (Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe Int -> Project)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Int -> Project)
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 POSIX -> Maybe Text -> Maybe Int -> Project)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Int -> Project)
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
"created")
            Parser (Maybe Text -> Maybe Int -> Project)
-> Parser (Maybe Text) -> Parser (Maybe Int -> Project)
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 Int -> Project)
-> Parser (Maybe Int) -> Parser Project
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"defaultJobTimeoutMinutes")
      )

instance Prelude.Hashable Project

instance Prelude.NFData Project