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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.StackConfigurationManager
import qualified Amazonka.Prelude as Prelude

-- | Describes an agent version.
--
-- /See:/ 'newAgentVersion' smart constructor.
data AgentVersion = AgentVersion'
  { -- | The agent version.
    AgentVersion -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The configuration manager.
    AgentVersion -> Maybe StackConfigurationManager
configurationManager :: Prelude.Maybe StackConfigurationManager
  }
  deriving (AgentVersion -> AgentVersion -> Bool
(AgentVersion -> AgentVersion -> Bool)
-> (AgentVersion -> AgentVersion -> Bool) -> Eq AgentVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentVersion -> AgentVersion -> Bool
$c/= :: AgentVersion -> AgentVersion -> Bool
== :: AgentVersion -> AgentVersion -> Bool
$c== :: AgentVersion -> AgentVersion -> Bool
Prelude.Eq, ReadPrec [AgentVersion]
ReadPrec AgentVersion
Int -> ReadS AgentVersion
ReadS [AgentVersion]
(Int -> ReadS AgentVersion)
-> ReadS [AgentVersion]
-> ReadPrec AgentVersion
-> ReadPrec [AgentVersion]
-> Read AgentVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentVersion]
$creadListPrec :: ReadPrec [AgentVersion]
readPrec :: ReadPrec AgentVersion
$creadPrec :: ReadPrec AgentVersion
readList :: ReadS [AgentVersion]
$creadList :: ReadS [AgentVersion]
readsPrec :: Int -> ReadS AgentVersion
$creadsPrec :: Int -> ReadS AgentVersion
Prelude.Read, Int -> AgentVersion -> ShowS
[AgentVersion] -> ShowS
AgentVersion -> String
(Int -> AgentVersion -> ShowS)
-> (AgentVersion -> String)
-> ([AgentVersion] -> ShowS)
-> Show AgentVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentVersion] -> ShowS
$cshowList :: [AgentVersion] -> ShowS
show :: AgentVersion -> String
$cshow :: AgentVersion -> String
showsPrec :: Int -> AgentVersion -> ShowS
$cshowsPrec :: Int -> AgentVersion -> ShowS
Prelude.Show, (forall x. AgentVersion -> Rep AgentVersion x)
-> (forall x. Rep AgentVersion x -> AgentVersion)
-> Generic AgentVersion
forall x. Rep AgentVersion x -> AgentVersion
forall x. AgentVersion -> Rep AgentVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AgentVersion x -> AgentVersion
$cfrom :: forall x. AgentVersion -> Rep AgentVersion x
Prelude.Generic)

-- |
-- Create a value of 'AgentVersion' 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:
--
-- 'version', 'agentVersion_version' - The agent version.
--
-- 'configurationManager', 'agentVersion_configurationManager' - The configuration manager.
newAgentVersion ::
  AgentVersion
newAgentVersion :: AgentVersion
newAgentVersion =
  AgentVersion' :: Maybe Text -> Maybe StackConfigurationManager -> AgentVersion
AgentVersion'
    { $sel:version:AgentVersion' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationManager:AgentVersion' :: Maybe StackConfigurationManager
configurationManager = Maybe StackConfigurationManager
forall a. Maybe a
Prelude.Nothing
    }

-- | The agent version.
agentVersion_version :: Lens.Lens' AgentVersion (Prelude.Maybe Prelude.Text)
agentVersion_version :: (Maybe Text -> f (Maybe Text)) -> AgentVersion -> f AgentVersion
agentVersion_version = (AgentVersion -> Maybe Text)
-> (AgentVersion -> Maybe Text -> AgentVersion)
-> Lens AgentVersion AgentVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentVersion' {Maybe Text
version :: Maybe Text
$sel:version:AgentVersion' :: AgentVersion -> Maybe Text
version} -> Maybe Text
version) (\s :: AgentVersion
s@AgentVersion' {} Maybe Text
a -> AgentVersion
s {$sel:version:AgentVersion' :: Maybe Text
version = Maybe Text
a} :: AgentVersion)

-- | The configuration manager.
agentVersion_configurationManager :: Lens.Lens' AgentVersion (Prelude.Maybe StackConfigurationManager)
agentVersion_configurationManager :: (Maybe StackConfigurationManager
 -> f (Maybe StackConfigurationManager))
-> AgentVersion -> f AgentVersion
agentVersion_configurationManager = (AgentVersion -> Maybe StackConfigurationManager)
-> (AgentVersion
    -> Maybe StackConfigurationManager -> AgentVersion)
-> Lens
     AgentVersion
     AgentVersion
     (Maybe StackConfigurationManager)
     (Maybe StackConfigurationManager)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentVersion' {Maybe StackConfigurationManager
configurationManager :: Maybe StackConfigurationManager
$sel:configurationManager:AgentVersion' :: AgentVersion -> Maybe StackConfigurationManager
configurationManager} -> Maybe StackConfigurationManager
configurationManager) (\s :: AgentVersion
s@AgentVersion' {} Maybe StackConfigurationManager
a -> AgentVersion
s {$sel:configurationManager:AgentVersion' :: Maybe StackConfigurationManager
configurationManager = Maybe StackConfigurationManager
a} :: AgentVersion)

instance Core.FromJSON AgentVersion where
  parseJSON :: Value -> Parser AgentVersion
parseJSON =
    String
-> (Object -> Parser AgentVersion) -> Value -> Parser AgentVersion
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AgentVersion"
      ( \Object
x ->
          Maybe Text -> Maybe StackConfigurationManager -> AgentVersion
AgentVersion'
            (Maybe Text -> Maybe StackConfigurationManager -> AgentVersion)
-> Parser (Maybe Text)
-> Parser (Maybe StackConfigurationManager -> AgentVersion)
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
"Version")
            Parser (Maybe StackConfigurationManager -> AgentVersion)
-> Parser (Maybe StackConfigurationManager) -> Parser AgentVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StackConfigurationManager)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationManager")
      )

instance Prelude.Hashable AgentVersion

instance Prelude.NFData AgentVersion