{-# 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.BulkDeploymentMetrics
-- 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.BulkDeploymentMetrics where

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

-- | Relevant metrics on input records processed during bulk deployment.
--
-- /See:/ 'newBulkDeploymentMetrics' smart constructor.
data BulkDeploymentMetrics = BulkDeploymentMetrics'
  { -- | The total number of records that returned a non-retryable error. For
    -- example, this can occur if a group record from the input file uses an
    -- invalid format or specifies a nonexistent group version, or if the
    -- execution role doesn\'t grant permission to deploy a group or group
    -- version.
    BulkDeploymentMetrics -> Maybe Int
invalidInputRecords :: Prelude.Maybe Prelude.Int,
    -- | The total number of group records from the input file that have been
    -- processed so far, or attempted.
    BulkDeploymentMetrics -> Maybe Int
recordsProcessed :: Prelude.Maybe Prelude.Int,
    -- | The total number of deployment attempts that returned a retryable error.
    -- For example, a retry is triggered if the attempt to deploy a group
    -- returns a throttling error. \'\'StartBulkDeployment\'\' retries a group
    -- deployment up to five times.
    BulkDeploymentMetrics -> Maybe Int
retryAttempts :: Prelude.Maybe Prelude.Int
  }
  deriving (BulkDeploymentMetrics -> BulkDeploymentMetrics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BulkDeploymentMetrics -> BulkDeploymentMetrics -> Bool
$c/= :: BulkDeploymentMetrics -> BulkDeploymentMetrics -> Bool
== :: BulkDeploymentMetrics -> BulkDeploymentMetrics -> Bool
$c== :: BulkDeploymentMetrics -> BulkDeploymentMetrics -> Bool
Prelude.Eq, ReadPrec [BulkDeploymentMetrics]
ReadPrec BulkDeploymentMetrics
Int -> ReadS BulkDeploymentMetrics
ReadS [BulkDeploymentMetrics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BulkDeploymentMetrics]
$creadListPrec :: ReadPrec [BulkDeploymentMetrics]
readPrec :: ReadPrec BulkDeploymentMetrics
$creadPrec :: ReadPrec BulkDeploymentMetrics
readList :: ReadS [BulkDeploymentMetrics]
$creadList :: ReadS [BulkDeploymentMetrics]
readsPrec :: Int -> ReadS BulkDeploymentMetrics
$creadsPrec :: Int -> ReadS BulkDeploymentMetrics
Prelude.Read, Int -> BulkDeploymentMetrics -> ShowS
[BulkDeploymentMetrics] -> ShowS
BulkDeploymentMetrics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BulkDeploymentMetrics] -> ShowS
$cshowList :: [BulkDeploymentMetrics] -> ShowS
show :: BulkDeploymentMetrics -> String
$cshow :: BulkDeploymentMetrics -> String
showsPrec :: Int -> BulkDeploymentMetrics -> ShowS
$cshowsPrec :: Int -> BulkDeploymentMetrics -> ShowS
Prelude.Show, forall x. Rep BulkDeploymentMetrics x -> BulkDeploymentMetrics
forall x. BulkDeploymentMetrics -> Rep BulkDeploymentMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BulkDeploymentMetrics x -> BulkDeploymentMetrics
$cfrom :: forall x. BulkDeploymentMetrics -> Rep BulkDeploymentMetrics x
Prelude.Generic)

-- |
-- Create a value of 'BulkDeploymentMetrics' 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:
--
-- 'invalidInputRecords', 'bulkDeploymentMetrics_invalidInputRecords' - The total number of records that returned a non-retryable error. For
-- example, this can occur if a group record from the input file uses an
-- invalid format or specifies a nonexistent group version, or if the
-- execution role doesn\'t grant permission to deploy a group or group
-- version.
--
-- 'recordsProcessed', 'bulkDeploymentMetrics_recordsProcessed' - The total number of group records from the input file that have been
-- processed so far, or attempted.
--
-- 'retryAttempts', 'bulkDeploymentMetrics_retryAttempts' - The total number of deployment attempts that returned a retryable error.
-- For example, a retry is triggered if the attempt to deploy a group
-- returns a throttling error. \'\'StartBulkDeployment\'\' retries a group
-- deployment up to five times.
newBulkDeploymentMetrics ::
  BulkDeploymentMetrics
newBulkDeploymentMetrics :: BulkDeploymentMetrics
newBulkDeploymentMetrics =
  BulkDeploymentMetrics'
    { $sel:invalidInputRecords:BulkDeploymentMetrics' :: Maybe Int
invalidInputRecords =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recordsProcessed:BulkDeploymentMetrics' :: Maybe Int
recordsProcessed = forall a. Maybe a
Prelude.Nothing,
      $sel:retryAttempts:BulkDeploymentMetrics' :: Maybe Int
retryAttempts = forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of records that returned a non-retryable error. For
-- example, this can occur if a group record from the input file uses an
-- invalid format or specifies a nonexistent group version, or if the
-- execution role doesn\'t grant permission to deploy a group or group
-- version.
bulkDeploymentMetrics_invalidInputRecords :: Lens.Lens' BulkDeploymentMetrics (Prelude.Maybe Prelude.Int)
bulkDeploymentMetrics_invalidInputRecords :: Lens' BulkDeploymentMetrics (Maybe Int)
bulkDeploymentMetrics_invalidInputRecords = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentMetrics' {Maybe Int
invalidInputRecords :: Maybe Int
$sel:invalidInputRecords:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
invalidInputRecords} -> Maybe Int
invalidInputRecords) (\s :: BulkDeploymentMetrics
s@BulkDeploymentMetrics' {} Maybe Int
a -> BulkDeploymentMetrics
s {$sel:invalidInputRecords:BulkDeploymentMetrics' :: Maybe Int
invalidInputRecords = Maybe Int
a} :: BulkDeploymentMetrics)

-- | The total number of group records from the input file that have been
-- processed so far, or attempted.
bulkDeploymentMetrics_recordsProcessed :: Lens.Lens' BulkDeploymentMetrics (Prelude.Maybe Prelude.Int)
bulkDeploymentMetrics_recordsProcessed :: Lens' BulkDeploymentMetrics (Maybe Int)
bulkDeploymentMetrics_recordsProcessed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentMetrics' {Maybe Int
recordsProcessed :: Maybe Int
$sel:recordsProcessed:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
recordsProcessed} -> Maybe Int
recordsProcessed) (\s :: BulkDeploymentMetrics
s@BulkDeploymentMetrics' {} Maybe Int
a -> BulkDeploymentMetrics
s {$sel:recordsProcessed:BulkDeploymentMetrics' :: Maybe Int
recordsProcessed = Maybe Int
a} :: BulkDeploymentMetrics)

-- | The total number of deployment attempts that returned a retryable error.
-- For example, a retry is triggered if the attempt to deploy a group
-- returns a throttling error. \'\'StartBulkDeployment\'\' retries a group
-- deployment up to five times.
bulkDeploymentMetrics_retryAttempts :: Lens.Lens' BulkDeploymentMetrics (Prelude.Maybe Prelude.Int)
bulkDeploymentMetrics_retryAttempts :: Lens' BulkDeploymentMetrics (Maybe Int)
bulkDeploymentMetrics_retryAttempts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BulkDeploymentMetrics' {Maybe Int
retryAttempts :: Maybe Int
$sel:retryAttempts:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
retryAttempts} -> Maybe Int
retryAttempts) (\s :: BulkDeploymentMetrics
s@BulkDeploymentMetrics' {} Maybe Int
a -> BulkDeploymentMetrics
s {$sel:retryAttempts:BulkDeploymentMetrics' :: Maybe Int
retryAttempts = Maybe Int
a} :: BulkDeploymentMetrics)

instance Data.FromJSON BulkDeploymentMetrics where
  parseJSON :: Value -> Parser BulkDeploymentMetrics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BulkDeploymentMetrics"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Int -> BulkDeploymentMetrics
BulkDeploymentMetrics'
            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
"InvalidInputRecords")
            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
"RecordsProcessed")
            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
"RetryAttempts")
      )

instance Prelude.Hashable BulkDeploymentMetrics where
  hashWithSalt :: Int -> BulkDeploymentMetrics -> Int
hashWithSalt Int
_salt BulkDeploymentMetrics' {Maybe Int
retryAttempts :: Maybe Int
recordsProcessed :: Maybe Int
invalidInputRecords :: Maybe Int
$sel:retryAttempts:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
$sel:recordsProcessed:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
$sel:invalidInputRecords:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
invalidInputRecords
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
recordsProcessed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
retryAttempts

instance Prelude.NFData BulkDeploymentMetrics where
  rnf :: BulkDeploymentMetrics -> ()
rnf BulkDeploymentMetrics' {Maybe Int
retryAttempts :: Maybe Int
recordsProcessed :: Maybe Int
invalidInputRecords :: Maybe Int
$sel:retryAttempts:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
$sel:recordsProcessed:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
$sel:invalidInputRecords:BulkDeploymentMetrics' :: BulkDeploymentMetrics -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
invalidInputRecords
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
recordsProcessed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
retryAttempts