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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types.EngineType
import Amazonka.MQ.Types.EngineVersion
import qualified Amazonka.Prelude as Prelude

-- | Types of broker engines.
--
-- /See:/ 'newBrokerEngineType' smart constructor.
data BrokerEngineType = BrokerEngineType'
  { -- | The list of engine versions.
    BrokerEngineType -> Maybe [EngineVersion]
engineVersions :: Prelude.Maybe [EngineVersion],
    -- | The broker\'s engine type.
    BrokerEngineType -> Maybe EngineType
engineType :: Prelude.Maybe EngineType
  }
  deriving (BrokerEngineType -> BrokerEngineType -> Bool
(BrokerEngineType -> BrokerEngineType -> Bool)
-> (BrokerEngineType -> BrokerEngineType -> Bool)
-> Eq BrokerEngineType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BrokerEngineType -> BrokerEngineType -> Bool
$c/= :: BrokerEngineType -> BrokerEngineType -> Bool
== :: BrokerEngineType -> BrokerEngineType -> Bool
$c== :: BrokerEngineType -> BrokerEngineType -> Bool
Prelude.Eq, ReadPrec [BrokerEngineType]
ReadPrec BrokerEngineType
Int -> ReadS BrokerEngineType
ReadS [BrokerEngineType]
(Int -> ReadS BrokerEngineType)
-> ReadS [BrokerEngineType]
-> ReadPrec BrokerEngineType
-> ReadPrec [BrokerEngineType]
-> Read BrokerEngineType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BrokerEngineType]
$creadListPrec :: ReadPrec [BrokerEngineType]
readPrec :: ReadPrec BrokerEngineType
$creadPrec :: ReadPrec BrokerEngineType
readList :: ReadS [BrokerEngineType]
$creadList :: ReadS [BrokerEngineType]
readsPrec :: Int -> ReadS BrokerEngineType
$creadsPrec :: Int -> ReadS BrokerEngineType
Prelude.Read, Int -> BrokerEngineType -> ShowS
[BrokerEngineType] -> ShowS
BrokerEngineType -> String
(Int -> BrokerEngineType -> ShowS)
-> (BrokerEngineType -> String)
-> ([BrokerEngineType] -> ShowS)
-> Show BrokerEngineType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BrokerEngineType] -> ShowS
$cshowList :: [BrokerEngineType] -> ShowS
show :: BrokerEngineType -> String
$cshow :: BrokerEngineType -> String
showsPrec :: Int -> BrokerEngineType -> ShowS
$cshowsPrec :: Int -> BrokerEngineType -> ShowS
Prelude.Show, (forall x. BrokerEngineType -> Rep BrokerEngineType x)
-> (forall x. Rep BrokerEngineType x -> BrokerEngineType)
-> Generic BrokerEngineType
forall x. Rep BrokerEngineType x -> BrokerEngineType
forall x. BrokerEngineType -> Rep BrokerEngineType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BrokerEngineType x -> BrokerEngineType
$cfrom :: forall x. BrokerEngineType -> Rep BrokerEngineType x
Prelude.Generic)

-- |
-- Create a value of 'BrokerEngineType' 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:
--
-- 'engineVersions', 'brokerEngineType_engineVersions' - The list of engine versions.
--
-- 'engineType', 'brokerEngineType_engineType' - The broker\'s engine type.
newBrokerEngineType ::
  BrokerEngineType
newBrokerEngineType :: BrokerEngineType
newBrokerEngineType =
  BrokerEngineType' :: Maybe [EngineVersion] -> Maybe EngineType -> BrokerEngineType
BrokerEngineType'
    { $sel:engineVersions:BrokerEngineType' :: Maybe [EngineVersion]
engineVersions = Maybe [EngineVersion]
forall a. Maybe a
Prelude.Nothing,
      $sel:engineType:BrokerEngineType' :: Maybe EngineType
engineType = Maybe EngineType
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of engine versions.
brokerEngineType_engineVersions :: Lens.Lens' BrokerEngineType (Prelude.Maybe [EngineVersion])
brokerEngineType_engineVersions :: (Maybe [EngineVersion] -> f (Maybe [EngineVersion]))
-> BrokerEngineType -> f BrokerEngineType
brokerEngineType_engineVersions = (BrokerEngineType -> Maybe [EngineVersion])
-> (BrokerEngineType -> Maybe [EngineVersion] -> BrokerEngineType)
-> Lens
     BrokerEngineType
     BrokerEngineType
     (Maybe [EngineVersion])
     (Maybe [EngineVersion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerEngineType' {Maybe [EngineVersion]
engineVersions :: Maybe [EngineVersion]
$sel:engineVersions:BrokerEngineType' :: BrokerEngineType -> Maybe [EngineVersion]
engineVersions} -> Maybe [EngineVersion]
engineVersions) (\s :: BrokerEngineType
s@BrokerEngineType' {} Maybe [EngineVersion]
a -> BrokerEngineType
s {$sel:engineVersions:BrokerEngineType' :: Maybe [EngineVersion]
engineVersions = Maybe [EngineVersion]
a} :: BrokerEngineType) ((Maybe [EngineVersion] -> f (Maybe [EngineVersion]))
 -> BrokerEngineType -> f BrokerEngineType)
-> ((Maybe [EngineVersion] -> f (Maybe [EngineVersion]))
    -> Maybe [EngineVersion] -> f (Maybe [EngineVersion]))
-> (Maybe [EngineVersion] -> f (Maybe [EngineVersion]))
-> BrokerEngineType
-> f BrokerEngineType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EngineVersion] [EngineVersion] [EngineVersion] [EngineVersion]
-> Iso
     (Maybe [EngineVersion])
     (Maybe [EngineVersion])
     (Maybe [EngineVersion])
     (Maybe [EngineVersion])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [EngineVersion] [EngineVersion] [EngineVersion] [EngineVersion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The broker\'s engine type.
brokerEngineType_engineType :: Lens.Lens' BrokerEngineType (Prelude.Maybe EngineType)
brokerEngineType_engineType :: (Maybe EngineType -> f (Maybe EngineType))
-> BrokerEngineType -> f BrokerEngineType
brokerEngineType_engineType = (BrokerEngineType -> Maybe EngineType)
-> (BrokerEngineType -> Maybe EngineType -> BrokerEngineType)
-> Lens
     BrokerEngineType
     BrokerEngineType
     (Maybe EngineType)
     (Maybe EngineType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerEngineType' {Maybe EngineType
engineType :: Maybe EngineType
$sel:engineType:BrokerEngineType' :: BrokerEngineType -> Maybe EngineType
engineType} -> Maybe EngineType
engineType) (\s :: BrokerEngineType
s@BrokerEngineType' {} Maybe EngineType
a -> BrokerEngineType
s {$sel:engineType:BrokerEngineType' :: Maybe EngineType
engineType = Maybe EngineType
a} :: BrokerEngineType)

instance Core.FromJSON BrokerEngineType where
  parseJSON :: Value -> Parser BrokerEngineType
parseJSON =
    String
-> (Object -> Parser BrokerEngineType)
-> Value
-> Parser BrokerEngineType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BrokerEngineType"
      ( \Object
x ->
          Maybe [EngineVersion] -> Maybe EngineType -> BrokerEngineType
BrokerEngineType'
            (Maybe [EngineVersion] -> Maybe EngineType -> BrokerEngineType)
-> Parser (Maybe [EngineVersion])
-> Parser (Maybe EngineType -> BrokerEngineType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [EngineVersion]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"engineVersions" Parser (Maybe (Maybe [EngineVersion]))
-> Maybe [EngineVersion] -> Parser (Maybe [EngineVersion])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EngineVersion]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe EngineType -> BrokerEngineType)
-> Parser (Maybe EngineType) -> Parser BrokerEngineType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EngineType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"engineType")
      )

instance Prelude.Hashable BrokerEngineType

instance Prelude.NFData BrokerEngineType