{-# 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.Route53RecoveryReadiness.Types.NLBResource
-- 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.Route53RecoveryReadiness.Types.NLBResource where

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

-- | The NLB resource a DNS Target Resource points to
--
-- /See:/ 'newNLBResource' smart constructor.
data NLBResource = NLBResource'
  { -- | An NLB resource arn
    NLBResource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (NLBResource -> NLBResource -> Bool
(NLBResource -> NLBResource -> Bool)
-> (NLBResource -> NLBResource -> Bool) -> Eq NLBResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NLBResource -> NLBResource -> Bool
$c/= :: NLBResource -> NLBResource -> Bool
== :: NLBResource -> NLBResource -> Bool
$c== :: NLBResource -> NLBResource -> Bool
Prelude.Eq, ReadPrec [NLBResource]
ReadPrec NLBResource
Int -> ReadS NLBResource
ReadS [NLBResource]
(Int -> ReadS NLBResource)
-> ReadS [NLBResource]
-> ReadPrec NLBResource
-> ReadPrec [NLBResource]
-> Read NLBResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NLBResource]
$creadListPrec :: ReadPrec [NLBResource]
readPrec :: ReadPrec NLBResource
$creadPrec :: ReadPrec NLBResource
readList :: ReadS [NLBResource]
$creadList :: ReadS [NLBResource]
readsPrec :: Int -> ReadS NLBResource
$creadsPrec :: Int -> ReadS NLBResource
Prelude.Read, Int -> NLBResource -> ShowS
[NLBResource] -> ShowS
NLBResource -> String
(Int -> NLBResource -> ShowS)
-> (NLBResource -> String)
-> ([NLBResource] -> ShowS)
-> Show NLBResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NLBResource] -> ShowS
$cshowList :: [NLBResource] -> ShowS
show :: NLBResource -> String
$cshow :: NLBResource -> String
showsPrec :: Int -> NLBResource -> ShowS
$cshowsPrec :: Int -> NLBResource -> ShowS
Prelude.Show, (forall x. NLBResource -> Rep NLBResource x)
-> (forall x. Rep NLBResource x -> NLBResource)
-> Generic NLBResource
forall x. Rep NLBResource x -> NLBResource
forall x. NLBResource -> Rep NLBResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NLBResource x -> NLBResource
$cfrom :: forall x. NLBResource -> Rep NLBResource x
Prelude.Generic)

-- |
-- Create a value of 'NLBResource' 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:
--
-- 'arn', 'nLBResource_arn' - An NLB resource arn
newNLBResource ::
  NLBResource
newNLBResource :: NLBResource
newNLBResource = NLBResource' :: Maybe Text -> NLBResource
NLBResource' {$sel:arn:NLBResource' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | An NLB resource arn
nLBResource_arn :: Lens.Lens' NLBResource (Prelude.Maybe Prelude.Text)
nLBResource_arn :: (Maybe Text -> f (Maybe Text)) -> NLBResource -> f NLBResource
nLBResource_arn = (NLBResource -> Maybe Text)
-> (NLBResource -> Maybe Text -> NLBResource)
-> Lens NLBResource NLBResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NLBResource' {Maybe Text
arn :: Maybe Text
$sel:arn:NLBResource' :: NLBResource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: NLBResource
s@NLBResource' {} Maybe Text
a -> NLBResource
s {$sel:arn:NLBResource' :: Maybe Text
arn = Maybe Text
a} :: NLBResource)

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

instance Prelude.Hashable NLBResource

instance Prelude.NFData NLBResource

instance Core.ToJSON NLBResource where
  toJSON :: NLBResource -> Value
toJSON NLBResource' {Maybe Text
arn :: Maybe Text
$sel:arn:NLBResource' :: NLBResource -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [(Text
"arn" 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
arn])