{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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' {$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 :: Lens' GetFirewallRuleGroupPolicy Text
getFirewallRuleGroupPolicy_arn = 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 :: (Service -> Service)
-> GetFirewallRuleGroupPolicy -> Request GetFirewallRuleGroupPolicy
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetFirewallRuleGroupPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallRuleGroupPolicy)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> GetFirewallRuleGroupPolicyResponse
GetFirewallRuleGroupPolicyResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallRuleGroupPolicy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetFirewallRuleGroupPolicy where
  hashWithSalt :: Int -> GetFirewallRuleGroupPolicy -> Int
hashWithSalt Int
_salt GetFirewallRuleGroupPolicy' {Text
arn :: Text
$sel:arn:GetFirewallRuleGroupPolicy' :: GetFirewallRuleGroupPolicy -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData GetFirewallRuleGroupPolicy where
  rnf :: GetFirewallRuleGroupPolicy -> ()
rnf GetFirewallRuleGroupPolicy' {Text
arn :: Text
$sel:arn:GetFirewallRuleGroupPolicy' :: GetFirewallRuleGroupPolicy -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
arn

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

instance Data.ToJSON GetFirewallRuleGroupPolicy where
  toJSON :: GetFirewallRuleGroupPolicy -> Value
toJSON GetFirewallRuleGroupPolicy' {Text
arn :: Text
$sel:arn:GetFirewallRuleGroupPolicy' :: GetFirewallRuleGroupPolicy -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

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

instance Data.ToQuery GetFirewallRuleGroupPolicy where
  toQuery :: GetFirewallRuleGroupPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:firewallRuleGroupPolicy:GetFirewallRuleGroupPolicyResponse' :: Maybe Text
firewallRuleGroupPolicy =
        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 :: Lens' GetFirewallRuleGroupPolicyResponse (Maybe Text)
getFirewallRuleGroupPolicyResponse_firewallRuleGroupPolicy = 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 :: Lens' GetFirewallRuleGroupPolicyResponse Int
getFirewallRuleGroupPolicyResponse_httpStatus = 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
  where
  rnf :: GetFirewallRuleGroupPolicyResponse -> ()
rnf GetFirewallRuleGroupPolicyResponse' {Int
Maybe Text
httpStatus :: Int
firewallRuleGroupPolicy :: Maybe Text
$sel:httpStatus:GetFirewallRuleGroupPolicyResponse' :: GetFirewallRuleGroupPolicyResponse -> Int
$sel:firewallRuleGroupPolicy:GetFirewallRuleGroupPolicyResponse' :: GetFirewallRuleGroupPolicyResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallRuleGroupPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus