{-# 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.MQ.Types.EngineVersion
-- 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.MQ.Types.EngineVersion where

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

-- | Id of the engine version.
--
-- /See:/ 'newEngineVersion' smart constructor.
data EngineVersion = EngineVersion'
  { -- | Id for the version.
    EngineVersion -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (EngineVersion -> EngineVersion -> Bool
(EngineVersion -> EngineVersion -> Bool)
-> (EngineVersion -> EngineVersion -> Bool) -> Eq EngineVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EngineVersion -> EngineVersion -> Bool
$c/= :: EngineVersion -> EngineVersion -> Bool
== :: EngineVersion -> EngineVersion -> Bool
$c== :: EngineVersion -> EngineVersion -> Bool
Prelude.Eq, ReadPrec [EngineVersion]
ReadPrec EngineVersion
Int -> ReadS EngineVersion
ReadS [EngineVersion]
(Int -> ReadS EngineVersion)
-> ReadS [EngineVersion]
-> ReadPrec EngineVersion
-> ReadPrec [EngineVersion]
-> Read EngineVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EngineVersion]
$creadListPrec :: ReadPrec [EngineVersion]
readPrec :: ReadPrec EngineVersion
$creadPrec :: ReadPrec EngineVersion
readList :: ReadS [EngineVersion]
$creadList :: ReadS [EngineVersion]
readsPrec :: Int -> ReadS EngineVersion
$creadsPrec :: Int -> ReadS EngineVersion
Prelude.Read, Int -> EngineVersion -> ShowS
[EngineVersion] -> ShowS
EngineVersion -> String
(Int -> EngineVersion -> ShowS)
-> (EngineVersion -> String)
-> ([EngineVersion] -> ShowS)
-> Show EngineVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EngineVersion] -> ShowS
$cshowList :: [EngineVersion] -> ShowS
show :: EngineVersion -> String
$cshow :: EngineVersion -> String
showsPrec :: Int -> EngineVersion -> ShowS
$cshowsPrec :: Int -> EngineVersion -> ShowS
Prelude.Show, (forall x. EngineVersion -> Rep EngineVersion x)
-> (forall x. Rep EngineVersion x -> EngineVersion)
-> Generic EngineVersion
forall x. Rep EngineVersion x -> EngineVersion
forall x. EngineVersion -> Rep EngineVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EngineVersion x -> EngineVersion
$cfrom :: forall x. EngineVersion -> Rep EngineVersion x
Prelude.Generic)

-- |
-- Create a value of 'EngineVersion' 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', 'engineVersion_name' - Id for the version.
newEngineVersion ::
  EngineVersion
newEngineVersion :: EngineVersion
newEngineVersion =
  EngineVersion' :: Maybe Text -> EngineVersion
EngineVersion' {$sel:name:EngineVersion' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | Id for the version.
engineVersion_name :: Lens.Lens' EngineVersion (Prelude.Maybe Prelude.Text)
engineVersion_name :: (Maybe Text -> f (Maybe Text)) -> EngineVersion -> f EngineVersion
engineVersion_name = (EngineVersion -> Maybe Text)
-> (EngineVersion -> Maybe Text -> EngineVersion)
-> Lens EngineVersion EngineVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EngineVersion' {Maybe Text
name :: Maybe Text
$sel:name:EngineVersion' :: EngineVersion -> Maybe Text
name} -> Maybe Text
name) (\s :: EngineVersion
s@EngineVersion' {} Maybe Text
a -> EngineVersion
s {$sel:name:EngineVersion' :: Maybe Text
name = Maybe Text
a} :: EngineVersion)

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

instance Prelude.Hashable EngineVersion

instance Prelude.NFData EngineVersion