{-# 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.KinesisAnalytics.Types.InputParallelismUpdate
-- 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.KinesisAnalytics.Types.InputParallelismUpdate where

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

-- | Provides updates to the parallelism count.
--
-- /See:/ 'newInputParallelismUpdate' smart constructor.
data InputParallelismUpdate = InputParallelismUpdate'
  { -- | Number of in-application streams to create for the specified streaming
    -- source.
    InputParallelismUpdate -> Maybe Natural
countUpdate :: Prelude.Maybe Prelude.Natural
  }
  deriving (InputParallelismUpdate -> InputParallelismUpdate -> Bool
(InputParallelismUpdate -> InputParallelismUpdate -> Bool)
-> (InputParallelismUpdate -> InputParallelismUpdate -> Bool)
-> Eq InputParallelismUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputParallelismUpdate -> InputParallelismUpdate -> Bool
$c/= :: InputParallelismUpdate -> InputParallelismUpdate -> Bool
== :: InputParallelismUpdate -> InputParallelismUpdate -> Bool
$c== :: InputParallelismUpdate -> InputParallelismUpdate -> Bool
Prelude.Eq, ReadPrec [InputParallelismUpdate]
ReadPrec InputParallelismUpdate
Int -> ReadS InputParallelismUpdate
ReadS [InputParallelismUpdate]
(Int -> ReadS InputParallelismUpdate)
-> ReadS [InputParallelismUpdate]
-> ReadPrec InputParallelismUpdate
-> ReadPrec [InputParallelismUpdate]
-> Read InputParallelismUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputParallelismUpdate]
$creadListPrec :: ReadPrec [InputParallelismUpdate]
readPrec :: ReadPrec InputParallelismUpdate
$creadPrec :: ReadPrec InputParallelismUpdate
readList :: ReadS [InputParallelismUpdate]
$creadList :: ReadS [InputParallelismUpdate]
readsPrec :: Int -> ReadS InputParallelismUpdate
$creadsPrec :: Int -> ReadS InputParallelismUpdate
Prelude.Read, Int -> InputParallelismUpdate -> ShowS
[InputParallelismUpdate] -> ShowS
InputParallelismUpdate -> String
(Int -> InputParallelismUpdate -> ShowS)
-> (InputParallelismUpdate -> String)
-> ([InputParallelismUpdate] -> ShowS)
-> Show InputParallelismUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputParallelismUpdate] -> ShowS
$cshowList :: [InputParallelismUpdate] -> ShowS
show :: InputParallelismUpdate -> String
$cshow :: InputParallelismUpdate -> String
showsPrec :: Int -> InputParallelismUpdate -> ShowS
$cshowsPrec :: Int -> InputParallelismUpdate -> ShowS
Prelude.Show, (forall x. InputParallelismUpdate -> Rep InputParallelismUpdate x)
-> (forall x.
    Rep InputParallelismUpdate x -> InputParallelismUpdate)
-> Generic InputParallelismUpdate
forall x. Rep InputParallelismUpdate x -> InputParallelismUpdate
forall x. InputParallelismUpdate -> Rep InputParallelismUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputParallelismUpdate x -> InputParallelismUpdate
$cfrom :: forall x. InputParallelismUpdate -> Rep InputParallelismUpdate x
Prelude.Generic)

-- |
-- Create a value of 'InputParallelismUpdate' 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:
--
-- 'countUpdate', 'inputParallelismUpdate_countUpdate' - Number of in-application streams to create for the specified streaming
-- source.
newInputParallelismUpdate ::
  InputParallelismUpdate
newInputParallelismUpdate :: InputParallelismUpdate
newInputParallelismUpdate =
  InputParallelismUpdate' :: Maybe Natural -> InputParallelismUpdate
InputParallelismUpdate'
    { $sel:countUpdate:InputParallelismUpdate' :: Maybe Natural
countUpdate =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Number of in-application streams to create for the specified streaming
-- source.
inputParallelismUpdate_countUpdate :: Lens.Lens' InputParallelismUpdate (Prelude.Maybe Prelude.Natural)
inputParallelismUpdate_countUpdate :: (Maybe Natural -> f (Maybe Natural))
-> InputParallelismUpdate -> f InputParallelismUpdate
inputParallelismUpdate_countUpdate = (InputParallelismUpdate -> Maybe Natural)
-> (InputParallelismUpdate
    -> Maybe Natural -> InputParallelismUpdate)
-> Lens
     InputParallelismUpdate
     InputParallelismUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputParallelismUpdate' {Maybe Natural
countUpdate :: Maybe Natural
$sel:countUpdate:InputParallelismUpdate' :: InputParallelismUpdate -> Maybe Natural
countUpdate} -> Maybe Natural
countUpdate) (\s :: InputParallelismUpdate
s@InputParallelismUpdate' {} Maybe Natural
a -> InputParallelismUpdate
s {$sel:countUpdate:InputParallelismUpdate' :: Maybe Natural
countUpdate = Maybe Natural
a} :: InputParallelismUpdate)

instance Prelude.Hashable InputParallelismUpdate

instance Prelude.NFData InputParallelismUpdate

instance Core.ToJSON InputParallelismUpdate where
  toJSON :: InputParallelismUpdate -> Value
toJSON InputParallelismUpdate' {Maybe Natural
countUpdate :: Maybe Natural
$sel:countUpdate:InputParallelismUpdate' :: InputParallelismUpdate -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"CountUpdate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
countUpdate]
      )