{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53RecoveryReadiness.Types.NLBResource where

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

-- | The Network Load Balancer resource that a DNS target resource points to.
--
-- /See:/ 'newNLBResource' smart constructor.
data NLBResource = NLBResource'
  { -- | The Network Load Balancer resource Amazon Resource Name (ARN).
    NLBResource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (NLBResource -> NLBResource -> Bool
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]
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
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. 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' - The Network Load Balancer resource Amazon Resource Name (ARN).
newNLBResource ::
  NLBResource
newNLBResource :: NLBResource
newNLBResource = NLBResource' {$sel:arn:NLBResource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing}

-- | The Network Load Balancer resource Amazon Resource Name (ARN).
nLBResource_arn :: Lens.Lens' NLBResource (Prelude.Maybe Prelude.Text)
nLBResource_arn :: Lens' NLBResource (Maybe Text)
nLBResource_arn = 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 Data.FromJSON NLBResource where
  parseJSON :: Value -> Parser NLBResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NLBResource"
      (\Object
x -> Maybe Text -> NLBResource
NLBResource' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn"))

instance Prelude.Hashable NLBResource where
  hashWithSalt :: Int -> NLBResource -> Int
hashWithSalt Int
_salt NLBResource' {Maybe Text
arn :: Maybe Text
$sel:arn:NLBResource' :: NLBResource -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn

instance Prelude.NFData NLBResource where
  rnf :: NLBResource -> ()
rnf NLBResource' {Maybe Text
arn :: Maybe Text
$sel:arn:NLBResource' :: NLBResource -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn

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