{-# 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.RobOMaker.Types.Fleet
-- 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.RobOMaker.Types.Fleet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.DeploymentStatus

-- | Information about a fleet.
--
-- /See:/ 'newFleet' smart constructor.
data Fleet = Fleet'
  { -- | The Amazon Resource Name (ARN) of the last deployment job.
    Fleet -> Maybe Text
lastDeploymentJob :: Prelude.Maybe Prelude.Text,
    -- | The status of the last fleet deployment.
    Fleet -> Maybe DeploymentStatus
lastDeploymentStatus :: Prelude.Maybe DeploymentStatus,
    -- | The Amazon Resource Name (ARN) of the fleet.
    Fleet -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the fleet was created.
    Fleet -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The name of the fleet.
    Fleet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The time of the last deployment.
    Fleet -> Maybe POSIX
lastDeploymentTime :: Prelude.Maybe Core.POSIX
  }
  deriving (Fleet -> Fleet -> Bool
(Fleet -> Fleet -> Bool) -> (Fleet -> Fleet -> Bool) -> Eq Fleet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fleet -> Fleet -> Bool
$c/= :: Fleet -> Fleet -> Bool
== :: Fleet -> Fleet -> Bool
$c== :: Fleet -> Fleet -> Bool
Prelude.Eq, ReadPrec [Fleet]
ReadPrec Fleet
Int -> ReadS Fleet
ReadS [Fleet]
(Int -> ReadS Fleet)
-> ReadS [Fleet]
-> ReadPrec Fleet
-> ReadPrec [Fleet]
-> Read Fleet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Fleet]
$creadListPrec :: ReadPrec [Fleet]
readPrec :: ReadPrec Fleet
$creadPrec :: ReadPrec Fleet
readList :: ReadS [Fleet]
$creadList :: ReadS [Fleet]
readsPrec :: Int -> ReadS Fleet
$creadsPrec :: Int -> ReadS Fleet
Prelude.Read, Int -> Fleet -> ShowS
[Fleet] -> ShowS
Fleet -> String
(Int -> Fleet -> ShowS)
-> (Fleet -> String) -> ([Fleet] -> ShowS) -> Show Fleet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fleet] -> ShowS
$cshowList :: [Fleet] -> ShowS
show :: Fleet -> String
$cshow :: Fleet -> String
showsPrec :: Int -> Fleet -> ShowS
$cshowsPrec :: Int -> Fleet -> ShowS
Prelude.Show, (forall x. Fleet -> Rep Fleet x)
-> (forall x. Rep Fleet x -> Fleet) -> Generic Fleet
forall x. Rep Fleet x -> Fleet
forall x. Fleet -> Rep Fleet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Fleet x -> Fleet
$cfrom :: forall x. Fleet -> Rep Fleet x
Prelude.Generic)

-- |
-- Create a value of 'Fleet' 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:
--
-- 'lastDeploymentJob', 'fleet_lastDeploymentJob' - The Amazon Resource Name (ARN) of the last deployment job.
--
-- 'lastDeploymentStatus', 'fleet_lastDeploymentStatus' - The status of the last fleet deployment.
--
-- 'arn', 'fleet_arn' - The Amazon Resource Name (ARN) of the fleet.
--
-- 'createdAt', 'fleet_createdAt' - The time, in milliseconds since the epoch, when the fleet was created.
--
-- 'name', 'fleet_name' - The name of the fleet.
--
-- 'lastDeploymentTime', 'fleet_lastDeploymentTime' - The time of the last deployment.
newFleet ::
  Fleet
newFleet :: Fleet
newFleet =
  Fleet' :: Maybe Text
-> Maybe DeploymentStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Fleet
Fleet'
    { $sel:lastDeploymentJob:Fleet' :: Maybe Text
lastDeploymentJob = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastDeploymentStatus:Fleet' :: Maybe DeploymentStatus
lastDeploymentStatus = Maybe DeploymentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Fleet' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Fleet' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Fleet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastDeploymentTime:Fleet' :: Maybe POSIX
lastDeploymentTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the last deployment job.
fleet_lastDeploymentJob :: Lens.Lens' Fleet (Prelude.Maybe Prelude.Text)
fleet_lastDeploymentJob :: (Maybe Text -> f (Maybe Text)) -> Fleet -> f Fleet
fleet_lastDeploymentJob = (Fleet -> Maybe Text)
-> (Fleet -> Maybe Text -> Fleet)
-> Lens Fleet Fleet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fleet' {Maybe Text
lastDeploymentJob :: Maybe Text
$sel:lastDeploymentJob:Fleet' :: Fleet -> Maybe Text
lastDeploymentJob} -> Maybe Text
lastDeploymentJob) (\s :: Fleet
s@Fleet' {} Maybe Text
a -> Fleet
s {$sel:lastDeploymentJob:Fleet' :: Maybe Text
lastDeploymentJob = Maybe Text
a} :: Fleet)

-- | The status of the last fleet deployment.
fleet_lastDeploymentStatus :: Lens.Lens' Fleet (Prelude.Maybe DeploymentStatus)
fleet_lastDeploymentStatus :: (Maybe DeploymentStatus -> f (Maybe DeploymentStatus))
-> Fleet -> f Fleet
fleet_lastDeploymentStatus = (Fleet -> Maybe DeploymentStatus)
-> (Fleet -> Maybe DeploymentStatus -> Fleet)
-> Lens
     Fleet Fleet (Maybe DeploymentStatus) (Maybe DeploymentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fleet' {Maybe DeploymentStatus
lastDeploymentStatus :: Maybe DeploymentStatus
$sel:lastDeploymentStatus:Fleet' :: Fleet -> Maybe DeploymentStatus
lastDeploymentStatus} -> Maybe DeploymentStatus
lastDeploymentStatus) (\s :: Fleet
s@Fleet' {} Maybe DeploymentStatus
a -> Fleet
s {$sel:lastDeploymentStatus:Fleet' :: Maybe DeploymentStatus
lastDeploymentStatus = Maybe DeploymentStatus
a} :: Fleet)

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

-- | The time, in milliseconds since the epoch, when the fleet was created.
fleet_createdAt :: Lens.Lens' Fleet (Prelude.Maybe Prelude.UTCTime)
fleet_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Fleet -> f Fleet
fleet_createdAt = (Fleet -> Maybe POSIX)
-> (Fleet -> Maybe POSIX -> Fleet)
-> Lens Fleet Fleet (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fleet' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Fleet' :: Fleet -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Fleet
s@Fleet' {} Maybe POSIX
a -> Fleet
s {$sel:createdAt:Fleet' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Fleet) ((Maybe POSIX -> f (Maybe POSIX)) -> Fleet -> f Fleet)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Fleet
-> f Fleet
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 name of the fleet.
fleet_name :: Lens.Lens' Fleet (Prelude.Maybe Prelude.Text)
fleet_name :: (Maybe Text -> f (Maybe Text)) -> Fleet -> f Fleet
fleet_name = (Fleet -> Maybe Text)
-> (Fleet -> Maybe Text -> Fleet)
-> Lens Fleet Fleet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fleet' {Maybe Text
name :: Maybe Text
$sel:name:Fleet' :: Fleet -> Maybe Text
name} -> Maybe Text
name) (\s :: Fleet
s@Fleet' {} Maybe Text
a -> Fleet
s {$sel:name:Fleet' :: Maybe Text
name = Maybe Text
a} :: Fleet)

-- | The time of the last deployment.
fleet_lastDeploymentTime :: Lens.Lens' Fleet (Prelude.Maybe Prelude.UTCTime)
fleet_lastDeploymentTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Fleet -> f Fleet
fleet_lastDeploymentTime = (Fleet -> Maybe POSIX)
-> (Fleet -> Maybe POSIX -> Fleet)
-> Lens Fleet Fleet (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Fleet' {Maybe POSIX
lastDeploymentTime :: Maybe POSIX
$sel:lastDeploymentTime:Fleet' :: Fleet -> Maybe POSIX
lastDeploymentTime} -> Maybe POSIX
lastDeploymentTime) (\s :: Fleet
s@Fleet' {} Maybe POSIX
a -> Fleet
s {$sel:lastDeploymentTime:Fleet' :: Maybe POSIX
lastDeploymentTime = Maybe POSIX
a} :: Fleet) ((Maybe POSIX -> f (Maybe POSIX)) -> Fleet -> f Fleet)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Fleet
-> f Fleet
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

instance Core.FromJSON Fleet where
  parseJSON :: Value -> Parser Fleet
parseJSON =
    String -> (Object -> Parser Fleet) -> Value -> Parser Fleet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Fleet"
      ( \Object
x ->
          Maybe Text
-> Maybe DeploymentStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Fleet
Fleet'
            (Maybe Text
 -> Maybe DeploymentStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Fleet)
-> Parser (Maybe Text)
-> Parser
     (Maybe DeploymentStatus
      -> Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
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
"lastDeploymentJob")
            Parser
  (Maybe DeploymentStatus
   -> Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
-> Parser (Maybe DeploymentStatus)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeploymentStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastDeploymentStatus")
            Parser
  (Maybe Text -> Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
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
"arn")
            Parser (Maybe POSIX -> Maybe Text -> Maybe POSIX -> Fleet)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> Fleet)
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 POSIX -> Fleet)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Fleet)
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 POSIX -> Fleet)
-> Parser (Maybe POSIX) -> Parser Fleet
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
"lastDeploymentTime")
      )

instance Prelude.Hashable Fleet

instance Prelude.NFData Fleet