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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 stack\'s ARN.
    StackSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The number of apps.
    StackSummary -> Maybe Int
appsCount :: 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,
    -- | The number of layers.
    StackSummary -> Maybe Int
layersCount :: Prelude.Maybe Prelude.Int,
    -- | An @InstancesCount@ object with the number of instances in each status.
    StackSummary -> Maybe InstancesCount
instancesCount :: Prelude.Maybe InstancesCount
  }
  deriving (StackSummary -> StackSummary -> Bool
(StackSummary -> StackSummary -> Bool)
-> (StackSummary -> StackSummary -> Bool) -> Eq StackSummary
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]
(Int -> ReadS StackSummary)
-> ReadS [StackSummary]
-> ReadPrec StackSummary
-> ReadPrec [StackSummary]
-> Read 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
(Int -> StackSummary -> ShowS)
-> (StackSummary -> String)
-> ([StackSummary] -> ShowS)
-> Show StackSummary
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. StackSummary -> Rep StackSummary x)
-> (forall x. Rep StackSummary x -> StackSummary)
-> Generic StackSummary
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:
--
-- 'arn', 'stackSummary_arn' - The stack\'s ARN.
--
-- 'appsCount', 'stackSummary_appsCount' - The number of apps.
--
-- 'name', 'stackSummary_name' - The stack name.
--
-- 'stackId', 'stackSummary_stackId' - The stack ID.
--
-- 'layersCount', 'stackSummary_layersCount' - The number of layers.
--
-- 'instancesCount', 'stackSummary_instancesCount' - An @InstancesCount@ object with the number of instances in each status.
newStackSummary ::
  StackSummary
newStackSummary :: StackSummary
newStackSummary =
  StackSummary' :: Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe InstancesCount
-> StackSummary
StackSummary'
    { $sel:arn:StackSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appsCount:StackSummary' :: Maybe Int
appsCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:StackSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:StackSummary' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:layersCount:StackSummary' :: Maybe Int
layersCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:instancesCount:StackSummary' :: Maybe InstancesCount
instancesCount = Maybe InstancesCount
forall a. Maybe a
Prelude.Nothing
    }

-- | The stack\'s ARN.
stackSummary_arn :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Text)
stackSummary_arn :: (Maybe Text -> f (Maybe Text)) -> StackSummary -> f StackSummary
stackSummary_arn = (StackSummary -> Maybe Text)
-> (StackSummary -> Maybe Text -> StackSummary)
-> Lens StackSummary StackSummary (Maybe Text) (Maybe Text)
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)

-- | The number of apps.
stackSummary_appsCount :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Int)
stackSummary_appsCount :: (Maybe Int -> f (Maybe Int)) -> StackSummary -> f StackSummary
stackSummary_appsCount = (StackSummary -> Maybe Int)
-> (StackSummary -> Maybe Int -> StackSummary)
-> Lens StackSummary StackSummary (Maybe Int) (Maybe Int)
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 name.
stackSummary_name :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Text)
stackSummary_name :: (Maybe Text -> f (Maybe Text)) -> StackSummary -> f StackSummary
stackSummary_name = (StackSummary -> Maybe Text)
-> (StackSummary -> Maybe Text -> StackSummary)
-> Lens StackSummary StackSummary (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> StackSummary -> f StackSummary
stackSummary_stackId = (StackSummary -> Maybe Text)
-> (StackSummary -> Maybe Text -> StackSummary)
-> Lens StackSummary StackSummary (Maybe Text) (Maybe Text)
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)

-- | The number of layers.
stackSummary_layersCount :: Lens.Lens' StackSummary (Prelude.Maybe Prelude.Int)
stackSummary_layersCount :: (Maybe Int -> f (Maybe Int)) -> StackSummary -> f StackSummary
stackSummary_layersCount = (StackSummary -> Maybe Int)
-> (StackSummary -> Maybe Int -> StackSummary)
-> Lens StackSummary StackSummary (Maybe Int) (Maybe Int)
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)

-- | An @InstancesCount@ object with the number of instances in each status.
stackSummary_instancesCount :: Lens.Lens' StackSummary (Prelude.Maybe InstancesCount)
stackSummary_instancesCount :: (Maybe InstancesCount -> f (Maybe InstancesCount))
-> StackSummary -> f StackSummary
stackSummary_instancesCount = (StackSummary -> Maybe InstancesCount)
-> (StackSummary -> Maybe InstancesCount -> StackSummary)
-> Lens
     StackSummary
     StackSummary
     (Maybe InstancesCount)
     (Maybe 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)

instance Core.FromJSON StackSummary where
  parseJSON :: Value -> Parser StackSummary
parseJSON =
    String
-> (Object -> Parser StackSummary) -> Value -> Parser StackSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StackSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe InstancesCount
-> StackSummary
StackSummary'
            (Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe InstancesCount
 -> StackSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe InstancesCount
      -> StackSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe InstancesCount
   -> StackSummary)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Int -> Maybe InstancesCount -> StackSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AppsCount")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Int -> Maybe InstancesCount -> StackSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Int -> Maybe InstancesCount -> StackSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe Text -> Maybe Int -> Maybe InstancesCount -> StackSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe InstancesCount -> StackSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StackId")
            Parser (Maybe Int -> Maybe InstancesCount -> StackSummary)
-> Parser (Maybe Int)
-> Parser (Maybe InstancesCount -> StackSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LayersCount")
            Parser (Maybe InstancesCount -> StackSummary)
-> Parser (Maybe InstancesCount) -> Parser StackSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InstancesCount)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstancesCount")
      )

instance Prelude.Hashable StackSummary

instance Prelude.NFData StackSummary