{-# 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.CodeDeploy.Types.AutoScalingGroup
-- 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.CodeDeploy.Types.AutoScalingGroup 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

-- | Information about an Auto Scaling group.
--
-- /See:/ 'newAutoScalingGroup' smart constructor.
data AutoScalingGroup = AutoScalingGroup'
  { -- | An Auto Scaling lifecycle event hook name.
    AutoScalingGroup -> Maybe Text
hook :: Prelude.Maybe Prelude.Text,
    -- | The Auto Scaling group name.
    AutoScalingGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AutoScalingGroup -> AutoScalingGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingGroup -> AutoScalingGroup -> Bool
$c/= :: AutoScalingGroup -> AutoScalingGroup -> Bool
== :: AutoScalingGroup -> AutoScalingGroup -> Bool
$c== :: AutoScalingGroup -> AutoScalingGroup -> Bool
Prelude.Eq, ReadPrec [AutoScalingGroup]
ReadPrec AutoScalingGroup
Int -> ReadS AutoScalingGroup
ReadS [AutoScalingGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingGroup]
$creadListPrec :: ReadPrec [AutoScalingGroup]
readPrec :: ReadPrec AutoScalingGroup
$creadPrec :: ReadPrec AutoScalingGroup
readList :: ReadS [AutoScalingGroup]
$creadList :: ReadS [AutoScalingGroup]
readsPrec :: Int -> ReadS AutoScalingGroup
$creadsPrec :: Int -> ReadS AutoScalingGroup
Prelude.Read, Int -> AutoScalingGroup -> ShowS
[AutoScalingGroup] -> ShowS
AutoScalingGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingGroup] -> ShowS
$cshowList :: [AutoScalingGroup] -> ShowS
show :: AutoScalingGroup -> String
$cshow :: AutoScalingGroup -> String
showsPrec :: Int -> AutoScalingGroup -> ShowS
$cshowsPrec :: Int -> AutoScalingGroup -> ShowS
Prelude.Show, forall x. Rep AutoScalingGroup x -> AutoScalingGroup
forall x. AutoScalingGroup -> Rep AutoScalingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoScalingGroup x -> AutoScalingGroup
$cfrom :: forall x. AutoScalingGroup -> Rep AutoScalingGroup x
Prelude.Generic)

-- |
-- Create a value of 'AutoScalingGroup' 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:
--
-- 'hook', 'autoScalingGroup_hook' - An Auto Scaling lifecycle event hook name.
--
-- 'name', 'autoScalingGroup_name' - The Auto Scaling group name.
newAutoScalingGroup ::
  AutoScalingGroup
newAutoScalingGroup :: AutoScalingGroup
newAutoScalingGroup =
  AutoScalingGroup'
    { $sel:hook:AutoScalingGroup' :: Maybe Text
hook = forall a. Maybe a
Prelude.Nothing,
      $sel:name:AutoScalingGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | An Auto Scaling lifecycle event hook name.
autoScalingGroup_hook :: Lens.Lens' AutoScalingGroup (Prelude.Maybe Prelude.Text)
autoScalingGroup_hook :: Lens' AutoScalingGroup (Maybe Text)
autoScalingGroup_hook = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroup' {Maybe Text
hook :: Maybe Text
$sel:hook:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
hook} -> Maybe Text
hook) (\s :: AutoScalingGroup
s@AutoScalingGroup' {} Maybe Text
a -> AutoScalingGroup
s {$sel:hook:AutoScalingGroup' :: Maybe Text
hook = Maybe Text
a} :: AutoScalingGroup)

-- | The Auto Scaling group name.
autoScalingGroup_name :: Lens.Lens' AutoScalingGroup (Prelude.Maybe Prelude.Text)
autoScalingGroup_name :: Lens' AutoScalingGroup (Maybe Text)
autoScalingGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroup' {Maybe Text
name :: Maybe Text
$sel:name:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: AutoScalingGroup
s@AutoScalingGroup' {} Maybe Text
a -> AutoScalingGroup
s {$sel:name:AutoScalingGroup' :: Maybe Text
name = Maybe Text
a} :: AutoScalingGroup)

instance Data.FromJSON AutoScalingGroup where
  parseJSON :: Value -> Parser AutoScalingGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutoScalingGroup"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AutoScalingGroup
AutoScalingGroup'
            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
"hook")
            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")
      )

instance Prelude.Hashable AutoScalingGroup where
  hashWithSalt :: Int -> AutoScalingGroup -> Int
hashWithSalt Int
_salt AutoScalingGroup' {Maybe Text
name :: Maybe Text
hook :: Maybe Text
$sel:name:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
$sel:hook:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hook
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData AutoScalingGroup where
  rnf :: AutoScalingGroup -> ()
rnf AutoScalingGroup' {Maybe Text
name :: Maybe Text
hook :: Maybe Text
$sel:name:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
$sel:hook:AutoScalingGroup' :: AutoScalingGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hook seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name