{-# 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.Greengrass.Types.Deployment
-- 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.Greengrass.Types.Deployment where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types.DeploymentType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a deployment.
--
-- /See:/ 'newDeployment' smart constructor.
data Deployment = Deployment'
  { -- | The ID of the deployment.
    Deployment -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the deployment.
    Deployment -> Maybe Text
deploymentArn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the deployment was
    -- created.
    Deployment -> Maybe Text
createdAt :: Prelude.Maybe Prelude.Text,
    -- | The type of the deployment.
    Deployment -> Maybe DeploymentType
deploymentType :: Prelude.Maybe DeploymentType,
    -- | The ARN of the group for this deployment.
    Deployment -> Maybe Text
groupArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Deployment -> Deployment -> Bool
(Deployment -> Deployment -> Bool)
-> (Deployment -> Deployment -> Bool) -> Eq Deployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Deployment -> Deployment -> Bool
$c/= :: Deployment -> Deployment -> Bool
== :: Deployment -> Deployment -> Bool
$c== :: Deployment -> Deployment -> Bool
Prelude.Eq, ReadPrec [Deployment]
ReadPrec Deployment
Int -> ReadS Deployment
ReadS [Deployment]
(Int -> ReadS Deployment)
-> ReadS [Deployment]
-> ReadPrec Deployment
-> ReadPrec [Deployment]
-> Read Deployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Deployment]
$creadListPrec :: ReadPrec [Deployment]
readPrec :: ReadPrec Deployment
$creadPrec :: ReadPrec Deployment
readList :: ReadS [Deployment]
$creadList :: ReadS [Deployment]
readsPrec :: Int -> ReadS Deployment
$creadsPrec :: Int -> ReadS Deployment
Prelude.Read, Int -> Deployment -> ShowS
[Deployment] -> ShowS
Deployment -> String
(Int -> Deployment -> ShowS)
-> (Deployment -> String)
-> ([Deployment] -> ShowS)
-> Show Deployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Deployment] -> ShowS
$cshowList :: [Deployment] -> ShowS
show :: Deployment -> String
$cshow :: Deployment -> String
showsPrec :: Int -> Deployment -> ShowS
$cshowsPrec :: Int -> Deployment -> ShowS
Prelude.Show, (forall x. Deployment -> Rep Deployment x)
-> (forall x. Rep Deployment x -> Deployment) -> Generic Deployment
forall x. Rep Deployment x -> Deployment
forall x. Deployment -> Rep Deployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Deployment x -> Deployment
$cfrom :: forall x. Deployment -> Rep Deployment x
Prelude.Generic)

-- |
-- Create a value of 'Deployment' 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:
--
-- 'deploymentId', 'deployment_deploymentId' - The ID of the deployment.
--
-- 'deploymentArn', 'deployment_deploymentArn' - The ARN of the deployment.
--
-- 'createdAt', 'deployment_createdAt' - The time, in milliseconds since the epoch, when the deployment was
-- created.
--
-- 'deploymentType', 'deployment_deploymentType' - The type of the deployment.
--
-- 'groupArn', 'deployment_groupArn' - The ARN of the group for this deployment.
newDeployment ::
  Deployment
newDeployment :: Deployment
newDeployment =
  Deployment' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DeploymentType
-> Maybe Text
-> Deployment
Deployment'
    { $sel:deploymentId:Deployment' :: Maybe Text
deploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentArn:Deployment' :: Maybe Text
deploymentArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Deployment' :: Maybe Text
createdAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentType:Deployment' :: Maybe DeploymentType
deploymentType = Maybe DeploymentType
forall a. Maybe a
Prelude.Nothing,
      $sel:groupArn:Deployment' :: Maybe Text
groupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the deployment.
deployment_deploymentId :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_deploymentId :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_deploymentId = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:Deployment' :: Deployment -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:deploymentId:Deployment' :: Maybe Text
deploymentId = Maybe Text
a} :: Deployment)

-- | The ARN of the deployment.
deployment_deploymentArn :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_deploymentArn :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_deploymentArn = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
deploymentArn :: Maybe Text
$sel:deploymentArn:Deployment' :: Deployment -> Maybe Text
deploymentArn} -> Maybe Text
deploymentArn) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:deploymentArn:Deployment' :: Maybe Text
deploymentArn = Maybe Text
a} :: Deployment)

-- | The time, in milliseconds since the epoch, when the deployment was
-- created.
deployment_createdAt :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_createdAt :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_createdAt = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
createdAt :: Maybe Text
$sel:createdAt:Deployment' :: Deployment -> Maybe Text
createdAt} -> Maybe Text
createdAt) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:createdAt:Deployment' :: Maybe Text
createdAt = Maybe Text
a} :: Deployment)

-- | The type of the deployment.
deployment_deploymentType :: Lens.Lens' Deployment (Prelude.Maybe DeploymentType)
deployment_deploymentType :: (Maybe DeploymentType -> f (Maybe DeploymentType))
-> Deployment -> f Deployment
deployment_deploymentType = (Deployment -> Maybe DeploymentType)
-> (Deployment -> Maybe DeploymentType -> Deployment)
-> Lens
     Deployment Deployment (Maybe DeploymentType) (Maybe DeploymentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe DeploymentType
deploymentType :: Maybe DeploymentType
$sel:deploymentType:Deployment' :: Deployment -> Maybe DeploymentType
deploymentType} -> Maybe DeploymentType
deploymentType) (\s :: Deployment
s@Deployment' {} Maybe DeploymentType
a -> Deployment
s {$sel:deploymentType:Deployment' :: Maybe DeploymentType
deploymentType = Maybe DeploymentType
a} :: Deployment)

-- | The ARN of the group for this deployment.
deployment_groupArn :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_groupArn :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_groupArn = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
groupArn :: Maybe Text
$sel:groupArn:Deployment' :: Deployment -> Maybe Text
groupArn} -> Maybe Text
groupArn) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:groupArn:Deployment' :: Maybe Text
groupArn = Maybe Text
a} :: Deployment)

instance Core.FromJSON Deployment where
  parseJSON :: Value -> Parser Deployment
parseJSON =
    String
-> (Object -> Parser Deployment) -> Value -> Parser Deployment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Deployment"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DeploymentType
-> Maybe Text
-> Deployment
Deployment'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe DeploymentType
 -> Maybe Text
 -> Deployment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe DeploymentType -> Maybe Text -> Deployment)
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
"DeploymentId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe DeploymentType -> Maybe Text -> Deployment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe DeploymentType -> Maybe Text -> Deployment)
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
"DeploymentArn")
            Parser
  (Maybe Text -> Maybe DeploymentType -> Maybe Text -> Deployment)
-> Parser (Maybe Text)
-> Parser (Maybe DeploymentType -> Maybe Text -> Deployment)
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
"CreatedAt")
            Parser (Maybe DeploymentType -> Maybe Text -> Deployment)
-> Parser (Maybe DeploymentType)
-> Parser (Maybe Text -> Deployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeploymentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeploymentType")
            Parser (Maybe Text -> Deployment)
-> Parser (Maybe Text) -> Parser Deployment
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
"GroupArn")
      )

instance Prelude.Hashable Deployment

instance Prelude.NFData Deployment