{-# 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-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.AgentVersion 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.StackConfigurationManager
import qualified Amazonka.Prelude as Prelude

-- | Describes an agent version.
--
-- /See:/ 'newAgentVersion' smart constructor.
data AgentVersion = AgentVersion'
  { -- | The configuration manager.
    AgentVersion -> Maybe StackConfigurationManager
configurationManager :: Prelude.Maybe StackConfigurationManager,
    -- | The agent version.
    AgentVersion -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (AgentVersion -> AgentVersion -> Bool
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]
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
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. 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:
--
-- 'configurationManager', 'agentVersion_configurationManager' - The configuration manager.
--
-- 'version', 'agentVersion_version' - The agent version.
newAgentVersion ::
  AgentVersion
newAgentVersion :: AgentVersion
newAgentVersion =
  AgentVersion'
    { $sel:configurationManager:AgentVersion' :: Maybe StackConfigurationManager
configurationManager =
        forall a. Maybe a
Prelude.Nothing,
      $sel:version:AgentVersion' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration manager.
agentVersion_configurationManager :: Lens.Lens' AgentVersion (Prelude.Maybe StackConfigurationManager)
agentVersion_configurationManager :: Lens' AgentVersion (Maybe StackConfigurationManager)
agentVersion_configurationManager = 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)

-- | The agent version.
agentVersion_version :: Lens.Lens' AgentVersion (Prelude.Maybe Prelude.Text)
agentVersion_version :: Lens' AgentVersion (Maybe Text)
agentVersion_version = 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)

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

instance Prelude.Hashable AgentVersion where
  hashWithSalt :: Int -> AgentVersion -> Int
hashWithSalt Int
_salt AgentVersion' {Maybe Text
Maybe StackConfigurationManager
version :: Maybe Text
configurationManager :: Maybe StackConfigurationManager
$sel:version:AgentVersion' :: AgentVersion -> Maybe Text
$sel:configurationManager:AgentVersion' :: AgentVersion -> Maybe StackConfigurationManager
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StackConfigurationManager
configurationManager
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData AgentVersion where
  rnf :: AgentVersion -> ()
rnf AgentVersion' {Maybe Text
Maybe StackConfigurationManager
version :: Maybe Text
configurationManager :: Maybe StackConfigurationManager
$sel:version:AgentVersion' :: AgentVersion -> Maybe Text
$sel:configurationManager:AgentVersion' :: AgentVersion -> Maybe StackConfigurationManager
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StackConfigurationManager
configurationManager
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version