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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryReadiness.Types.TargetResource

-- | A component for DNS\/Routing Control Readiness Checks
--
-- /See:/ 'newDNSTargetResource' smart constructor.
data DNSTargetResource = DNSTargetResource'
  { -- | The Hosted Zone ARN that contains the DNS record with the provided name
    -- of target resource.
    DNSTargetResource -> Maybe Text
hostedZoneArn :: Prelude.Maybe Prelude.Text,
    -- | The Type of DNS Record of target resource
    DNSTargetResource -> Maybe Text
recordType :: Prelude.Maybe Prelude.Text,
    DNSTargetResource -> Maybe TargetResource
targetResource :: Prelude.Maybe TargetResource,
    -- | The DNS Name that acts as ingress point to a portion of application
    DNSTargetResource -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | The R53 Set Id to uniquely identify a record given a Name and a Type
    DNSTargetResource -> Maybe Text
recordSetId :: Prelude.Maybe Prelude.Text
  }
  deriving (DNSTargetResource -> DNSTargetResource -> Bool
(DNSTargetResource -> DNSTargetResource -> Bool)
-> (DNSTargetResource -> DNSTargetResource -> Bool)
-> Eq DNSTargetResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DNSTargetResource -> DNSTargetResource -> Bool
$c/= :: DNSTargetResource -> DNSTargetResource -> Bool
== :: DNSTargetResource -> DNSTargetResource -> Bool
$c== :: DNSTargetResource -> DNSTargetResource -> Bool
Prelude.Eq, ReadPrec [DNSTargetResource]
ReadPrec DNSTargetResource
Int -> ReadS DNSTargetResource
ReadS [DNSTargetResource]
(Int -> ReadS DNSTargetResource)
-> ReadS [DNSTargetResource]
-> ReadPrec DNSTargetResource
-> ReadPrec [DNSTargetResource]
-> Read DNSTargetResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DNSTargetResource]
$creadListPrec :: ReadPrec [DNSTargetResource]
readPrec :: ReadPrec DNSTargetResource
$creadPrec :: ReadPrec DNSTargetResource
readList :: ReadS [DNSTargetResource]
$creadList :: ReadS [DNSTargetResource]
readsPrec :: Int -> ReadS DNSTargetResource
$creadsPrec :: Int -> ReadS DNSTargetResource
Prelude.Read, Int -> DNSTargetResource -> ShowS
[DNSTargetResource] -> ShowS
DNSTargetResource -> String
(Int -> DNSTargetResource -> ShowS)
-> (DNSTargetResource -> String)
-> ([DNSTargetResource] -> ShowS)
-> Show DNSTargetResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DNSTargetResource] -> ShowS
$cshowList :: [DNSTargetResource] -> ShowS
show :: DNSTargetResource -> String
$cshow :: DNSTargetResource -> String
showsPrec :: Int -> DNSTargetResource -> ShowS
$cshowsPrec :: Int -> DNSTargetResource -> ShowS
Prelude.Show, (forall x. DNSTargetResource -> Rep DNSTargetResource x)
-> (forall x. Rep DNSTargetResource x -> DNSTargetResource)
-> Generic DNSTargetResource
forall x. Rep DNSTargetResource x -> DNSTargetResource
forall x. DNSTargetResource -> Rep DNSTargetResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DNSTargetResource x -> DNSTargetResource
$cfrom :: forall x. DNSTargetResource -> Rep DNSTargetResource x
Prelude.Generic)

-- |
-- Create a value of 'DNSTargetResource' 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:
--
-- 'hostedZoneArn', 'dNSTargetResource_hostedZoneArn' - The Hosted Zone ARN that contains the DNS record with the provided name
-- of target resource.
--
-- 'recordType', 'dNSTargetResource_recordType' - The Type of DNS Record of target resource
--
-- 'targetResource', 'dNSTargetResource_targetResource' - Undocumented member.
--
-- 'domainName', 'dNSTargetResource_domainName' - The DNS Name that acts as ingress point to a portion of application
--
-- 'recordSetId', 'dNSTargetResource_recordSetId' - The R53 Set Id to uniquely identify a record given a Name and a Type
newDNSTargetResource ::
  DNSTargetResource
newDNSTargetResource :: DNSTargetResource
newDNSTargetResource =
  DNSTargetResource' :: Maybe Text
-> Maybe Text
-> Maybe TargetResource
-> Maybe Text
-> Maybe Text
-> DNSTargetResource
DNSTargetResource'
    { $sel:hostedZoneArn:DNSTargetResource' :: Maybe Text
hostedZoneArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recordType:DNSTargetResource' :: Maybe Text
recordType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetResource:DNSTargetResource' :: Maybe TargetResource
targetResource = Maybe TargetResource
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:DNSTargetResource' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recordSetId:DNSTargetResource' :: Maybe Text
recordSetId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Hosted Zone ARN that contains the DNS record with the provided name
-- of target resource.
dNSTargetResource_hostedZoneArn :: Lens.Lens' DNSTargetResource (Prelude.Maybe Prelude.Text)
dNSTargetResource_hostedZoneArn :: (Maybe Text -> f (Maybe Text))
-> DNSTargetResource -> f DNSTargetResource
dNSTargetResource_hostedZoneArn = (DNSTargetResource -> Maybe Text)
-> (DNSTargetResource -> Maybe Text -> DNSTargetResource)
-> Lens
     DNSTargetResource DNSTargetResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DNSTargetResource' {Maybe Text
hostedZoneArn :: Maybe Text
$sel:hostedZoneArn:DNSTargetResource' :: DNSTargetResource -> Maybe Text
hostedZoneArn} -> Maybe Text
hostedZoneArn) (\s :: DNSTargetResource
s@DNSTargetResource' {} Maybe Text
a -> DNSTargetResource
s {$sel:hostedZoneArn:DNSTargetResource' :: Maybe Text
hostedZoneArn = Maybe Text
a} :: DNSTargetResource)

-- | The Type of DNS Record of target resource
dNSTargetResource_recordType :: Lens.Lens' DNSTargetResource (Prelude.Maybe Prelude.Text)
dNSTargetResource_recordType :: (Maybe Text -> f (Maybe Text))
-> DNSTargetResource -> f DNSTargetResource
dNSTargetResource_recordType = (DNSTargetResource -> Maybe Text)
-> (DNSTargetResource -> Maybe Text -> DNSTargetResource)
-> Lens
     DNSTargetResource DNSTargetResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DNSTargetResource' {Maybe Text
recordType :: Maybe Text
$sel:recordType:DNSTargetResource' :: DNSTargetResource -> Maybe Text
recordType} -> Maybe Text
recordType) (\s :: DNSTargetResource
s@DNSTargetResource' {} Maybe Text
a -> DNSTargetResource
s {$sel:recordType:DNSTargetResource' :: Maybe Text
recordType = Maybe Text
a} :: DNSTargetResource)

-- | Undocumented member.
dNSTargetResource_targetResource :: Lens.Lens' DNSTargetResource (Prelude.Maybe TargetResource)
dNSTargetResource_targetResource :: (Maybe TargetResource -> f (Maybe TargetResource))
-> DNSTargetResource -> f DNSTargetResource
dNSTargetResource_targetResource = (DNSTargetResource -> Maybe TargetResource)
-> (DNSTargetResource -> Maybe TargetResource -> DNSTargetResource)
-> Lens
     DNSTargetResource
     DNSTargetResource
     (Maybe TargetResource)
     (Maybe TargetResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DNSTargetResource' {Maybe TargetResource
targetResource :: Maybe TargetResource
$sel:targetResource:DNSTargetResource' :: DNSTargetResource -> Maybe TargetResource
targetResource} -> Maybe TargetResource
targetResource) (\s :: DNSTargetResource
s@DNSTargetResource' {} Maybe TargetResource
a -> DNSTargetResource
s {$sel:targetResource:DNSTargetResource' :: Maybe TargetResource
targetResource = Maybe TargetResource
a} :: DNSTargetResource)

-- | The DNS Name that acts as ingress point to a portion of application
dNSTargetResource_domainName :: Lens.Lens' DNSTargetResource (Prelude.Maybe Prelude.Text)
dNSTargetResource_domainName :: (Maybe Text -> f (Maybe Text))
-> DNSTargetResource -> f DNSTargetResource
dNSTargetResource_domainName = (DNSTargetResource -> Maybe Text)
-> (DNSTargetResource -> Maybe Text -> DNSTargetResource)
-> Lens
     DNSTargetResource DNSTargetResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DNSTargetResource' {Maybe Text
domainName :: Maybe Text
$sel:domainName:DNSTargetResource' :: DNSTargetResource -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: DNSTargetResource
s@DNSTargetResource' {} Maybe Text
a -> DNSTargetResource
s {$sel:domainName:DNSTargetResource' :: Maybe Text
domainName = Maybe Text
a} :: DNSTargetResource)

-- | The R53 Set Id to uniquely identify a record given a Name and a Type
dNSTargetResource_recordSetId :: Lens.Lens' DNSTargetResource (Prelude.Maybe Prelude.Text)
dNSTargetResource_recordSetId :: (Maybe Text -> f (Maybe Text))
-> DNSTargetResource -> f DNSTargetResource
dNSTargetResource_recordSetId = (DNSTargetResource -> Maybe Text)
-> (DNSTargetResource -> Maybe Text -> DNSTargetResource)
-> Lens
     DNSTargetResource DNSTargetResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DNSTargetResource' {Maybe Text
recordSetId :: Maybe Text
$sel:recordSetId:DNSTargetResource' :: DNSTargetResource -> Maybe Text
recordSetId} -> Maybe Text
recordSetId) (\s :: DNSTargetResource
s@DNSTargetResource' {} Maybe Text
a -> DNSTargetResource
s {$sel:recordSetId:DNSTargetResource' :: Maybe Text
recordSetId = Maybe Text
a} :: DNSTargetResource)

instance Core.FromJSON DNSTargetResource where
  parseJSON :: Value -> Parser DNSTargetResource
parseJSON =
    String
-> (Object -> Parser DNSTargetResource)
-> Value
-> Parser DNSTargetResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DNSTargetResource"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe TargetResource
-> Maybe Text
-> Maybe Text
-> DNSTargetResource
DNSTargetResource'
            (Maybe Text
 -> Maybe Text
 -> Maybe TargetResource
 -> Maybe Text
 -> Maybe Text
 -> DNSTargetResource)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe TargetResource
      -> Maybe Text
      -> Maybe Text
      -> DNSTargetResource)
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
"hostedZoneArn")
            Parser
  (Maybe Text
   -> Maybe TargetResource
   -> Maybe Text
   -> Maybe Text
   -> DNSTargetResource)
-> Parser (Maybe Text)
-> Parser
     (Maybe TargetResource
      -> Maybe Text -> Maybe Text -> DNSTargetResource)
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
"recordType")
            Parser
  (Maybe TargetResource
   -> Maybe Text -> Maybe Text -> DNSTargetResource)
-> Parser (Maybe TargetResource)
-> Parser (Maybe Text -> Maybe Text -> DNSTargetResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TargetResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targetResource")
            Parser (Maybe Text -> Maybe Text -> DNSTargetResource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DNSTargetResource)
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
"domainName")
            Parser (Maybe Text -> DNSTargetResource)
-> Parser (Maybe Text) -> Parser DNSTargetResource
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
"recordSetId")
      )

instance Prelude.Hashable DNSTargetResource

instance Prelude.NFData DNSTargetResource

instance Core.ToJSON DNSTargetResource where
  toJSON :: DNSTargetResource -> Value
toJSON DNSTargetResource' {Maybe Text
Maybe TargetResource
recordSetId :: Maybe Text
domainName :: Maybe Text
targetResource :: Maybe TargetResource
recordType :: Maybe Text
hostedZoneArn :: Maybe Text
$sel:recordSetId:DNSTargetResource' :: DNSTargetResource -> Maybe Text
$sel:domainName:DNSTargetResource' :: DNSTargetResource -> Maybe Text
$sel:targetResource:DNSTargetResource' :: DNSTargetResource -> Maybe TargetResource
$sel:recordType:DNSTargetResource' :: DNSTargetResource -> Maybe Text
$sel:hostedZoneArn:DNSTargetResource' :: DNSTargetResource -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"hostedZoneArn" 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
hostedZoneArn,
            (Text
"recordType" 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
recordType,
            (Text
"targetResource" Text -> TargetResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (TargetResource -> Pair) -> Maybe TargetResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TargetResource
targetResource,
            (Text
"domainName" 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
domainName,
            (Text
"recordSetId" 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
recordSetId
          ]
      )