{-# 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.SecurityHub.Types.AwsElbLoadBalancerInstance
-- 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.SecurityHub.Types.AwsElbLoadBalancerInstance where

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

-- | Provides information about an EC2 instance for a load balancer.
--
-- /See:/ 'newAwsElbLoadBalancerInstance' smart constructor.
data AwsElbLoadBalancerInstance = AwsElbLoadBalancerInstance'
  { -- | The instance identifier.
    AwsElbLoadBalancerInstance -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool
(AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool)
-> (AwsElbLoadBalancerInstance
    -> AwsElbLoadBalancerInstance -> Bool)
-> Eq AwsElbLoadBalancerInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool
$c/= :: AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool
== :: AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool
$c== :: AwsElbLoadBalancerInstance -> AwsElbLoadBalancerInstance -> Bool
Prelude.Eq, ReadPrec [AwsElbLoadBalancerInstance]
ReadPrec AwsElbLoadBalancerInstance
Int -> ReadS AwsElbLoadBalancerInstance
ReadS [AwsElbLoadBalancerInstance]
(Int -> ReadS AwsElbLoadBalancerInstance)
-> ReadS [AwsElbLoadBalancerInstance]
-> ReadPrec AwsElbLoadBalancerInstance
-> ReadPrec [AwsElbLoadBalancerInstance]
-> Read AwsElbLoadBalancerInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElbLoadBalancerInstance]
$creadListPrec :: ReadPrec [AwsElbLoadBalancerInstance]
readPrec :: ReadPrec AwsElbLoadBalancerInstance
$creadPrec :: ReadPrec AwsElbLoadBalancerInstance
readList :: ReadS [AwsElbLoadBalancerInstance]
$creadList :: ReadS [AwsElbLoadBalancerInstance]
readsPrec :: Int -> ReadS AwsElbLoadBalancerInstance
$creadsPrec :: Int -> ReadS AwsElbLoadBalancerInstance
Prelude.Read, Int -> AwsElbLoadBalancerInstance -> ShowS
[AwsElbLoadBalancerInstance] -> ShowS
AwsElbLoadBalancerInstance -> String
(Int -> AwsElbLoadBalancerInstance -> ShowS)
-> (AwsElbLoadBalancerInstance -> String)
-> ([AwsElbLoadBalancerInstance] -> ShowS)
-> Show AwsElbLoadBalancerInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElbLoadBalancerInstance] -> ShowS
$cshowList :: [AwsElbLoadBalancerInstance] -> ShowS
show :: AwsElbLoadBalancerInstance -> String
$cshow :: AwsElbLoadBalancerInstance -> String
showsPrec :: Int -> AwsElbLoadBalancerInstance -> ShowS
$cshowsPrec :: Int -> AwsElbLoadBalancerInstance -> ShowS
Prelude.Show, (forall x.
 AwsElbLoadBalancerInstance -> Rep AwsElbLoadBalancerInstance x)
-> (forall x.
    Rep AwsElbLoadBalancerInstance x -> AwsElbLoadBalancerInstance)
-> Generic AwsElbLoadBalancerInstance
forall x.
Rep AwsElbLoadBalancerInstance x -> AwsElbLoadBalancerInstance
forall x.
AwsElbLoadBalancerInstance -> Rep AwsElbLoadBalancerInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElbLoadBalancerInstance x -> AwsElbLoadBalancerInstance
$cfrom :: forall x.
AwsElbLoadBalancerInstance -> Rep AwsElbLoadBalancerInstance x
Prelude.Generic)

-- |
-- Create a value of 'AwsElbLoadBalancerInstance' 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:
--
-- 'instanceId', 'awsElbLoadBalancerInstance_instanceId' - The instance identifier.
newAwsElbLoadBalancerInstance ::
  AwsElbLoadBalancerInstance
newAwsElbLoadBalancerInstance :: AwsElbLoadBalancerInstance
newAwsElbLoadBalancerInstance =
  AwsElbLoadBalancerInstance' :: Maybe Text -> AwsElbLoadBalancerInstance
AwsElbLoadBalancerInstance'
    { $sel:instanceId:AwsElbLoadBalancerInstance' :: Maybe Text
instanceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The instance identifier.
awsElbLoadBalancerInstance_instanceId :: Lens.Lens' AwsElbLoadBalancerInstance (Prelude.Maybe Prelude.Text)
awsElbLoadBalancerInstance_instanceId :: (Maybe Text -> f (Maybe Text))
-> AwsElbLoadBalancerInstance -> f AwsElbLoadBalancerInstance
awsElbLoadBalancerInstance_instanceId = (AwsElbLoadBalancerInstance -> Maybe Text)
-> (AwsElbLoadBalancerInstance
    -> Maybe Text -> AwsElbLoadBalancerInstance)
-> Lens
     AwsElbLoadBalancerInstance
     AwsElbLoadBalancerInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElbLoadBalancerInstance' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:AwsElbLoadBalancerInstance' :: AwsElbLoadBalancerInstance -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: AwsElbLoadBalancerInstance
s@AwsElbLoadBalancerInstance' {} Maybe Text
a -> AwsElbLoadBalancerInstance
s {$sel:instanceId:AwsElbLoadBalancerInstance' :: Maybe Text
instanceId = Maybe Text
a} :: AwsElbLoadBalancerInstance)

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

instance Prelude.Hashable AwsElbLoadBalancerInstance

instance Prelude.NFData AwsElbLoadBalancerInstance

instance Core.ToJSON AwsElbLoadBalancerInstance where
  toJSON :: AwsElbLoadBalancerInstance -> Value
toJSON AwsElbLoadBalancerInstance' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:AwsElbLoadBalancerInstance' :: AwsElbLoadBalancerInstance -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
instanceId]
      )