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

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

-- | Returns information about all brokers.
--
-- /See:/ 'newBrokerInstance' smart constructor.
data BrokerInstance = BrokerInstance'
  { -- | The IP address of the Elastic Network Interface (ENI) attached to the
    -- broker. Does not apply to RabbitMQ brokers.
    BrokerInstance -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The brokers web console URL.
    BrokerInstance -> Maybe Text
consoleURL :: Prelude.Maybe Prelude.Text,
    -- | The broker\'s wire-level protocol endpoints.
    BrokerInstance -> Maybe [Text]
endpoints :: Prelude.Maybe [Prelude.Text]
  }
  deriving (BrokerInstance -> BrokerInstance -> Bool
(BrokerInstance -> BrokerInstance -> Bool)
-> (BrokerInstance -> BrokerInstance -> Bool) -> Eq BrokerInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BrokerInstance -> BrokerInstance -> Bool
$c/= :: BrokerInstance -> BrokerInstance -> Bool
== :: BrokerInstance -> BrokerInstance -> Bool
$c== :: BrokerInstance -> BrokerInstance -> Bool
Prelude.Eq, ReadPrec [BrokerInstance]
ReadPrec BrokerInstance
Int -> ReadS BrokerInstance
ReadS [BrokerInstance]
(Int -> ReadS BrokerInstance)
-> ReadS [BrokerInstance]
-> ReadPrec BrokerInstance
-> ReadPrec [BrokerInstance]
-> Read BrokerInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BrokerInstance]
$creadListPrec :: ReadPrec [BrokerInstance]
readPrec :: ReadPrec BrokerInstance
$creadPrec :: ReadPrec BrokerInstance
readList :: ReadS [BrokerInstance]
$creadList :: ReadS [BrokerInstance]
readsPrec :: Int -> ReadS BrokerInstance
$creadsPrec :: Int -> ReadS BrokerInstance
Prelude.Read, Int -> BrokerInstance -> ShowS
[BrokerInstance] -> ShowS
BrokerInstance -> String
(Int -> BrokerInstance -> ShowS)
-> (BrokerInstance -> String)
-> ([BrokerInstance] -> ShowS)
-> Show BrokerInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BrokerInstance] -> ShowS
$cshowList :: [BrokerInstance] -> ShowS
show :: BrokerInstance -> String
$cshow :: BrokerInstance -> String
showsPrec :: Int -> BrokerInstance -> ShowS
$cshowsPrec :: Int -> BrokerInstance -> ShowS
Prelude.Show, (forall x. BrokerInstance -> Rep BrokerInstance x)
-> (forall x. Rep BrokerInstance x -> BrokerInstance)
-> Generic BrokerInstance
forall x. Rep BrokerInstance x -> BrokerInstance
forall x. BrokerInstance -> Rep BrokerInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BrokerInstance x -> BrokerInstance
$cfrom :: forall x. BrokerInstance -> Rep BrokerInstance x
Prelude.Generic)

-- |
-- Create a value of 'BrokerInstance' 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:
--
-- 'ipAddress', 'brokerInstance_ipAddress' - The IP address of the Elastic Network Interface (ENI) attached to the
-- broker. Does not apply to RabbitMQ brokers.
--
-- 'consoleURL', 'brokerInstance_consoleURL' - The brokers web console URL.
--
-- 'endpoints', 'brokerInstance_endpoints' - The broker\'s wire-level protocol endpoints.
newBrokerInstance ::
  BrokerInstance
newBrokerInstance :: BrokerInstance
newBrokerInstance =
  BrokerInstance' :: Maybe Text -> Maybe Text -> Maybe [Text] -> BrokerInstance
BrokerInstance'
    { $sel:ipAddress:BrokerInstance' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:consoleURL:BrokerInstance' :: Maybe Text
consoleURL = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoints:BrokerInstance' :: Maybe [Text]
endpoints = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The IP address of the Elastic Network Interface (ENI) attached to the
-- broker. Does not apply to RabbitMQ brokers.
brokerInstance_ipAddress :: Lens.Lens' BrokerInstance (Prelude.Maybe Prelude.Text)
brokerInstance_ipAddress :: (Maybe Text -> f (Maybe Text))
-> BrokerInstance -> f BrokerInstance
brokerInstance_ipAddress = (BrokerInstance -> Maybe Text)
-> (BrokerInstance -> Maybe Text -> BrokerInstance)
-> Lens BrokerInstance BrokerInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerInstance' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:BrokerInstance' :: BrokerInstance -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: BrokerInstance
s@BrokerInstance' {} Maybe Text
a -> BrokerInstance
s {$sel:ipAddress:BrokerInstance' :: Maybe Text
ipAddress = Maybe Text
a} :: BrokerInstance)

-- | The brokers web console URL.
brokerInstance_consoleURL :: Lens.Lens' BrokerInstance (Prelude.Maybe Prelude.Text)
brokerInstance_consoleURL :: (Maybe Text -> f (Maybe Text))
-> BrokerInstance -> f BrokerInstance
brokerInstance_consoleURL = (BrokerInstance -> Maybe Text)
-> (BrokerInstance -> Maybe Text -> BrokerInstance)
-> Lens BrokerInstance BrokerInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerInstance' {Maybe Text
consoleURL :: Maybe Text
$sel:consoleURL:BrokerInstance' :: BrokerInstance -> Maybe Text
consoleURL} -> Maybe Text
consoleURL) (\s :: BrokerInstance
s@BrokerInstance' {} Maybe Text
a -> BrokerInstance
s {$sel:consoleURL:BrokerInstance' :: Maybe Text
consoleURL = Maybe Text
a} :: BrokerInstance)

-- | The broker\'s wire-level protocol endpoints.
brokerInstance_endpoints :: Lens.Lens' BrokerInstance (Prelude.Maybe [Prelude.Text])
brokerInstance_endpoints :: (Maybe [Text] -> f (Maybe [Text]))
-> BrokerInstance -> f BrokerInstance
brokerInstance_endpoints = (BrokerInstance -> Maybe [Text])
-> (BrokerInstance -> Maybe [Text] -> BrokerInstance)
-> Lens BrokerInstance BrokerInstance (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerInstance' {Maybe [Text]
endpoints :: Maybe [Text]
$sel:endpoints:BrokerInstance' :: BrokerInstance -> Maybe [Text]
endpoints} -> Maybe [Text]
endpoints) (\s :: BrokerInstance
s@BrokerInstance' {} Maybe [Text]
a -> BrokerInstance
s {$sel:endpoints:BrokerInstance' :: Maybe [Text]
endpoints = Maybe [Text]
a} :: BrokerInstance) ((Maybe [Text] -> f (Maybe [Text]))
 -> BrokerInstance -> f BrokerInstance)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> BrokerInstance
-> f BrokerInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON BrokerInstance where
  parseJSON :: Value -> Parser BrokerInstance
parseJSON =
    String
-> (Object -> Parser BrokerInstance)
-> Value
-> Parser BrokerInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BrokerInstance"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe [Text] -> BrokerInstance
BrokerInstance'
            (Maybe Text -> Maybe Text -> Maybe [Text] -> BrokerInstance)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Text] -> BrokerInstance)
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
"ipAddress")
            Parser (Maybe Text -> Maybe [Text] -> BrokerInstance)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> BrokerInstance)
forall (f :: * -> *) a b. Applicative f => 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
"consoleURL")
            Parser (Maybe [Text] -> BrokerInstance)
-> Parser (Maybe [Text]) -> Parser BrokerInstance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"endpoints" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable BrokerInstance

instance Prelude.NFData BrokerInstance