{-# 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.GetResolverRuleAssociation
-- 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 information about an association between a specified Resolver rule
-- and a VPC. You associate a Resolver rule and a VPC using
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_AssociateResolverRule.html AssociateResolverRule>.
module Amazonka.Route53Resolver.GetResolverRuleAssociation
  ( -- * Creating a Request
    GetResolverRuleAssociation (..),
    newGetResolverRuleAssociation,

    -- * Request Lenses
    getResolverRuleAssociation_resolverRuleAssociationId,

    -- * Destructuring the Response
    GetResolverRuleAssociationResponse (..),
    newGetResolverRuleAssociationResponse,

    -- * Response Lenses
    getResolverRuleAssociationResponse_resolverRuleAssociation,
    getResolverRuleAssociationResponse_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:/ 'newGetResolverRuleAssociation' smart constructor.
data GetResolverRuleAssociation = GetResolverRuleAssociation'
  { -- | The ID of the Resolver rule association that you want to get information
    -- about.
    GetResolverRuleAssociation -> Text
resolverRuleAssociationId :: Prelude.Text
  }
  deriving (GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool
(GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool)
-> (GetResolverRuleAssociation
    -> GetResolverRuleAssociation -> Bool)
-> Eq GetResolverRuleAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool
$c/= :: GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool
== :: GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool
$c== :: GetResolverRuleAssociation -> GetResolverRuleAssociation -> Bool
Prelude.Eq, ReadPrec [GetResolverRuleAssociation]
ReadPrec GetResolverRuleAssociation
Int -> ReadS GetResolverRuleAssociation
ReadS [GetResolverRuleAssociation]
(Int -> ReadS GetResolverRuleAssociation)
-> ReadS [GetResolverRuleAssociation]
-> ReadPrec GetResolverRuleAssociation
-> ReadPrec [GetResolverRuleAssociation]
-> Read GetResolverRuleAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverRuleAssociation]
$creadListPrec :: ReadPrec [GetResolverRuleAssociation]
readPrec :: ReadPrec GetResolverRuleAssociation
$creadPrec :: ReadPrec GetResolverRuleAssociation
readList :: ReadS [GetResolverRuleAssociation]
$creadList :: ReadS [GetResolverRuleAssociation]
readsPrec :: Int -> ReadS GetResolverRuleAssociation
$creadsPrec :: Int -> ReadS GetResolverRuleAssociation
Prelude.Read, Int -> GetResolverRuleAssociation -> ShowS
[GetResolverRuleAssociation] -> ShowS
GetResolverRuleAssociation -> String
(Int -> GetResolverRuleAssociation -> ShowS)
-> (GetResolverRuleAssociation -> String)
-> ([GetResolverRuleAssociation] -> ShowS)
-> Show GetResolverRuleAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverRuleAssociation] -> ShowS
$cshowList :: [GetResolverRuleAssociation] -> ShowS
show :: GetResolverRuleAssociation -> String
$cshow :: GetResolverRuleAssociation -> String
showsPrec :: Int -> GetResolverRuleAssociation -> ShowS
$cshowsPrec :: Int -> GetResolverRuleAssociation -> ShowS
Prelude.Show, (forall x.
 GetResolverRuleAssociation -> Rep GetResolverRuleAssociation x)
-> (forall x.
    Rep GetResolverRuleAssociation x -> GetResolverRuleAssociation)
-> Generic GetResolverRuleAssociation
forall x.
Rep GetResolverRuleAssociation x -> GetResolverRuleAssociation
forall x.
GetResolverRuleAssociation -> Rep GetResolverRuleAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResolverRuleAssociation x -> GetResolverRuleAssociation
$cfrom :: forall x.
GetResolverRuleAssociation -> Rep GetResolverRuleAssociation x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverRuleAssociation' 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:
--
-- 'resolverRuleAssociationId', 'getResolverRuleAssociation_resolverRuleAssociationId' - The ID of the Resolver rule association that you want to get information
-- about.
newGetResolverRuleAssociation ::
  -- | 'resolverRuleAssociationId'
  Prelude.Text ->
  GetResolverRuleAssociation
newGetResolverRuleAssociation :: Text -> GetResolverRuleAssociation
newGetResolverRuleAssociation
  Text
pResolverRuleAssociationId_ =
    GetResolverRuleAssociation' :: Text -> GetResolverRuleAssociation
GetResolverRuleAssociation'
      { $sel:resolverRuleAssociationId:GetResolverRuleAssociation' :: Text
resolverRuleAssociationId =
          Text
pResolverRuleAssociationId_
      }

-- | The ID of the Resolver rule association that you want to get information
-- about.
getResolverRuleAssociation_resolverRuleAssociationId :: Lens.Lens' GetResolverRuleAssociation Prelude.Text
getResolverRuleAssociation_resolverRuleAssociationId :: (Text -> f Text)
-> GetResolverRuleAssociation -> f GetResolverRuleAssociation
getResolverRuleAssociation_resolverRuleAssociationId = (GetResolverRuleAssociation -> Text)
-> (GetResolverRuleAssociation
    -> Text -> GetResolverRuleAssociation)
-> Lens
     GetResolverRuleAssociation GetResolverRuleAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverRuleAssociation' {Text
resolverRuleAssociationId :: Text
$sel:resolverRuleAssociationId:GetResolverRuleAssociation' :: GetResolverRuleAssociation -> Text
resolverRuleAssociationId} -> Text
resolverRuleAssociationId) (\s :: GetResolverRuleAssociation
s@GetResolverRuleAssociation' {} Text
a -> GetResolverRuleAssociation
s {$sel:resolverRuleAssociationId:GetResolverRuleAssociation' :: Text
resolverRuleAssociationId = Text
a} :: GetResolverRuleAssociation)

instance Core.AWSRequest GetResolverRuleAssociation where
  type
    AWSResponse GetResolverRuleAssociation =
      GetResolverRuleAssociationResponse
  request :: GetResolverRuleAssociation -> Request GetResolverRuleAssociation
request = Service
-> GetResolverRuleAssociation -> Request GetResolverRuleAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetResolverRuleAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverRuleAssociation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetResolverRuleAssociation))
-> Logger
-> Service
-> Proxy GetResolverRuleAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverRuleAssociation)))
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 ResolverRuleAssociation
-> Int -> GetResolverRuleAssociationResponse
GetResolverRuleAssociationResponse'
            (Maybe ResolverRuleAssociation
 -> Int -> GetResolverRuleAssociationResponse)
-> Either String (Maybe ResolverRuleAssociation)
-> Either String (Int -> GetResolverRuleAssociationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverRuleAssociation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverRuleAssociation")
            Either String (Int -> GetResolverRuleAssociationResponse)
-> Either String Int
-> Either String GetResolverRuleAssociationResponse
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 GetResolverRuleAssociation

instance Prelude.NFData GetResolverRuleAssociation

instance Core.ToHeaders GetResolverRuleAssociation where
  toHeaders :: GetResolverRuleAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetResolverRuleAssociation -> 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.GetResolverRuleAssociation" ::
                          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 GetResolverRuleAssociation where
  toJSON :: GetResolverRuleAssociation -> Value
toJSON GetResolverRuleAssociation' {Text
resolverRuleAssociationId :: Text
$sel:resolverRuleAssociationId:GetResolverRuleAssociation' :: GetResolverRuleAssociation -> 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
"ResolverRuleAssociationId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverRuleAssociationId
              )
          ]
      )

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

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

-- | /See:/ 'newGetResolverRuleAssociationResponse' smart constructor.
data GetResolverRuleAssociationResponse = GetResolverRuleAssociationResponse'
  { -- | Information about the Resolver rule association that you specified in a
    -- @GetResolverRuleAssociation@ request.
    GetResolverRuleAssociationResponse -> Maybe ResolverRuleAssociation
resolverRuleAssociation :: Prelude.Maybe ResolverRuleAssociation,
    -- | The response's http status code.
    GetResolverRuleAssociationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetResolverRuleAssociationResponse
-> GetResolverRuleAssociationResponse -> Bool
(GetResolverRuleAssociationResponse
 -> GetResolverRuleAssociationResponse -> Bool)
-> (GetResolverRuleAssociationResponse
    -> GetResolverRuleAssociationResponse -> Bool)
-> Eq GetResolverRuleAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverRuleAssociationResponse
-> GetResolverRuleAssociationResponse -> Bool
$c/= :: GetResolverRuleAssociationResponse
-> GetResolverRuleAssociationResponse -> Bool
== :: GetResolverRuleAssociationResponse
-> GetResolverRuleAssociationResponse -> Bool
$c== :: GetResolverRuleAssociationResponse
-> GetResolverRuleAssociationResponse -> Bool
Prelude.Eq, ReadPrec [GetResolverRuleAssociationResponse]
ReadPrec GetResolverRuleAssociationResponse
Int -> ReadS GetResolverRuleAssociationResponse
ReadS [GetResolverRuleAssociationResponse]
(Int -> ReadS GetResolverRuleAssociationResponse)
-> ReadS [GetResolverRuleAssociationResponse]
-> ReadPrec GetResolverRuleAssociationResponse
-> ReadPrec [GetResolverRuleAssociationResponse]
-> Read GetResolverRuleAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverRuleAssociationResponse]
$creadListPrec :: ReadPrec [GetResolverRuleAssociationResponse]
readPrec :: ReadPrec GetResolverRuleAssociationResponse
$creadPrec :: ReadPrec GetResolverRuleAssociationResponse
readList :: ReadS [GetResolverRuleAssociationResponse]
$creadList :: ReadS [GetResolverRuleAssociationResponse]
readsPrec :: Int -> ReadS GetResolverRuleAssociationResponse
$creadsPrec :: Int -> ReadS GetResolverRuleAssociationResponse
Prelude.Read, Int -> GetResolverRuleAssociationResponse -> ShowS
[GetResolverRuleAssociationResponse] -> ShowS
GetResolverRuleAssociationResponse -> String
(Int -> GetResolverRuleAssociationResponse -> ShowS)
-> (GetResolverRuleAssociationResponse -> String)
-> ([GetResolverRuleAssociationResponse] -> ShowS)
-> Show GetResolverRuleAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverRuleAssociationResponse] -> ShowS
$cshowList :: [GetResolverRuleAssociationResponse] -> ShowS
show :: GetResolverRuleAssociationResponse -> String
$cshow :: GetResolverRuleAssociationResponse -> String
showsPrec :: Int -> GetResolverRuleAssociationResponse -> ShowS
$cshowsPrec :: Int -> GetResolverRuleAssociationResponse -> ShowS
Prelude.Show, (forall x.
 GetResolverRuleAssociationResponse
 -> Rep GetResolverRuleAssociationResponse x)
-> (forall x.
    Rep GetResolverRuleAssociationResponse x
    -> GetResolverRuleAssociationResponse)
-> Generic GetResolverRuleAssociationResponse
forall x.
Rep GetResolverRuleAssociationResponse x
-> GetResolverRuleAssociationResponse
forall x.
GetResolverRuleAssociationResponse
-> Rep GetResolverRuleAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResolverRuleAssociationResponse x
-> GetResolverRuleAssociationResponse
$cfrom :: forall x.
GetResolverRuleAssociationResponse
-> Rep GetResolverRuleAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverRuleAssociationResponse' 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:
--
-- 'resolverRuleAssociation', 'getResolverRuleAssociationResponse_resolverRuleAssociation' - Information about the Resolver rule association that you specified in a
-- @GetResolverRuleAssociation@ request.
--
-- 'httpStatus', 'getResolverRuleAssociationResponse_httpStatus' - The response's http status code.
newGetResolverRuleAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResolverRuleAssociationResponse
newGetResolverRuleAssociationResponse :: Int -> GetResolverRuleAssociationResponse
newGetResolverRuleAssociationResponse Int
pHttpStatus_ =
  GetResolverRuleAssociationResponse' :: Maybe ResolverRuleAssociation
-> Int -> GetResolverRuleAssociationResponse
GetResolverRuleAssociationResponse'
    { $sel:resolverRuleAssociation:GetResolverRuleAssociationResponse' :: Maybe ResolverRuleAssociation
resolverRuleAssociation =
        Maybe ResolverRuleAssociation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetResolverRuleAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the Resolver rule association that you specified in a
-- @GetResolverRuleAssociation@ request.
getResolverRuleAssociationResponse_resolverRuleAssociation :: Lens.Lens' GetResolverRuleAssociationResponse (Prelude.Maybe ResolverRuleAssociation)
getResolverRuleAssociationResponse_resolverRuleAssociation :: (Maybe ResolverRuleAssociation
 -> f (Maybe ResolverRuleAssociation))
-> GetResolverRuleAssociationResponse
-> f GetResolverRuleAssociationResponse
getResolverRuleAssociationResponse_resolverRuleAssociation = (GetResolverRuleAssociationResponse
 -> Maybe ResolverRuleAssociation)
-> (GetResolverRuleAssociationResponse
    -> Maybe ResolverRuleAssociation
    -> GetResolverRuleAssociationResponse)
-> Lens
     GetResolverRuleAssociationResponse
     GetResolverRuleAssociationResponse
     (Maybe ResolverRuleAssociation)
     (Maybe ResolverRuleAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverRuleAssociationResponse' {Maybe ResolverRuleAssociation
resolverRuleAssociation :: Maybe ResolverRuleAssociation
$sel:resolverRuleAssociation:GetResolverRuleAssociationResponse' :: GetResolverRuleAssociationResponse -> Maybe ResolverRuleAssociation
resolverRuleAssociation} -> Maybe ResolverRuleAssociation
resolverRuleAssociation) (\s :: GetResolverRuleAssociationResponse
s@GetResolverRuleAssociationResponse' {} Maybe ResolverRuleAssociation
a -> GetResolverRuleAssociationResponse
s {$sel:resolverRuleAssociation:GetResolverRuleAssociationResponse' :: Maybe ResolverRuleAssociation
resolverRuleAssociation = Maybe ResolverRuleAssociation
a} :: GetResolverRuleAssociationResponse)

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

instance
  Prelude.NFData
    GetResolverRuleAssociationResponse