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

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

-- | Edge Manager agent version.
--
-- /See:/ 'newAgentVersion' smart constructor.
data AgentVersion = AgentVersion'
  { -- | Version of the agent.
    AgentVersion -> Text
version :: Prelude.Text,
    -- | The number of Edge Manager agents.
    AgentVersion -> Integer
agentCount :: Prelude.Integer
  }
  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' - Version of the agent.
--
-- 'agentCount', 'agentVersion_agentCount' - The number of Edge Manager agents.
newAgentVersion ::
  -- | 'version'
  Prelude.Text ->
  -- | 'agentCount'
  Prelude.Integer ->
  AgentVersion
newAgentVersion :: Text -> Integer -> AgentVersion
newAgentVersion Text
pVersion_ Integer
pAgentCount_ =
  AgentVersion' :: Text -> Integer -> AgentVersion
AgentVersion'
    { $sel:version:AgentVersion' :: Text
version = Text
pVersion_,
      $sel:agentCount:AgentVersion' :: Integer
agentCount = Integer
pAgentCount_
    }

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

-- | The number of Edge Manager agents.
agentVersion_agentCount :: Lens.Lens' AgentVersion Prelude.Integer
agentVersion_agentCount :: (Integer -> f Integer) -> AgentVersion -> f AgentVersion
agentVersion_agentCount = (AgentVersion -> Integer)
-> (AgentVersion -> Integer -> AgentVersion)
-> Lens AgentVersion AgentVersion Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentVersion' {Integer
agentCount :: Integer
$sel:agentCount:AgentVersion' :: AgentVersion -> Integer
agentCount} -> Integer
agentCount) (\s :: AgentVersion
s@AgentVersion' {} Integer
a -> AgentVersion
s {$sel:agentCount:AgentVersion' :: Integer
agentCount = Integer
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 ->
          Text -> Integer -> AgentVersion
AgentVersion'
            (Text -> Integer -> AgentVersion)
-> Parser Text -> Parser (Integer -> AgentVersion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Version")
            Parser (Integer -> AgentVersion)
-> Parser Integer -> Parser AgentVersion
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AgentCount")
      )

instance Prelude.Hashable AgentVersion

instance Prelude.NFData AgentVersion