{-# 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.OpsWorks.Types.StackSummary
-- 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.OpsWorks.Types.StackSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpsWorks.Types.InstancesCount
import qualified Amazonka.Prelude as Prelude

-- | Summarizes the number of layers, instances, and apps in a stack.
--
-- /See:/ 'newStackSummary' smart constructor.
data StackSummary = StackSummary'
  { -- | The number of apps.
    StackSummary -> Maybe Int
appsCount :: Prelude.Maybe Prelude.Int,
    -- | The stack\'s ARN.
    StackSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | An @InstancesCount@ object with the number of instances in each status.
    StackSummary -> Maybe InstancesCount
instancesCount :: Prelude.Maybe InstancesCount,
    -- | The number of layers.
    StackSummary -> Maybe Int
layersCount :: Prelude.Maybe Prelude.Int,
    -- | The stack name.
    StackSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The stack ID.
    StackSummary -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text
  }
  deriving (StackSummary -> StackSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackSummary -> StackSummary -> Bool
$c/= :: StackSummary -> StackSummary -> Bool
== :: StackSummary -> StackSummary -> Bool
$c== :: StackSummary -> StackSummary -> Bool
Prelude.Eq, ReadPrec [StackSummary]
ReadPrec StackSummary
Int -> ReadS StackSummary
ReadS [StackSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackSummary]
$creadListPrec :: ReadPrec [StackSummary]
readPrec :: ReadPrec StackSummary
$creadPrec :: ReadPrec StackSummary
readList :: ReadS [StackSummary]
$creadList :: ReadS [StackSummary]
readsPrec :: Int -> ReadS StackSummary
$creadsPrec :: Int -> ReadS StackSummary
Prelude.Read, Int -> StackSummary -> ShowS
[StackSummary] -> ShowS
StackSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackSummary] -> ShowS
$cshowList :: [StackSummary] -> ShowS
show :: StackSummary -> String
$cshow :: StackSummary -> String
showsPrec :: Int -> StackSummary -> ShowS
$cshowsPrec :: Int -> StackSummary -> ShowS
Prelude.Show, forall x. Rep StackSummary x -> StackSummary
forall x. StackSummary -> Rep StackSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StackSummary x -> StackSummary
$cfrom :: forall x. StackSummary -> Rep StackSummary x
Prelude.Generic)

-- |
-- Create a value of 'StackSummary' 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:
--
-- 'appsCount', 'stackSummary_appsCount' - The number of apps.
--
-- 'arn', 'stackSummary_arn' - The stack\'s ARN.
--
-- 'instancesCount', 'stackSummary_instancesCount' - An @InstancesCount@ object with the number of instances in each status.
--
-- 'layersCount', 'stackSummary_layersCount' - The number of layers.
--
-- 'name', 'stackSummary_name' - The stack name.
--
-- 'stackId', 'stackSummary_stackId' - The stack ID.
newStackSummary ::
  StackSummary
newStackSummary :: StackSummary
newStackSummary =
  StackSummary'
    { $sel:appsCount:StackSummary' :: Maybe Int
appsCount = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:StackSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:instancesCount:StackSummary' :: Maybe InstancesCount
instancesCount = forall a. Maybe a
Prelude.Nothing,
      $sel:layersCount:StackSummary' :: Maybe Int
layersCount = forall a. Maybe a
Prelude.Nothing,
      $sel:name:StackSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:StackSummary' :: Maybe Text
stackId = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of apps.
stackSummary_appsCount :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Int)
stackSummary_appsCount :: Lens' StackSummary (Maybe Int)
stackSummary_appsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe Int
appsCount :: Maybe Int
$sel:appsCount:StackSummary' :: StackSummary -> Maybe Int
appsCount} -> Maybe Int
appsCount) (\s :: StackSummary
s@StackSummary' {} Maybe Int
a -> StackSummary
s {$sel:appsCount:StackSummary' :: Maybe Int
appsCount = Maybe Int
a} :: StackSummary)

-- | The stack\'s ARN.
stackSummary_arn :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Text)
stackSummary_arn :: Lens' StackSummary (Maybe Text)
stackSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:StackSummary' :: StackSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: StackSummary
s@StackSummary' {} Maybe Text
a -> StackSummary
s {$sel:arn:StackSummary' :: Maybe Text
arn = Maybe Text
a} :: StackSummary)

-- | An @InstancesCount@ object with the number of instances in each status.
stackSummary_instancesCount :: Lens.Lens' StackSummary (Prelude.Maybe InstancesCount)
stackSummary_instancesCount :: Lens' StackSummary (Maybe InstancesCount)
stackSummary_instancesCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe InstancesCount
instancesCount :: Maybe InstancesCount
$sel:instancesCount:StackSummary' :: StackSummary -> Maybe InstancesCount
instancesCount} -> Maybe InstancesCount
instancesCount) (\s :: StackSummary
s@StackSummary' {} Maybe InstancesCount
a -> StackSummary
s {$sel:instancesCount:StackSummary' :: Maybe InstancesCount
instancesCount = Maybe InstancesCount
a} :: StackSummary)

-- | The number of layers.
stackSummary_layersCount :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Int)
stackSummary_layersCount :: Lens' StackSummary (Maybe Int)
stackSummary_layersCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe Int
layersCount :: Maybe Int
$sel:layersCount:StackSummary' :: StackSummary -> Maybe Int
layersCount} -> Maybe Int
layersCount) (\s :: StackSummary
s@StackSummary' {} Maybe Int
a -> StackSummary
s {$sel:layersCount:StackSummary' :: Maybe Int
layersCount = Maybe Int
a} :: StackSummary)

-- | The stack name.
stackSummary_name :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Text)
stackSummary_name :: Lens' StackSummary (Maybe Text)
stackSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe Text
name :: Maybe Text
$sel:name:StackSummary' :: StackSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: StackSummary
s@StackSummary' {} Maybe Text
a -> StackSummary
s {$sel:name:StackSummary' :: Maybe Text
name = Maybe Text
a} :: StackSummary)

-- | The stack ID.
stackSummary_stackId :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Text)
stackSummary_stackId :: Lens' StackSummary (Maybe Text)
stackSummary_stackId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSummary' {Maybe Text
stackId :: Maybe Text
$sel:stackId:StackSummary' :: StackSummary -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: StackSummary
s@StackSummary' {} Maybe Text
a -> StackSummary
s {$sel:stackId:StackSummary' :: Maybe Text
stackId = Maybe Text
a} :: StackSummary)

instance Data.FromJSON StackSummary where
  parseJSON :: Value -> Parser StackSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StackSummary"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe InstancesCount
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> StackSummary
StackSummary'
            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
"AppsCount")
            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
"Arn")
            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
"InstancesCount")
            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
"LayersCount")
            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
"Name")
            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
"StackId")
      )

instance Prelude.Hashable StackSummary where
  hashWithSalt :: Int -> StackSummary -> Int
hashWithSalt Int
_salt StackSummary' {Maybe Int
Maybe Text
Maybe InstancesCount
stackId :: Maybe Text
name :: Maybe Text
layersCount :: Maybe Int
instancesCount :: Maybe InstancesCount
arn :: Maybe Text
appsCount :: Maybe Int
$sel:stackId:StackSummary' :: StackSummary -> Maybe Text
$sel:name:StackSummary' :: StackSummary -> Maybe Text
$sel:layersCount:StackSummary' :: StackSummary -> Maybe Int
$sel:instancesCount:StackSummary' :: StackSummary -> Maybe InstancesCount
$sel:arn:StackSummary' :: StackSummary -> Maybe Text
$sel:appsCount:StackSummary' :: StackSummary -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
appsCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstancesCount
instancesCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
layersCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stackId

instance Prelude.NFData StackSummary where
  rnf :: StackSummary -> ()
rnf StackSummary' {Maybe Int
Maybe Text
Maybe InstancesCount
stackId :: Maybe Text
name :: Maybe Text
layersCount :: Maybe Int
instancesCount :: Maybe InstancesCount
arn :: Maybe Text
appsCount :: Maybe Int
$sel:stackId:StackSummary' :: StackSummary -> Maybe Text
$sel:name:StackSummary' :: StackSummary -> Maybe Text
$sel:layersCount:StackSummary' :: StackSummary -> Maybe Int
$sel:instancesCount:StackSummary' :: StackSummary -> Maybe InstancesCount
$sel:arn:StackSummary' :: StackSummary -> Maybe Text
$sel:appsCount:StackSummary' :: StackSummary -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
appsCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstancesCount
instancesCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
layersCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackId