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

-- | 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
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]
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
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. 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'
    { $sel:desiredInstances:ComputeCapacity' :: Int
desiredInstances =
        Int
pDesiredInstances_
    }

-- | The desired number of streaming instances.
computeCapacity_desiredInstances :: Lens.Lens' ComputeCapacity Prelude.Int
computeCapacity_desiredInstances :: Lens' ComputeCapacity Int
computeCapacity_desiredInstances = 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 where
  hashWithSalt :: Int -> ComputeCapacity -> Int
hashWithSalt Int
_salt ComputeCapacity' {Int
desiredInstances :: Int
$sel:desiredInstances:ComputeCapacity' :: ComputeCapacity -> Int
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
desiredInstances

instance Prelude.NFData ComputeCapacity where
  rnf :: ComputeCapacity -> ()
rnf ComputeCapacity' {Int
desiredInstances :: Int
$sel:desiredInstances:ComputeCapacity' :: ComputeCapacity -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
desiredInstances

instance Data.ToJSON ComputeCapacity where
  toJSON :: ComputeCapacity -> Value
toJSON ComputeCapacity' {Int
desiredInstances :: Int
$sel:desiredInstances:ComputeCapacity' :: ComputeCapacity -> Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"DesiredInstances" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
desiredInstances)
          ]
      )