{-# 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.Route53.GetReusableDelegationSet
-- 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)
--
-- Retrieves information about a specified reusable delegation set,
-- including the four name servers that are assigned to the delegation set.
module Amazonka.Route53.GetReusableDelegationSet
  ( -- * Creating a Request
    GetReusableDelegationSet (..),
    newGetReusableDelegationSet,

    -- * Request Lenses
    getReusableDelegationSet_id,

    -- * Destructuring the Response
    GetReusableDelegationSetResponse (..),
    newGetReusableDelegationSetResponse,

    -- * Response Lenses
    getReusableDelegationSetResponse_httpStatus,
    getReusableDelegationSetResponse_delegationSet,
  )
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.Route53.Types

-- | A request to get information about a specified reusable delegation set.
--
-- /See:/ 'newGetReusableDelegationSet' smart constructor.
data GetReusableDelegationSet = GetReusableDelegationSet'
  { -- | The ID of the reusable delegation set that you want to get a list of
    -- name servers for.
    GetReusableDelegationSet -> ResourceId
id :: ResourceId
  }
  deriving (GetReusableDelegationSet -> GetReusableDelegationSet -> Bool
(GetReusableDelegationSet -> GetReusableDelegationSet -> Bool)
-> (GetReusableDelegationSet -> GetReusableDelegationSet -> Bool)
-> Eq GetReusableDelegationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReusableDelegationSet -> GetReusableDelegationSet -> Bool
$c/= :: GetReusableDelegationSet -> GetReusableDelegationSet -> Bool
== :: GetReusableDelegationSet -> GetReusableDelegationSet -> Bool
$c== :: GetReusableDelegationSet -> GetReusableDelegationSet -> Bool
Prelude.Eq, ReadPrec [GetReusableDelegationSet]
ReadPrec GetReusableDelegationSet
Int -> ReadS GetReusableDelegationSet
ReadS [GetReusableDelegationSet]
(Int -> ReadS GetReusableDelegationSet)
-> ReadS [GetReusableDelegationSet]
-> ReadPrec GetReusableDelegationSet
-> ReadPrec [GetReusableDelegationSet]
-> Read GetReusableDelegationSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReusableDelegationSet]
$creadListPrec :: ReadPrec [GetReusableDelegationSet]
readPrec :: ReadPrec GetReusableDelegationSet
$creadPrec :: ReadPrec GetReusableDelegationSet
readList :: ReadS [GetReusableDelegationSet]
$creadList :: ReadS [GetReusableDelegationSet]
readsPrec :: Int -> ReadS GetReusableDelegationSet
$creadsPrec :: Int -> ReadS GetReusableDelegationSet
Prelude.Read, Int -> GetReusableDelegationSet -> ShowS
[GetReusableDelegationSet] -> ShowS
GetReusableDelegationSet -> String
(Int -> GetReusableDelegationSet -> ShowS)
-> (GetReusableDelegationSet -> String)
-> ([GetReusableDelegationSet] -> ShowS)
-> Show GetReusableDelegationSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReusableDelegationSet] -> ShowS
$cshowList :: [GetReusableDelegationSet] -> ShowS
show :: GetReusableDelegationSet -> String
$cshow :: GetReusableDelegationSet -> String
showsPrec :: Int -> GetReusableDelegationSet -> ShowS
$cshowsPrec :: Int -> GetReusableDelegationSet -> ShowS
Prelude.Show, (forall x.
 GetReusableDelegationSet -> Rep GetReusableDelegationSet x)
-> (forall x.
    Rep GetReusableDelegationSet x -> GetReusableDelegationSet)
-> Generic GetReusableDelegationSet
forall x.
Rep GetReusableDelegationSet x -> GetReusableDelegationSet
forall x.
GetReusableDelegationSet -> Rep GetReusableDelegationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReusableDelegationSet x -> GetReusableDelegationSet
$cfrom :: forall x.
GetReusableDelegationSet -> Rep GetReusableDelegationSet x
Prelude.Generic)

-- |
-- Create a value of 'GetReusableDelegationSet' 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:
--
-- 'id', 'getReusableDelegationSet_id' - The ID of the reusable delegation set that you want to get a list of
-- name servers for.
newGetReusableDelegationSet ::
  -- | 'id'
  ResourceId ->
  GetReusableDelegationSet
newGetReusableDelegationSet :: ResourceId -> GetReusableDelegationSet
newGetReusableDelegationSet ResourceId
pId_ =
  GetReusableDelegationSet' :: ResourceId -> GetReusableDelegationSet
GetReusableDelegationSet' {$sel:id:GetReusableDelegationSet' :: ResourceId
id = ResourceId
pId_}

-- | The ID of the reusable delegation set that you want to get a list of
-- name servers for.
getReusableDelegationSet_id :: Lens.Lens' GetReusableDelegationSet ResourceId
getReusableDelegationSet_id :: (ResourceId -> f ResourceId)
-> GetReusableDelegationSet -> f GetReusableDelegationSet
getReusableDelegationSet_id = (GetReusableDelegationSet -> ResourceId)
-> (GetReusableDelegationSet
    -> ResourceId -> GetReusableDelegationSet)
-> Lens
     GetReusableDelegationSet
     GetReusableDelegationSet
     ResourceId
     ResourceId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReusableDelegationSet' {ResourceId
id :: ResourceId
$sel:id:GetReusableDelegationSet' :: GetReusableDelegationSet -> ResourceId
id} -> ResourceId
id) (\s :: GetReusableDelegationSet
s@GetReusableDelegationSet' {} ResourceId
a -> GetReusableDelegationSet
s {$sel:id:GetReusableDelegationSet' :: ResourceId
id = ResourceId
a} :: GetReusableDelegationSet)

instance Core.AWSRequest GetReusableDelegationSet where
  type
    AWSResponse GetReusableDelegationSet =
      GetReusableDelegationSetResponse
  request :: GetReusableDelegationSet -> Request GetReusableDelegationSet
request = Service
-> GetReusableDelegationSet -> Request GetReusableDelegationSet
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetReusableDelegationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReusableDelegationSet)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetReusableDelegationSet))
-> Logger
-> Service
-> Proxy GetReusableDelegationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReusableDelegationSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DelegationSet -> GetReusableDelegationSetResponse
GetReusableDelegationSetResponse'
            (Int -> DelegationSet -> GetReusableDelegationSetResponse)
-> Either String Int
-> Either
     String (DelegationSet -> GetReusableDelegationSetResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (DelegationSet -> GetReusableDelegationSetResponse)
-> Either String DelegationSet
-> Either String GetReusableDelegationSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String DelegationSet
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DelegationSet")
      )

instance Prelude.Hashable GetReusableDelegationSet

instance Prelude.NFData GetReusableDelegationSet

instance Core.ToHeaders GetReusableDelegationSet where
  toHeaders :: GetReusableDelegationSet -> ResponseHeaders
toHeaders = ResponseHeaders -> GetReusableDelegationSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath GetReusableDelegationSet where
  toPath :: GetReusableDelegationSet -> ByteString
toPath GetReusableDelegationSet' {ResourceId
id :: ResourceId
$sel:id:GetReusableDelegationSet' :: GetReusableDelegationSet -> ResourceId
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2013-04-01/delegationset/", ResourceId -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceId
id]

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

-- | A complex type that contains the response to the
-- @GetReusableDelegationSet@ request.
--
-- /See:/ 'newGetReusableDelegationSetResponse' smart constructor.
data GetReusableDelegationSetResponse = GetReusableDelegationSetResponse'
  { -- | The response's http status code.
    GetReusableDelegationSetResponse -> Int
httpStatus :: Prelude.Int,
    -- | A complex type that contains information about the reusable delegation
    -- set.
    GetReusableDelegationSetResponse -> DelegationSet
delegationSet :: DelegationSet
  }
  deriving (GetReusableDelegationSetResponse
-> GetReusableDelegationSetResponse -> Bool
(GetReusableDelegationSetResponse
 -> GetReusableDelegationSetResponse -> Bool)
-> (GetReusableDelegationSetResponse
    -> GetReusableDelegationSetResponse -> Bool)
-> Eq GetReusableDelegationSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReusableDelegationSetResponse
-> GetReusableDelegationSetResponse -> Bool
$c/= :: GetReusableDelegationSetResponse
-> GetReusableDelegationSetResponse -> Bool
== :: GetReusableDelegationSetResponse
-> GetReusableDelegationSetResponse -> Bool
$c== :: GetReusableDelegationSetResponse
-> GetReusableDelegationSetResponse -> Bool
Prelude.Eq, ReadPrec [GetReusableDelegationSetResponse]
ReadPrec GetReusableDelegationSetResponse
Int -> ReadS GetReusableDelegationSetResponse
ReadS [GetReusableDelegationSetResponse]
(Int -> ReadS GetReusableDelegationSetResponse)
-> ReadS [GetReusableDelegationSetResponse]
-> ReadPrec GetReusableDelegationSetResponse
-> ReadPrec [GetReusableDelegationSetResponse]
-> Read GetReusableDelegationSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReusableDelegationSetResponse]
$creadListPrec :: ReadPrec [GetReusableDelegationSetResponse]
readPrec :: ReadPrec GetReusableDelegationSetResponse
$creadPrec :: ReadPrec GetReusableDelegationSetResponse
readList :: ReadS [GetReusableDelegationSetResponse]
$creadList :: ReadS [GetReusableDelegationSetResponse]
readsPrec :: Int -> ReadS GetReusableDelegationSetResponse
$creadsPrec :: Int -> ReadS GetReusableDelegationSetResponse
Prelude.Read, Int -> GetReusableDelegationSetResponse -> ShowS
[GetReusableDelegationSetResponse] -> ShowS
GetReusableDelegationSetResponse -> String
(Int -> GetReusableDelegationSetResponse -> ShowS)
-> (GetReusableDelegationSetResponse -> String)
-> ([GetReusableDelegationSetResponse] -> ShowS)
-> Show GetReusableDelegationSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReusableDelegationSetResponse] -> ShowS
$cshowList :: [GetReusableDelegationSetResponse] -> ShowS
show :: GetReusableDelegationSetResponse -> String
$cshow :: GetReusableDelegationSetResponse -> String
showsPrec :: Int -> GetReusableDelegationSetResponse -> ShowS
$cshowsPrec :: Int -> GetReusableDelegationSetResponse -> ShowS
Prelude.Show, (forall x.
 GetReusableDelegationSetResponse
 -> Rep GetReusableDelegationSetResponse x)
-> (forall x.
    Rep GetReusableDelegationSetResponse x
    -> GetReusableDelegationSetResponse)
-> Generic GetReusableDelegationSetResponse
forall x.
Rep GetReusableDelegationSetResponse x
-> GetReusableDelegationSetResponse
forall x.
GetReusableDelegationSetResponse
-> Rep GetReusableDelegationSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReusableDelegationSetResponse x
-> GetReusableDelegationSetResponse
$cfrom :: forall x.
GetReusableDelegationSetResponse
-> Rep GetReusableDelegationSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetReusableDelegationSetResponse' 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:
--
-- 'httpStatus', 'getReusableDelegationSetResponse_httpStatus' - The response's http status code.
--
-- 'delegationSet', 'getReusableDelegationSetResponse_delegationSet' - A complex type that contains information about the reusable delegation
-- set.
newGetReusableDelegationSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'delegationSet'
  DelegationSet ->
  GetReusableDelegationSetResponse
newGetReusableDelegationSetResponse :: Int -> DelegationSet -> GetReusableDelegationSetResponse
newGetReusableDelegationSetResponse
  Int
pHttpStatus_
  DelegationSet
pDelegationSet_ =
    GetReusableDelegationSetResponse' :: Int -> DelegationSet -> GetReusableDelegationSetResponse
GetReusableDelegationSetResponse'
      { $sel:httpStatus:GetReusableDelegationSetResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:delegationSet:GetReusableDelegationSetResponse' :: DelegationSet
delegationSet = DelegationSet
pDelegationSet_
      }

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

-- | A complex type that contains information about the reusable delegation
-- set.
getReusableDelegationSetResponse_delegationSet :: Lens.Lens' GetReusableDelegationSetResponse DelegationSet
getReusableDelegationSetResponse_delegationSet :: (DelegationSet -> f DelegationSet)
-> GetReusableDelegationSetResponse
-> f GetReusableDelegationSetResponse
getReusableDelegationSetResponse_delegationSet = (GetReusableDelegationSetResponse -> DelegationSet)
-> (GetReusableDelegationSetResponse
    -> DelegationSet -> GetReusableDelegationSetResponse)
-> Lens
     GetReusableDelegationSetResponse
     GetReusableDelegationSetResponse
     DelegationSet
     DelegationSet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReusableDelegationSetResponse' {DelegationSet
delegationSet :: DelegationSet
$sel:delegationSet:GetReusableDelegationSetResponse' :: GetReusableDelegationSetResponse -> DelegationSet
delegationSet} -> DelegationSet
delegationSet) (\s :: GetReusableDelegationSetResponse
s@GetReusableDelegationSetResponse' {} DelegationSet
a -> GetReusableDelegationSetResponse
s {$sel:delegationSet:GetReusableDelegationSetResponse' :: DelegationSet
delegationSet = DelegationSet
a} :: GetReusableDelegationSetResponse)

instance
  Prelude.NFData
    GetReusableDelegationSetResponse