{-# 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.StackConfigurationManager
-- 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.StackConfigurationManager where

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

-- | Describes the configuration manager.
--
-- /See:/ 'newStackConfigurationManager' smart constructor.
data StackConfigurationManager = StackConfigurationManager'
  { -- | The name. This parameter must be set to \"Chef\".
    StackConfigurationManager -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Chef version. This parameter must be set to 12, 11.10, or 11.4 for
    -- Linux stacks, and to 12.2 for Windows stacks. The default value for
    -- Linux stacks is 11.4.
    StackConfigurationManager -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (StackConfigurationManager -> StackConfigurationManager -> Bool
(StackConfigurationManager -> StackConfigurationManager -> Bool)
-> (StackConfigurationManager -> StackConfigurationManager -> Bool)
-> Eq StackConfigurationManager
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackConfigurationManager -> StackConfigurationManager -> Bool
$c/= :: StackConfigurationManager -> StackConfigurationManager -> Bool
== :: StackConfigurationManager -> StackConfigurationManager -> Bool
$c== :: StackConfigurationManager -> StackConfigurationManager -> Bool
Prelude.Eq, ReadPrec [StackConfigurationManager]
ReadPrec StackConfigurationManager
Int -> ReadS StackConfigurationManager
ReadS [StackConfigurationManager]
(Int -> ReadS StackConfigurationManager)
-> ReadS [StackConfigurationManager]
-> ReadPrec StackConfigurationManager
-> ReadPrec [StackConfigurationManager]
-> Read StackConfigurationManager
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackConfigurationManager]
$creadListPrec :: ReadPrec [StackConfigurationManager]
readPrec :: ReadPrec StackConfigurationManager
$creadPrec :: ReadPrec StackConfigurationManager
readList :: ReadS [StackConfigurationManager]
$creadList :: ReadS [StackConfigurationManager]
readsPrec :: Int -> ReadS StackConfigurationManager
$creadsPrec :: Int -> ReadS StackConfigurationManager
Prelude.Read, Int -> StackConfigurationManager -> ShowS
[StackConfigurationManager] -> ShowS
StackConfigurationManager -> String
(Int -> StackConfigurationManager -> ShowS)
-> (StackConfigurationManager -> String)
-> ([StackConfigurationManager] -> ShowS)
-> Show StackConfigurationManager
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackConfigurationManager] -> ShowS
$cshowList :: [StackConfigurationManager] -> ShowS
show :: StackConfigurationManager -> String
$cshow :: StackConfigurationManager -> String
showsPrec :: Int -> StackConfigurationManager -> ShowS
$cshowsPrec :: Int -> StackConfigurationManager -> ShowS
Prelude.Show, (forall x.
 StackConfigurationManager -> Rep StackConfigurationManager x)
-> (forall x.
    Rep StackConfigurationManager x -> StackConfigurationManager)
-> Generic StackConfigurationManager
forall x.
Rep StackConfigurationManager x -> StackConfigurationManager
forall x.
StackConfigurationManager -> Rep StackConfigurationManager x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackConfigurationManager x -> StackConfigurationManager
$cfrom :: forall x.
StackConfigurationManager -> Rep StackConfigurationManager x
Prelude.Generic)

-- |
-- Create a value of 'StackConfigurationManager' 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:
--
-- 'name', 'stackConfigurationManager_name' - The name. This parameter must be set to \"Chef\".
--
-- 'version', 'stackConfigurationManager_version' - The Chef version. This parameter must be set to 12, 11.10, or 11.4 for
-- Linux stacks, and to 12.2 for Windows stacks. The default value for
-- Linux stacks is 11.4.
newStackConfigurationManager ::
  StackConfigurationManager
newStackConfigurationManager :: StackConfigurationManager
newStackConfigurationManager =
  StackConfigurationManager' :: Maybe Text -> Maybe Text -> StackConfigurationManager
StackConfigurationManager'
    { $sel:name:StackConfigurationManager' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:StackConfigurationManager' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name. This parameter must be set to \"Chef\".
stackConfigurationManager_name :: Lens.Lens' StackConfigurationManager (Prelude.Maybe Prelude.Text)
stackConfigurationManager_name :: (Maybe Text -> f (Maybe Text))
-> StackConfigurationManager -> f StackConfigurationManager
stackConfigurationManager_name = (StackConfigurationManager -> Maybe Text)
-> (StackConfigurationManager
    -> Maybe Text -> StackConfigurationManager)
-> Lens
     StackConfigurationManager
     StackConfigurationManager
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackConfigurationManager' {Maybe Text
name :: Maybe Text
$sel:name:StackConfigurationManager' :: StackConfigurationManager -> Maybe Text
name} -> Maybe Text
name) (\s :: StackConfigurationManager
s@StackConfigurationManager' {} Maybe Text
a -> StackConfigurationManager
s {$sel:name:StackConfigurationManager' :: Maybe Text
name = Maybe Text
a} :: StackConfigurationManager)

-- | The Chef version. This parameter must be set to 12, 11.10, or 11.4 for
-- Linux stacks, and to 12.2 for Windows stacks. The default value for
-- Linux stacks is 11.4.
stackConfigurationManager_version :: Lens.Lens' StackConfigurationManager (Prelude.Maybe Prelude.Text)
stackConfigurationManager_version :: (Maybe Text -> f (Maybe Text))
-> StackConfigurationManager -> f StackConfigurationManager
stackConfigurationManager_version = (StackConfigurationManager -> Maybe Text)
-> (StackConfigurationManager
    -> Maybe Text -> StackConfigurationManager)
-> Lens
     StackConfigurationManager
     StackConfigurationManager
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackConfigurationManager' {Maybe Text
version :: Maybe Text
$sel:version:StackConfigurationManager' :: StackConfigurationManager -> Maybe Text
version} -> Maybe Text
version) (\s :: StackConfigurationManager
s@StackConfigurationManager' {} Maybe Text
a -> StackConfigurationManager
s {$sel:version:StackConfigurationManager' :: Maybe Text
version = Maybe Text
a} :: StackConfigurationManager)

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

instance Prelude.Hashable StackConfigurationManager

instance Prelude.NFData StackConfigurationManager

instance Core.ToJSON StackConfigurationManager where
  toJSON :: StackConfigurationManager -> Value
toJSON StackConfigurationManager' {Maybe Text
version :: Maybe Text
name :: Maybe Text
$sel:version:StackConfigurationManager' :: StackConfigurationManager -> Maybe Text
$sel:name:StackConfigurationManager' :: StackConfigurationManager -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"Version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
version
          ]
      )