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

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

-- | For a SQL-based Kinesis Data Analytics application, provides updates to
-- the parallelism count.
--
-- /See:/ 'newInputParallelismUpdate' smart constructor.
data InputParallelismUpdate = InputParallelismUpdate'
  { -- | The number of in-application streams to create for the specified
    -- streaming source.
    InputParallelismUpdate -> Natural
countUpdate :: 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' - The number of in-application streams to create for the specified
-- streaming source.
newInputParallelismUpdate ::
  -- | 'countUpdate'
  Prelude.Natural ->
  InputParallelismUpdate
newInputParallelismUpdate :: Natural -> InputParallelismUpdate
newInputParallelismUpdate Natural
pCountUpdate_ =
  InputParallelismUpdate' :: Natural -> InputParallelismUpdate
InputParallelismUpdate'
    { $sel:countUpdate:InputParallelismUpdate' :: Natural
countUpdate =
        Natural
pCountUpdate_
    }

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

instance Prelude.Hashable InputParallelismUpdate

instance Prelude.NFData InputParallelismUpdate

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