{-# 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.GetFirewallRuleGroupPolicy
-- 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)
--
-- Returns the Identity and Access Management (Amazon Web Services IAM)
-- policy for sharing the specified rule group. You can use the policy to
-- share the rule group using Resource Access Manager (RAM).
module Amazonka.Route53Resolver.GetFirewallRuleGroupPolicy
  ( -- * Creating a Request
    GetFirewallRuleGroupPolicy (..),
    newGetFirewallRuleGroupPolicy,

    -- * Request Lenses
    getFirewallRuleGroupPolicy_arn,

    -- * Destructuring the Response
    GetFirewallRuleGroupPolicyResponse (..),
    newGetFirewallRuleGroupPolicyResponse,

    -- * Response Lenses
    getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy,
    getFirewallRuleGroupPolicyResponse_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:/ 'newGetFirewallRuleGroupPolicy' smart constructor.
data GetFirewallRuleGroupPolicy = GetFirewallRuleGroupPolicy'
  { -- | The ARN (Amazon Resource Name) for the rule group.
    GetFirewallRuleGroupPolicy -> Text
arn :: Prelude.Text
  }
  deriving (GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool
(GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool)
-> (GetFirewallRuleGroupPolicy
    -> GetFirewallRuleGroupPolicy -> Bool)
-> Eq GetFirewallRuleGroupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool
$c/= :: GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool
== :: GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool
$c== :: GetFirewallRuleGroupPolicy -> GetFirewallRuleGroupPolicy -> Bool
Prelude.Eq, ReadPrec [GetFirewallRuleGroupPolicy]
ReadPrec GetFirewallRuleGroupPolicy
Int -> ReadS GetFirewallRuleGroupPolicy
ReadS [GetFirewallRuleGroupPolicy]
(Int -> ReadS GetFirewallRuleGroupPolicy)
-> ReadS [GetFirewallRuleGroupPolicy]
-> ReadPrec GetFirewallRuleGroupPolicy
-> ReadPrec [GetFirewallRuleGroupPolicy]
-> Read GetFirewallRuleGroupPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFirewallRuleGroupPolicy]
$creadListPrec :: ReadPrec [GetFirewallRuleGroupPolicy]
readPrec :: ReadPrec GetFirewallRuleGroupPolicy
$creadPrec :: ReadPrec GetFirewallRuleGroupPolicy
readList :: ReadS [GetFirewallRuleGroupPolicy]
$creadList :: ReadS [GetFirewallRuleGroupPolicy]
readsPrec :: Int -> ReadS GetFirewallRuleGroupPolicy
$creadsPrec :: Int -> ReadS GetFirewallRuleGroupPolicy
Prelude.Read, Int -> GetFirewallRuleGroupPolicy -> ShowS
[GetFirewallRuleGroupPolicy] -> ShowS
GetFirewallRuleGroupPolicy -> String
(Int -> GetFirewallRuleGroupPolicy -> ShowS)
-> (GetFirewallRuleGroupPolicy -> String)
-> ([GetFirewallRuleGroupPolicy] -> ShowS)
-> Show GetFirewallRuleGroupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFirewallRuleGroupPolicy] -> ShowS
$cshowList :: [GetFirewallRuleGroupPolicy] -> ShowS
show :: GetFirewallRuleGroupPolicy -> String
$cshow :: GetFirewallRuleGroupPolicy -> String
showsPrec :: Int -> GetFirewallRuleGroupPolicy -> ShowS
$cshowsPrec :: Int -> GetFirewallRuleGroupPolicy -> ShowS
Prelude.Show, (forall x.
 GetFirewallRuleGroupPolicy -> Rep GetFirewallRuleGroupPolicy x)
-> (forall x.
    Rep GetFirewallRuleGroupPolicy x -> GetFirewallRuleGroupPolicy)
-> Generic GetFirewallRuleGroupPolicy
forall x.
Rep GetFirewallRuleGroupPolicy x -> GetFirewallRuleGroupPolicy
forall x.
GetFirewallRuleGroupPolicy -> Rep GetFirewallRuleGroupPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFirewallRuleGroupPolicy x -> GetFirewallRuleGroupPolicy
$cfrom :: forall x.
GetFirewallRuleGroupPolicy -> Rep GetFirewallRuleGroupPolicy x
Prelude.Generic)

-- |
-- Create a value of 'GetFirewallRuleGroupPolicy' 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', 'getFirewallRuleGroupPolicy_arn' - The ARN (Amazon Resource Name) for the rule group.
newGetFirewallRuleGroupPolicy ::
  -- | 'arn'
  Prelude.Text ->
  GetFirewallRuleGroupPolicy
newGetFirewallRuleGroupPolicy :: Text -> GetFirewallRuleGroupPolicy
newGetFirewallRuleGroupPolicy Text
pArn_ =
  GetFirewallRuleGroupPolicy' :: Text -> GetFirewallRuleGroupPolicy
GetFirewallRuleGroupPolicy' {$sel:arn:GetFirewallRuleGroupPolicy' :: Text
arn = Text
pArn_}

-- | The ARN (Amazon Resource Name) for the rule group.
getFirewallRuleGroupPolicy_arn :: Lens.Lens' GetFirewallRuleGroupPolicy Prelude.Text
getFirewallRuleGroupPolicy_arn :: (Text -> f Text)
-> GetFirewallRuleGroupPolicy -> f GetFirewallRuleGroupPolicy
getFirewallRuleGroupPolicy_arn = (GetFirewallRuleGroupPolicy -> Text)
-> (GetFirewallRuleGroupPolicy
    -> Text -> GetFirewallRuleGroupPolicy)
-> Lens
     GetFirewallRuleGroupPolicy GetFirewallRuleGroupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallRuleGroupPolicy' {Text
arn :: Text
$sel:arn:GetFirewallRuleGroupPolicy' :: GetFirewallRuleGroupPolicy -> Text
arn} -> Text
arn) (\s :: GetFirewallRuleGroupPolicy
s@GetFirewallRuleGroupPolicy' {} Text
a -> GetFirewallRuleGroupPolicy
s {$sel:arn:GetFirewallRuleGroupPolicy' :: Text
arn = Text
a} :: GetFirewallRuleGroupPolicy)

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

instance Prelude.NFData GetFirewallRuleGroupPolicy

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

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

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

-- | /See:/ 'newGetFirewallRuleGroupPolicyResponse' smart constructor.
data GetFirewallRuleGroupPolicyResponse = GetFirewallRuleGroupPolicyResponse'
  { -- | The Identity and Access Management (Amazon Web Services IAM) policy for
    -- sharing the specified rule group. You can use the policy to share the
    -- rule group using Resource Access Manager (RAM).
    GetFirewallRuleGroupPolicyResponse -> Maybe Text
firewallRuleGroupPolicy :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetFirewallRuleGroupPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFirewallRuleGroupPolicyResponse
-> GetFirewallRuleGroupPolicyResponse -> Bool
(GetFirewallRuleGroupPolicyResponse
 -> GetFirewallRuleGroupPolicyResponse -> Bool)
-> (GetFirewallRuleGroupPolicyResponse
    -> GetFirewallRuleGroupPolicyResponse -> Bool)
-> Eq GetFirewallRuleGroupPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFirewallRuleGroupPolicyResponse
-> GetFirewallRuleGroupPolicyResponse -> Bool
$c/= :: GetFirewallRuleGroupPolicyResponse
-> GetFirewallRuleGroupPolicyResponse -> Bool
== :: GetFirewallRuleGroupPolicyResponse
-> GetFirewallRuleGroupPolicyResponse -> Bool
$c== :: GetFirewallRuleGroupPolicyResponse
-> GetFirewallRuleGroupPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetFirewallRuleGroupPolicyResponse]
ReadPrec GetFirewallRuleGroupPolicyResponse
Int -> ReadS GetFirewallRuleGroupPolicyResponse
ReadS [GetFirewallRuleGroupPolicyResponse]
(Int -> ReadS GetFirewallRuleGroupPolicyResponse)
-> ReadS [GetFirewallRuleGroupPolicyResponse]
-> ReadPrec GetFirewallRuleGroupPolicyResponse
-> ReadPrec [GetFirewallRuleGroupPolicyResponse]
-> Read GetFirewallRuleGroupPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFirewallRuleGroupPolicyResponse]
$creadListPrec :: ReadPrec [GetFirewallRuleGroupPolicyResponse]
readPrec :: ReadPrec GetFirewallRuleGroupPolicyResponse
$creadPrec :: ReadPrec GetFirewallRuleGroupPolicyResponse
readList :: ReadS [GetFirewallRuleGroupPolicyResponse]
$creadList :: ReadS [GetFirewallRuleGroupPolicyResponse]
readsPrec :: Int -> ReadS GetFirewallRuleGroupPolicyResponse
$creadsPrec :: Int -> ReadS GetFirewallRuleGroupPolicyResponse
Prelude.Read, Int -> GetFirewallRuleGroupPolicyResponse -> ShowS
[GetFirewallRuleGroupPolicyResponse] -> ShowS
GetFirewallRuleGroupPolicyResponse -> String
(Int -> GetFirewallRuleGroupPolicyResponse -> ShowS)
-> (GetFirewallRuleGroupPolicyResponse -> String)
-> ([GetFirewallRuleGroupPolicyResponse] -> ShowS)
-> Show GetFirewallRuleGroupPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFirewallRuleGroupPolicyResponse] -> ShowS
$cshowList :: [GetFirewallRuleGroupPolicyResponse] -> ShowS
show :: GetFirewallRuleGroupPolicyResponse -> String
$cshow :: GetFirewallRuleGroupPolicyResponse -> String
showsPrec :: Int -> GetFirewallRuleGroupPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetFirewallRuleGroupPolicyResponse -> ShowS
Prelude.Show, (forall x.
 GetFirewallRuleGroupPolicyResponse
 -> Rep GetFirewallRuleGroupPolicyResponse x)
-> (forall x.
    Rep GetFirewallRuleGroupPolicyResponse x
    -> GetFirewallRuleGroupPolicyResponse)
-> Generic GetFirewallRuleGroupPolicyResponse
forall x.
Rep GetFirewallRuleGroupPolicyResponse x
-> GetFirewallRuleGroupPolicyResponse
forall x.
GetFirewallRuleGroupPolicyResponse
-> Rep GetFirewallRuleGroupPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFirewallRuleGroupPolicyResponse x
-> GetFirewallRuleGroupPolicyResponse
$cfrom :: forall x.
GetFirewallRuleGroupPolicyResponse
-> Rep GetFirewallRuleGroupPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFirewallRuleGroupPolicyResponse' 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:
--
-- 'firewallRuleGroupPolicy', 'getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy' - The Identity and Access Management (Amazon Web Services IAM) policy for
-- sharing the specified rule group. You can use the policy to share the
-- rule group using Resource Access Manager (RAM).
--
-- 'httpStatus', 'getFirewallRuleGroupPolicyResponse_httpStatus' - The response's http status code.
newGetFirewallRuleGroupPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFirewallRuleGroupPolicyResponse
newGetFirewallRuleGroupPolicyResponse :: Int -> GetFirewallRuleGroupPolicyResponse
newGetFirewallRuleGroupPolicyResponse Int
pHttpStatus_ =
  GetFirewallRuleGroupPolicyResponse' :: Maybe Text -> Int -> GetFirewallRuleGroupPolicyResponse
GetFirewallRuleGroupPolicyResponse'
    { $sel:firewallRuleGroupPolicy:GetFirewallRuleGroupPolicyResponse' :: Maybe Text
firewallRuleGroupPolicy =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetFirewallRuleGroupPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Identity and Access Management (Amazon Web Services IAM) policy for
-- sharing the specified rule group. You can use the policy to share the
-- rule group using Resource Access Manager (RAM).
getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy :: Lens.Lens' GetFirewallRuleGroupPolicyResponse (Prelude.Maybe Prelude.Text)
getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy :: (Maybe Text -> f (Maybe Text))
-> GetFirewallRuleGroupPolicyResponse
-> f GetFirewallRuleGroupPolicyResponse
getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy = (GetFirewallRuleGroupPolicyResponse -> Maybe Text)
-> (GetFirewallRuleGroupPolicyResponse
    -> Maybe Text -> GetFirewallRuleGroupPolicyResponse)
-> Lens
     GetFirewallRuleGroupPolicyResponse
     GetFirewallRuleGroupPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallRuleGroupPolicyResponse' {Maybe Text
firewallRuleGroupPolicy :: Maybe Text
$sel:firewallRuleGroupPolicy:GetFirewallRuleGroupPolicyResponse' :: GetFirewallRuleGroupPolicyResponse -> Maybe Text
firewallRuleGroupPolicy} -> Maybe Text
firewallRuleGroupPolicy) (\s :: GetFirewallRuleGroupPolicyResponse
s@GetFirewallRuleGroupPolicyResponse' {} Maybe Text
a -> GetFirewallRuleGroupPolicyResponse
s {$sel:firewallRuleGroupPolicy:GetFirewallRuleGroupPolicyResponse' :: Maybe Text
firewallRuleGroupPolicy = Maybe Text
a} :: GetFirewallRuleGroupPolicyResponse)

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

instance
  Prelude.NFData
    GetFirewallRuleGroupPolicyResponse