{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53Resolver.GetResolverDnssecConfig
-- 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)
--
-- Gets DNSSEC validation information for a specified resource.
module Amazonka.Route53Resolver.GetResolverDnssecConfig
  ( -- * Creating a Request
    GetResolverDnssecConfig (..),
    newGetResolverDnssecConfig,

    -- * Request Lenses
    getResolverDnssecConfig_resourceId,

    -- * Destructuring the Response
    GetResolverDnssecConfigResponse (..),
    newGetResolverDnssecConfigResponse,

    -- * Response Lenses
    getResolverDnssecConfigResponse_resolverDNSSECConfig,
    getResolverDnssecConfigResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Resolver.Types

-- | /See:/ 'newGetResolverDnssecConfig' smart constructor.
data GetResolverDnssecConfig = GetResolverDnssecConfig'
  { -- | The ID of the virtual private cloud (VPC) for the DNSSEC validation
    -- status.
    GetResolverDnssecConfig -> Text
resourceId :: Prelude.Text
  }
  deriving (GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool
(GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool)
-> (GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool)
-> Eq GetResolverDnssecConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool
$c/= :: GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool
== :: GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool
$c== :: GetResolverDnssecConfig -> GetResolverDnssecConfig -> Bool
Prelude.Eq, ReadPrec [GetResolverDnssecConfig]
ReadPrec GetResolverDnssecConfig
Int -> ReadS GetResolverDnssecConfig
ReadS [GetResolverDnssecConfig]
(Int -> ReadS GetResolverDnssecConfig)
-> ReadS [GetResolverDnssecConfig]
-> ReadPrec GetResolverDnssecConfig
-> ReadPrec [GetResolverDnssecConfig]
-> Read GetResolverDnssecConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverDnssecConfig]
$creadListPrec :: ReadPrec [GetResolverDnssecConfig]
readPrec :: ReadPrec GetResolverDnssecConfig
$creadPrec :: ReadPrec GetResolverDnssecConfig
readList :: ReadS [GetResolverDnssecConfig]
$creadList :: ReadS [GetResolverDnssecConfig]
readsPrec :: Int -> ReadS GetResolverDnssecConfig
$creadsPrec :: Int -> ReadS GetResolverDnssecConfig
Prelude.Read, Int -> GetResolverDnssecConfig -> ShowS
[GetResolverDnssecConfig] -> ShowS
GetResolverDnssecConfig -> String
(Int -> GetResolverDnssecConfig -> ShowS)
-> (GetResolverDnssecConfig -> String)
-> ([GetResolverDnssecConfig] -> ShowS)
-> Show GetResolverDnssecConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverDnssecConfig] -> ShowS
$cshowList :: [GetResolverDnssecConfig] -> ShowS
show :: GetResolverDnssecConfig -> String
$cshow :: GetResolverDnssecConfig -> String
showsPrec :: Int -> GetResolverDnssecConfig -> ShowS
$cshowsPrec :: Int -> GetResolverDnssecConfig -> ShowS
Prelude.Show, (forall x.
 GetResolverDnssecConfig -> Rep GetResolverDnssecConfig x)
-> (forall x.
    Rep GetResolverDnssecConfig x -> GetResolverDnssecConfig)
-> Generic GetResolverDnssecConfig
forall x. Rep GetResolverDnssecConfig x -> GetResolverDnssecConfig
forall x. GetResolverDnssecConfig -> Rep GetResolverDnssecConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetResolverDnssecConfig x -> GetResolverDnssecConfig
$cfrom :: forall x. GetResolverDnssecConfig -> Rep GetResolverDnssecConfig x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverDnssecConfig' 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:
--
-- 'resourceId', 'getResolverDnssecConfig_resourceId' - The ID of the virtual private cloud (VPC) for the DNSSEC validation
-- status.
newGetResolverDnssecConfig ::
  -- | 'resourceId'
  Prelude.Text ->
  GetResolverDnssecConfig
newGetResolverDnssecConfig :: Text -> GetResolverDnssecConfig
newGetResolverDnssecConfig Text
pResourceId_ =
  GetResolverDnssecConfig' :: Text -> GetResolverDnssecConfig
GetResolverDnssecConfig' {$sel:resourceId:GetResolverDnssecConfig' :: Text
resourceId = Text
pResourceId_}

-- | The ID of the virtual private cloud (VPC) for the DNSSEC validation
-- status.
getResolverDnssecConfig_resourceId :: Lens.Lens' GetResolverDnssecConfig Prelude.Text
getResolverDnssecConfig_resourceId :: (Text -> f Text)
-> GetResolverDnssecConfig -> f GetResolverDnssecConfig
getResolverDnssecConfig_resourceId = (GetResolverDnssecConfig -> Text)
-> (GetResolverDnssecConfig -> Text -> GetResolverDnssecConfig)
-> Lens GetResolverDnssecConfig GetResolverDnssecConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverDnssecConfig' {Text
resourceId :: Text
$sel:resourceId:GetResolverDnssecConfig' :: GetResolverDnssecConfig -> Text
resourceId} -> Text
resourceId) (\s :: GetResolverDnssecConfig
s@GetResolverDnssecConfig' {} Text
a -> GetResolverDnssecConfig
s {$sel:resourceId:GetResolverDnssecConfig' :: Text
resourceId = Text
a} :: GetResolverDnssecConfig)

instance Core.AWSRequest GetResolverDnssecConfig where
  type
    AWSResponse GetResolverDnssecConfig =
      GetResolverDnssecConfigResponse
  request :: GetResolverDnssecConfig -> Request GetResolverDnssecConfig
request = Service
-> GetResolverDnssecConfig -> Request GetResolverDnssecConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetResolverDnssecConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverDnssecConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetResolverDnssecConfig))
-> Logger
-> Service
-> Proxy GetResolverDnssecConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverDnssecConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ResolverDnssecConfig
-> Int -> GetResolverDnssecConfigResponse
GetResolverDnssecConfigResponse'
            (Maybe ResolverDnssecConfig
 -> Int -> GetResolverDnssecConfigResponse)
-> Either String (Maybe ResolverDnssecConfig)
-> Either String (Int -> GetResolverDnssecConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverDnssecConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverDNSSECConfig")
            Either String (Int -> GetResolverDnssecConfigResponse)
-> Either String Int
-> Either String GetResolverDnssecConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetResolverDnssecConfig

instance Prelude.NFData GetResolverDnssecConfig

instance Core.ToHeaders GetResolverDnssecConfig where
  toHeaders :: GetResolverDnssecConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetResolverDnssecConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Route53Resolver.GetResolverDnssecConfig" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetResolverDnssecConfig where
  toJSON :: GetResolverDnssecConfig -> Value
toJSON GetResolverDnssecConfig' {Text
resourceId :: Text
$sel:resourceId:GetResolverDnssecConfig' :: GetResolverDnssecConfig -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)]
      )

instance Core.ToPath GetResolverDnssecConfig where
  toPath :: GetResolverDnssecConfig -> ByteString
toPath = ByteString -> GetResolverDnssecConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetResolverDnssecConfig where
  toQuery :: GetResolverDnssecConfig -> QueryString
toQuery = QueryString -> GetResolverDnssecConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetResolverDnssecConfigResponse' smart constructor.
data GetResolverDnssecConfigResponse = GetResolverDnssecConfigResponse'
  { -- | The information about a configuration for DNSSEC validation.
    GetResolverDnssecConfigResponse -> Maybe ResolverDnssecConfig
resolverDNSSECConfig :: Prelude.Maybe ResolverDnssecConfig,
    -- | The response's http status code.
    GetResolverDnssecConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetResolverDnssecConfigResponse
-> GetResolverDnssecConfigResponse -> Bool
(GetResolverDnssecConfigResponse
 -> GetResolverDnssecConfigResponse -> Bool)
-> (GetResolverDnssecConfigResponse
    -> GetResolverDnssecConfigResponse -> Bool)
-> Eq GetResolverDnssecConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverDnssecConfigResponse
-> GetResolverDnssecConfigResponse -> Bool
$c/= :: GetResolverDnssecConfigResponse
-> GetResolverDnssecConfigResponse -> Bool
== :: GetResolverDnssecConfigResponse
-> GetResolverDnssecConfigResponse -> Bool
$c== :: GetResolverDnssecConfigResponse
-> GetResolverDnssecConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetResolverDnssecConfigResponse]
ReadPrec GetResolverDnssecConfigResponse
Int -> ReadS GetResolverDnssecConfigResponse
ReadS [GetResolverDnssecConfigResponse]
(Int -> ReadS GetResolverDnssecConfigResponse)
-> ReadS [GetResolverDnssecConfigResponse]
-> ReadPrec GetResolverDnssecConfigResponse
-> ReadPrec [GetResolverDnssecConfigResponse]
-> Read GetResolverDnssecConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverDnssecConfigResponse]
$creadListPrec :: ReadPrec [GetResolverDnssecConfigResponse]
readPrec :: ReadPrec GetResolverDnssecConfigResponse
$creadPrec :: ReadPrec GetResolverDnssecConfigResponse
readList :: ReadS [GetResolverDnssecConfigResponse]
$creadList :: ReadS [GetResolverDnssecConfigResponse]
readsPrec :: Int -> ReadS GetResolverDnssecConfigResponse
$creadsPrec :: Int -> ReadS GetResolverDnssecConfigResponse
Prelude.Read, Int -> GetResolverDnssecConfigResponse -> ShowS
[GetResolverDnssecConfigResponse] -> ShowS
GetResolverDnssecConfigResponse -> String
(Int -> GetResolverDnssecConfigResponse -> ShowS)
-> (GetResolverDnssecConfigResponse -> String)
-> ([GetResolverDnssecConfigResponse] -> ShowS)
-> Show GetResolverDnssecConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverDnssecConfigResponse] -> ShowS
$cshowList :: [GetResolverDnssecConfigResponse] -> ShowS
show :: GetResolverDnssecConfigResponse -> String
$cshow :: GetResolverDnssecConfigResponse -> String
showsPrec :: Int -> GetResolverDnssecConfigResponse -> ShowS
$cshowsPrec :: Int -> GetResolverDnssecConfigResponse -> ShowS
Prelude.Show, (forall x.
 GetResolverDnssecConfigResponse
 -> Rep GetResolverDnssecConfigResponse x)
-> (forall x.
    Rep GetResolverDnssecConfigResponse x
    -> GetResolverDnssecConfigResponse)
-> Generic GetResolverDnssecConfigResponse
forall x.
Rep GetResolverDnssecConfigResponse x
-> GetResolverDnssecConfigResponse
forall x.
GetResolverDnssecConfigResponse
-> Rep GetResolverDnssecConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResolverDnssecConfigResponse x
-> GetResolverDnssecConfigResponse
$cfrom :: forall x.
GetResolverDnssecConfigResponse
-> Rep GetResolverDnssecConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverDnssecConfigResponse' 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:
--
-- 'resolverDNSSECConfig', 'getResolverDnssecConfigResponse_resolverDNSSECConfig' - The information about a configuration for DNSSEC validation.
--
-- 'httpStatus', 'getResolverDnssecConfigResponse_httpStatus' - The response's http status code.
newGetResolverDnssecConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResolverDnssecConfigResponse
newGetResolverDnssecConfigResponse :: Int -> GetResolverDnssecConfigResponse
newGetResolverDnssecConfigResponse Int
pHttpStatus_ =
  GetResolverDnssecConfigResponse' :: Maybe ResolverDnssecConfig
-> Int -> GetResolverDnssecConfigResponse
GetResolverDnssecConfigResponse'
    { $sel:resolverDNSSECConfig:GetResolverDnssecConfigResponse' :: Maybe ResolverDnssecConfig
resolverDNSSECConfig =
        Maybe ResolverDnssecConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetResolverDnssecConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The information about a configuration for DNSSEC validation.
getResolverDnssecConfigResponse_resolverDNSSECConfig :: Lens.Lens' GetResolverDnssecConfigResponse (Prelude.Maybe ResolverDnssecConfig)
getResolverDnssecConfigResponse_resolverDNSSECConfig :: (Maybe ResolverDnssecConfig -> f (Maybe ResolverDnssecConfig))
-> GetResolverDnssecConfigResponse
-> f GetResolverDnssecConfigResponse
getResolverDnssecConfigResponse_resolverDNSSECConfig = (GetResolverDnssecConfigResponse -> Maybe ResolverDnssecConfig)
-> (GetResolverDnssecConfigResponse
    -> Maybe ResolverDnssecConfig -> GetResolverDnssecConfigResponse)
-> Lens
     GetResolverDnssecConfigResponse
     GetResolverDnssecConfigResponse
     (Maybe ResolverDnssecConfig)
     (Maybe ResolverDnssecConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverDnssecConfigResponse' {Maybe ResolverDnssecConfig
resolverDNSSECConfig :: Maybe ResolverDnssecConfig
$sel:resolverDNSSECConfig:GetResolverDnssecConfigResponse' :: GetResolverDnssecConfigResponse -> Maybe ResolverDnssecConfig
resolverDNSSECConfig} -> Maybe ResolverDnssecConfig
resolverDNSSECConfig) (\s :: GetResolverDnssecConfigResponse
s@GetResolverDnssecConfigResponse' {} Maybe ResolverDnssecConfig
a -> GetResolverDnssecConfigResponse
s {$sel:resolverDNSSECConfig:GetResolverDnssecConfigResponse' :: Maybe ResolverDnssecConfig
resolverDNSSECConfig = Maybe ResolverDnssecConfig
a} :: GetResolverDnssecConfigResponse)

-- | The response's http status code.
getResolverDnssecConfigResponse_httpStatus :: Lens.Lens' GetResolverDnssecConfigResponse Prelude.Int
getResolverDnssecConfigResponse_httpStatus :: (Int -> f Int)
-> GetResolverDnssecConfigResponse
-> f GetResolverDnssecConfigResponse
getResolverDnssecConfigResponse_httpStatus = (GetResolverDnssecConfigResponse -> Int)
-> (GetResolverDnssecConfigResponse
    -> Int -> GetResolverDnssecConfigResponse)
-> Lens
     GetResolverDnssecConfigResponse
     GetResolverDnssecConfigResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverDnssecConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetResolverDnssecConfigResponse' :: GetResolverDnssecConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetResolverDnssecConfigResponse
s@GetResolverDnssecConfigResponse' {} Int
a -> GetResolverDnssecConfigResponse
s {$sel:httpStatus:GetResolverDnssecConfigResponse' :: Int
httpStatus = Int
a} :: GetResolverDnssecConfigResponse)

instance
  Prelude.NFData
    GetResolverDnssecConfigResponse