{-# 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.BulkDeploymentResult
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Greengrass.Types.BulkDeploymentResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types.DeploymentType
import Amazonka.Greengrass.Types.ErrorDetail
import qualified Amazonka.Prelude as Prelude

-- | Information about an individual group deployment in a bulk deployment
-- operation.
--
-- /See:/ 'newBulkDeploymentResult' smart constructor.
data BulkDeploymentResult = BulkDeploymentResult'
  { -- | The time, in ISO format, when the deployment was created.
    BulkDeploymentResult -> Maybe Text
createdAt :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the group deployment.
    BulkDeploymentResult -> Maybe Text
deploymentArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the group deployment.
    BulkDeploymentResult -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The current status of the group deployment: \'\'InProgress\'\',
    -- \'\'Building\'\', \'\'Success\'\', or \'\'Failure\'\'.
    BulkDeploymentResult -> Maybe Text
deploymentStatus :: Prelude.Maybe Prelude.Text,
    -- | The type of the deployment.
    BulkDeploymentResult -> Maybe DeploymentType
deploymentType :: Prelude.Maybe DeploymentType,
    -- | Details about the error.
    BulkDeploymentResult -> Maybe [ErrorDetail]
errorDetails :: Prelude.Maybe [ErrorDetail],
    -- | The error message for a failed deployment
    BulkDeploymentResult -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the Greengrass group.
    BulkDeploymentResult -> Maybe Text
groupArn :: Prelude.Maybe Prelude.Text
  }
  deriving (BulkDeploymentResult -> BulkDeploymentResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkDeploymentResult -> BulkDeploymentResult -> Bool
$c/= :: BulkDeploymentResult -> BulkDeploymentResult -> Bool
== :: BulkDeploymentResult -> BulkDeploymentResult -> Bool
$c== :: BulkDeploymentResult -> BulkDeploymentResult -> Bool
Prelude.Eq, ReadPrec [BulkDeploymentResult]
ReadPrec BulkDeploymentResult
Int -> ReadS BulkDeploymentResult
ReadS [BulkDeploymentResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkDeploymentResult]
$creadListPrec :: ReadPrec [BulkDeploymentResult]
readPrec :: ReadPrec BulkDeploymentResult
$creadPrec :: ReadPrec BulkDeploymentResult
readList :: ReadS [BulkDeploymentResult]
$creadList :: ReadS [BulkDeploymentResult]
readsPrec :: Int -> ReadS BulkDeploymentResult
$creadsPrec :: Int -> ReadS BulkDeploymentResult
Prelude.Read, Int -> BulkDeploymentResult -> ShowS
[BulkDeploymentResult] -> ShowS
BulkDeploymentResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkDeploymentResult] -> ShowS
$cshowList :: [BulkDeploymentResult] -> ShowS
show :: BulkDeploymentResult -> String
$cshow :: BulkDeploymentResult -> String
showsPrec :: Int -> BulkDeploymentResult -> ShowS
$cshowsPrec :: Int -> BulkDeploymentResult -> ShowS
Prelude.Show, forall x. Rep BulkDeploymentResult x -> BulkDeploymentResult
forall x. BulkDeploymentResult -> Rep BulkDeploymentResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkDeploymentResult x -> BulkDeploymentResult
$cfrom :: forall x. BulkDeploymentResult -> Rep BulkDeploymentResult x
Prelude.Generic)

-- |
-- Create a value of 'BulkDeploymentResult' 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:
--
-- 'createdAt', 'bulkDeploymentResult_createdAt' - The time, in ISO format, when the deployment was created.
--
-- 'deploymentArn', 'bulkDeploymentResult_deploymentArn' - The ARN of the group deployment.
--
-- 'deploymentId', 'bulkDeploymentResult_deploymentId' - The ID of the group deployment.
--
-- 'deploymentStatus', 'bulkDeploymentResult_deploymentStatus' - The current status of the group deployment: \'\'InProgress\'\',
-- \'\'Building\'\', \'\'Success\'\', or \'\'Failure\'\'.
--
-- 'deploymentType', 'bulkDeploymentResult_deploymentType' - The type of the deployment.
--
-- 'errorDetails', 'bulkDeploymentResult_errorDetails' - Details about the error.
--
-- 'errorMessage', 'bulkDeploymentResult_errorMessage' - The error message for a failed deployment
--
-- 'groupArn', 'bulkDeploymentResult_groupArn' - The ARN of the Greengrass group.
newBulkDeploymentResult ::
  BulkDeploymentResult
newBulkDeploymentResult :: BulkDeploymentResult
newBulkDeploymentResult =
  BulkDeploymentResult'
    { $sel:createdAt:BulkDeploymentResult' :: Maybe Text
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentArn:BulkDeploymentResult' :: Maybe Text
deploymentArn = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentId:BulkDeploymentResult' :: Maybe Text
deploymentId = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatus:BulkDeploymentResult' :: Maybe Text
deploymentStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentType:BulkDeploymentResult' :: Maybe DeploymentType
deploymentType = forall a. Maybe a
Prelude.Nothing,
      $sel:errorDetails:BulkDeploymentResult' :: Maybe [ErrorDetail]
errorDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BulkDeploymentResult' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:groupArn:BulkDeploymentResult' :: Maybe Text
groupArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The time, in ISO format, when the deployment was created.
bulkDeploymentResult_createdAt :: Lens.Lens' BulkDeploymentResult (Prelude.Maybe Prelude.Text)
bulkDeploymentResult_createdAt :: Lens' BulkDeploymentResult (Maybe Text)
bulkDeploymentResult_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentResult' {Maybe Text
createdAt :: Maybe Text
$sel:createdAt:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
createdAt} -> Maybe Text
createdAt) (\s :: BulkDeploymentResult
s@BulkDeploymentResult' {} Maybe Text
a -> BulkDeploymentResult
s {$sel:createdAt:BulkDeploymentResult' :: Maybe Text
createdAt = Maybe Text
a} :: BulkDeploymentResult)

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

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

-- | The current status of the group deployment: \'\'InProgress\'\',
-- \'\'Building\'\', \'\'Success\'\', or \'\'Failure\'\'.
bulkDeploymentResult_deploymentStatus :: Lens.Lens' BulkDeploymentResult (Prelude.Maybe Prelude.Text)
bulkDeploymentResult_deploymentStatus :: Lens' BulkDeploymentResult (Maybe Text)
bulkDeploymentResult_deploymentStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentResult' {Maybe Text
deploymentStatus :: Maybe Text
$sel:deploymentStatus:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
deploymentStatus} -> Maybe Text
deploymentStatus) (\s :: BulkDeploymentResult
s@BulkDeploymentResult' {} Maybe Text
a -> BulkDeploymentResult
s {$sel:deploymentStatus:BulkDeploymentResult' :: Maybe Text
deploymentStatus = Maybe Text
a} :: BulkDeploymentResult)

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

-- | Details about the error.
bulkDeploymentResult_errorDetails :: Lens.Lens' BulkDeploymentResult (Prelude.Maybe [ErrorDetail])
bulkDeploymentResult_errorDetails :: Lens' BulkDeploymentResult (Maybe [ErrorDetail])
bulkDeploymentResult_errorDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentResult' {Maybe [ErrorDetail]
errorDetails :: Maybe [ErrorDetail]
$sel:errorDetails:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe [ErrorDetail]
errorDetails} -> Maybe [ErrorDetail]
errorDetails) (\s :: BulkDeploymentResult
s@BulkDeploymentResult' {} Maybe [ErrorDetail]
a -> BulkDeploymentResult
s {$sel:errorDetails:BulkDeploymentResult' :: Maybe [ErrorDetail]
errorDetails = Maybe [ErrorDetail]
a} :: BulkDeploymentResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The error message for a failed deployment
bulkDeploymentResult_errorMessage :: Lens.Lens' BulkDeploymentResult (Prelude.Maybe Prelude.Text)
bulkDeploymentResult_errorMessage :: Lens' BulkDeploymentResult (Maybe Text)
bulkDeploymentResult_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentResult' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BulkDeploymentResult
s@BulkDeploymentResult' {} Maybe Text
a -> BulkDeploymentResult
s {$sel:errorMessage:BulkDeploymentResult' :: Maybe Text
errorMessage = Maybe Text
a} :: BulkDeploymentResult)

-- | The ARN of the Greengrass group.
bulkDeploymentResult_groupArn :: Lens.Lens' BulkDeploymentResult (Prelude.Maybe Prelude.Text)
bulkDeploymentResult_groupArn :: Lens' BulkDeploymentResult (Maybe Text)
bulkDeploymentResult_groupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentResult' {Maybe Text
groupArn :: Maybe Text
$sel:groupArn:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
groupArn} -> Maybe Text
groupArn) (\s :: BulkDeploymentResult
s@BulkDeploymentResult' {} Maybe Text
a -> BulkDeploymentResult
s {$sel:groupArn:BulkDeploymentResult' :: Maybe Text
groupArn = Maybe Text
a} :: BulkDeploymentResult)

instance Data.FromJSON BulkDeploymentResult where
  parseJSON :: Value -> Parser BulkDeploymentResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BulkDeploymentResult"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DeploymentType
-> Maybe [ErrorDetail]
-> Maybe Text
-> Maybe Text
-> BulkDeploymentResult
BulkDeploymentResult'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeploymentArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeploymentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeploymentStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeploymentType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ErrorDetails" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ErrorMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GroupArn")
      )

instance Prelude.Hashable BulkDeploymentResult where
  hashWithSalt :: Int -> BulkDeploymentResult -> Int
hashWithSalt Int
_salt BulkDeploymentResult' {Maybe [ErrorDetail]
Maybe Text
Maybe DeploymentType
groupArn :: Maybe Text
errorMessage :: Maybe Text
errorDetails :: Maybe [ErrorDetail]
deploymentType :: Maybe DeploymentType
deploymentStatus :: Maybe Text
deploymentId :: Maybe Text
deploymentArn :: Maybe Text
createdAt :: Maybe Text
$sel:groupArn:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:errorMessage:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:errorDetails:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe [ErrorDetail]
$sel:deploymentType:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe DeploymentType
$sel:deploymentStatus:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:deploymentId:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:deploymentArn:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:createdAt:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeploymentType
deploymentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ErrorDetail]
errorDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupArn

instance Prelude.NFData BulkDeploymentResult where
  rnf :: BulkDeploymentResult -> ()
rnf BulkDeploymentResult' {Maybe [ErrorDetail]
Maybe Text
Maybe DeploymentType
groupArn :: Maybe Text
errorMessage :: Maybe Text
errorDetails :: Maybe [ErrorDetail]
deploymentType :: Maybe DeploymentType
deploymentStatus :: Maybe Text
deploymentId :: Maybe Text
deploymentArn :: Maybe Text
createdAt :: Maybe Text
$sel:groupArn:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:errorMessage:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:errorDetails:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe [ErrorDetail]
$sel:deploymentType:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe DeploymentType
$sel:deploymentStatus:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:deploymentId:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:deploymentArn:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
$sel:createdAt:BulkDeploymentResult' :: BulkDeploymentResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeploymentType
deploymentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ErrorDetail]
errorDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupArn