{-# 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.AppStream.Types.ComputeCapacity
-- 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.AppStream.Types.ComputeCapacity where

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

-- | Describes the capacity for a fleet.
--
-- /See:/ 'newComputeCapacity' smart constructor.
data ComputeCapacity = ComputeCapacity'
  { -- | The desired number of streaming instances.
    ComputeCapacity -> Int
desiredInstances :: Prelude.Int
  }
  deriving (ComputeCapacity -> ComputeCapacity -> Bool
(ComputeCapacity -> ComputeCapacity -> Bool)
-> (ComputeCapacity -> ComputeCapacity -> Bool)
-> Eq ComputeCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputeCapacity -> ComputeCapacity -> Bool
$c/= :: ComputeCapacity -> ComputeCapacity -> Bool
== :: ComputeCapacity -> ComputeCapacity -> Bool
$c== :: ComputeCapacity -> ComputeCapacity -> Bool
Prelude.Eq, ReadPrec [ComputeCapacity]
ReadPrec ComputeCapacity
Int -> ReadS ComputeCapacity
ReadS [ComputeCapacity]
(Int -> ReadS ComputeCapacity)
-> ReadS [ComputeCapacity]
-> ReadPrec ComputeCapacity
-> ReadPrec [ComputeCapacity]
-> Read ComputeCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputeCapacity]
$creadListPrec :: ReadPrec [ComputeCapacity]
readPrec :: ReadPrec ComputeCapacity
$creadPrec :: ReadPrec ComputeCapacity
readList :: ReadS [ComputeCapacity]
$creadList :: ReadS [ComputeCapacity]
readsPrec :: Int -> ReadS ComputeCapacity
$creadsPrec :: Int -> ReadS ComputeCapacity
Prelude.Read, Int -> ComputeCapacity -> ShowS
[ComputeCapacity] -> ShowS
ComputeCapacity -> String
(Int -> ComputeCapacity -> ShowS)
-> (ComputeCapacity -> String)
-> ([ComputeCapacity] -> ShowS)
-> Show ComputeCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputeCapacity] -> ShowS
$cshowList :: [ComputeCapacity] -> ShowS
show :: ComputeCapacity -> String
$cshow :: ComputeCapacity -> String
showsPrec :: Int -> ComputeCapacity -> ShowS
$cshowsPrec :: Int -> ComputeCapacity -> ShowS
Prelude.Show, (forall x. ComputeCapacity -> Rep ComputeCapacity x)
-> (forall x. Rep ComputeCapacity x -> ComputeCapacity)
-> Generic ComputeCapacity
forall x. Rep ComputeCapacity x -> ComputeCapacity
forall x. ComputeCapacity -> Rep ComputeCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputeCapacity x -> ComputeCapacity
$cfrom :: forall x. ComputeCapacity -> Rep ComputeCapacity x
Prelude.Generic)

-- |
-- Create a value of 'ComputeCapacity' 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:
--
-- 'desiredInstances', 'computeCapacity_desiredInstances' - The desired number of streaming instances.
newComputeCapacity ::
  -- | 'desiredInstances'
  Prelude.Int ->
  ComputeCapacity
newComputeCapacity :: Int -> ComputeCapacity
newComputeCapacity Int
pDesiredInstances_ =
  ComputeCapacity' :: Int -> ComputeCapacity
ComputeCapacity'
    { $sel:desiredInstances:ComputeCapacity' :: Int
desiredInstances =
        Int
pDesiredInstances_
    }

-- | The desired number of streaming instances.
computeCapacity_desiredInstances :: Lens.Lens' ComputeCapacity Prelude.Int
computeCapacity_desiredInstances :: (Int -> f Int) -> ComputeCapacity -> f ComputeCapacity
computeCapacity_desiredInstances = (ComputeCapacity -> Int)
-> (ComputeCapacity -> Int -> ComputeCapacity)
-> Lens ComputeCapacity ComputeCapacity Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeCapacity' {Int
desiredInstances :: Int
$sel:desiredInstances:ComputeCapacity' :: ComputeCapacity -> Int
desiredInstances} -> Int
desiredInstances) (\s :: ComputeCapacity
s@ComputeCapacity' {} Int
a -> ComputeCapacity
s {$sel:desiredInstances:ComputeCapacity' :: Int
desiredInstances = Int
a} :: ComputeCapacity)

instance Prelude.Hashable ComputeCapacity

instance Prelude.NFData ComputeCapacity

instance Core.ToJSON ComputeCapacity where
  toJSON :: ComputeCapacity -> Value
toJSON ComputeCapacity' {Int
desiredInstances :: Int
$sel:desiredInstances:ComputeCapacity' :: ComputeCapacity -> Int
..} =
    [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
"DesiredInstances" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
desiredInstances)
          ]
      )