{-# 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.NetworkFirewall.DescribeRuleGroup
-- 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 data objects for the specified rule group.
module Amazonka.NetworkFirewall.DescribeRuleGroup
  ( -- * Creating a Request
    DescribeRuleGroup (..),
    newDescribeRuleGroup,

    -- * Request Lenses
    describeRuleGroup_ruleGroupArn,
    describeRuleGroup_type,
    describeRuleGroup_ruleGroupName,

    -- * Destructuring the Response
    DescribeRuleGroupResponse (..),
    newDescribeRuleGroupResponse,

    -- * Response Lenses
    describeRuleGroupResponse_ruleGroup,
    describeRuleGroupResponse_httpStatus,
    describeRuleGroupResponse_updateToken,
    describeRuleGroupResponse_ruleGroupResponse,
  )
where

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

-- | /See:/ 'newDescribeRuleGroup' smart constructor.
data DescribeRuleGroup = DescribeRuleGroup'
  { -- | The Amazon Resource Name (ARN) of the rule group.
    --
    -- You must specify the ARN or the name, and you can specify both.
    DescribeRuleGroup -> Maybe Text
ruleGroupArn :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the rule group is stateless or stateful. If the rule
    -- group is stateless, it contains stateless rules. If it is stateful, it
    -- contains stateful rules.
    --
    -- This setting is required for requests that do not include the
    -- @RuleGroupARN@.
    DescribeRuleGroup -> Maybe RuleGroupType
type' :: Prelude.Maybe RuleGroupType,
    -- | The descriptive name of the rule group. You can\'t change the name of a
    -- rule group after you create it.
    --
    -- You must specify the ARN or the name, and you can specify both.
    DescribeRuleGroup -> Maybe Text
ruleGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeRuleGroup -> DescribeRuleGroup -> Bool
(DescribeRuleGroup -> DescribeRuleGroup -> Bool)
-> (DescribeRuleGroup -> DescribeRuleGroup -> Bool)
-> Eq DescribeRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRuleGroup -> DescribeRuleGroup -> Bool
$c/= :: DescribeRuleGroup -> DescribeRuleGroup -> Bool
== :: DescribeRuleGroup -> DescribeRuleGroup -> Bool
$c== :: DescribeRuleGroup -> DescribeRuleGroup -> Bool
Prelude.Eq, ReadPrec [DescribeRuleGroup]
ReadPrec DescribeRuleGroup
Int -> ReadS DescribeRuleGroup
ReadS [DescribeRuleGroup]
(Int -> ReadS DescribeRuleGroup)
-> ReadS [DescribeRuleGroup]
-> ReadPrec DescribeRuleGroup
-> ReadPrec [DescribeRuleGroup]
-> Read DescribeRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRuleGroup]
$creadListPrec :: ReadPrec [DescribeRuleGroup]
readPrec :: ReadPrec DescribeRuleGroup
$creadPrec :: ReadPrec DescribeRuleGroup
readList :: ReadS [DescribeRuleGroup]
$creadList :: ReadS [DescribeRuleGroup]
readsPrec :: Int -> ReadS DescribeRuleGroup
$creadsPrec :: Int -> ReadS DescribeRuleGroup
Prelude.Read, Int -> DescribeRuleGroup -> ShowS
[DescribeRuleGroup] -> ShowS
DescribeRuleGroup -> String
(Int -> DescribeRuleGroup -> ShowS)
-> (DescribeRuleGroup -> String)
-> ([DescribeRuleGroup] -> ShowS)
-> Show DescribeRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRuleGroup] -> ShowS
$cshowList :: [DescribeRuleGroup] -> ShowS
show :: DescribeRuleGroup -> String
$cshow :: DescribeRuleGroup -> String
showsPrec :: Int -> DescribeRuleGroup -> ShowS
$cshowsPrec :: Int -> DescribeRuleGroup -> ShowS
Prelude.Show, (forall x. DescribeRuleGroup -> Rep DescribeRuleGroup x)
-> (forall x. Rep DescribeRuleGroup x -> DescribeRuleGroup)
-> Generic DescribeRuleGroup
forall x. Rep DescribeRuleGroup x -> DescribeRuleGroup
forall x. DescribeRuleGroup -> Rep DescribeRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRuleGroup x -> DescribeRuleGroup
$cfrom :: forall x. DescribeRuleGroup -> Rep DescribeRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRuleGroup' 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:
--
-- 'ruleGroupArn', 'describeRuleGroup_ruleGroupArn' - The Amazon Resource Name (ARN) of the rule group.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'type'', 'describeRuleGroup_type' - Indicates whether the rule group is stateless or stateful. If the rule
-- group is stateless, it contains stateless rules. If it is stateful, it
-- contains stateful rules.
--
-- This setting is required for requests that do not include the
-- @RuleGroupARN@.
--
-- 'ruleGroupName', 'describeRuleGroup_ruleGroupName' - The descriptive name of the rule group. You can\'t change the name of a
-- rule group after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
newDescribeRuleGroup ::
  DescribeRuleGroup
newDescribeRuleGroup :: DescribeRuleGroup
newDescribeRuleGroup =
  DescribeRuleGroup' :: Maybe Text
-> Maybe RuleGroupType -> Maybe Text -> DescribeRuleGroup
DescribeRuleGroup'
    { $sel:ruleGroupArn:DescribeRuleGroup' :: Maybe Text
ruleGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':DescribeRuleGroup' :: Maybe RuleGroupType
type' = Maybe RuleGroupType
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleGroupName:DescribeRuleGroup' :: Maybe Text
ruleGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the rule group.
--
-- You must specify the ARN or the name, and you can specify both.
describeRuleGroup_ruleGroupArn :: Lens.Lens' DescribeRuleGroup (Prelude.Maybe Prelude.Text)
describeRuleGroup_ruleGroupArn :: (Maybe Text -> f (Maybe Text))
-> DescribeRuleGroup -> f DescribeRuleGroup
describeRuleGroup_ruleGroupArn = (DescribeRuleGroup -> Maybe Text)
-> (DescribeRuleGroup -> Maybe Text -> DescribeRuleGroup)
-> Lens
     DescribeRuleGroup DescribeRuleGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroup' {Maybe Text
ruleGroupArn :: Maybe Text
$sel:ruleGroupArn:DescribeRuleGroup' :: DescribeRuleGroup -> Maybe Text
ruleGroupArn} -> Maybe Text
ruleGroupArn) (\s :: DescribeRuleGroup
s@DescribeRuleGroup' {} Maybe Text
a -> DescribeRuleGroup
s {$sel:ruleGroupArn:DescribeRuleGroup' :: Maybe Text
ruleGroupArn = Maybe Text
a} :: DescribeRuleGroup)

-- | Indicates whether the rule group is stateless or stateful. If the rule
-- group is stateless, it contains stateless rules. If it is stateful, it
-- contains stateful rules.
--
-- This setting is required for requests that do not include the
-- @RuleGroupARN@.
describeRuleGroup_type :: Lens.Lens' DescribeRuleGroup (Prelude.Maybe RuleGroupType)
describeRuleGroup_type :: (Maybe RuleGroupType -> f (Maybe RuleGroupType))
-> DescribeRuleGroup -> f DescribeRuleGroup
describeRuleGroup_type = (DescribeRuleGroup -> Maybe RuleGroupType)
-> (DescribeRuleGroup -> Maybe RuleGroupType -> DescribeRuleGroup)
-> Lens
     DescribeRuleGroup
     DescribeRuleGroup
     (Maybe RuleGroupType)
     (Maybe RuleGroupType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroup' {Maybe RuleGroupType
type' :: Maybe RuleGroupType
$sel:type':DescribeRuleGroup' :: DescribeRuleGroup -> Maybe RuleGroupType
type'} -> Maybe RuleGroupType
type') (\s :: DescribeRuleGroup
s@DescribeRuleGroup' {} Maybe RuleGroupType
a -> DescribeRuleGroup
s {$sel:type':DescribeRuleGroup' :: Maybe RuleGroupType
type' = Maybe RuleGroupType
a} :: DescribeRuleGroup)

-- | The descriptive name of the rule group. You can\'t change the name of a
-- rule group after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
describeRuleGroup_ruleGroupName :: Lens.Lens' DescribeRuleGroup (Prelude.Maybe Prelude.Text)
describeRuleGroup_ruleGroupName :: (Maybe Text -> f (Maybe Text))
-> DescribeRuleGroup -> f DescribeRuleGroup
describeRuleGroup_ruleGroupName = (DescribeRuleGroup -> Maybe Text)
-> (DescribeRuleGroup -> Maybe Text -> DescribeRuleGroup)
-> Lens
     DescribeRuleGroup DescribeRuleGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroup' {Maybe Text
ruleGroupName :: Maybe Text
$sel:ruleGroupName:DescribeRuleGroup' :: DescribeRuleGroup -> Maybe Text
ruleGroupName} -> Maybe Text
ruleGroupName) (\s :: DescribeRuleGroup
s@DescribeRuleGroup' {} Maybe Text
a -> DescribeRuleGroup
s {$sel:ruleGroupName:DescribeRuleGroup' :: Maybe Text
ruleGroupName = Maybe Text
a} :: DescribeRuleGroup)

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

instance Prelude.Hashable DescribeRuleGroup

instance Prelude.NFData DescribeRuleGroup

instance Core.ToHeaders DescribeRuleGroup where
  toHeaders :: DescribeRuleGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeRuleGroup -> 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
"NetworkFirewall_20201112.DescribeRuleGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeRuleGroup where
  toJSON :: DescribeRuleGroup -> Value
toJSON DescribeRuleGroup' {Maybe Text
Maybe RuleGroupType
ruleGroupName :: Maybe Text
type' :: Maybe RuleGroupType
ruleGroupArn :: Maybe Text
$sel:ruleGroupName:DescribeRuleGroup' :: DescribeRuleGroup -> Maybe Text
$sel:type':DescribeRuleGroup' :: DescribeRuleGroup -> Maybe RuleGroupType
$sel:ruleGroupArn:DescribeRuleGroup' :: DescribeRuleGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RuleGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ruleGroupArn,
            (Text
"Type" Text -> RuleGroupType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RuleGroupType -> Pair) -> Maybe RuleGroupType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RuleGroupType
type',
            (Text
"RuleGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ruleGroupName
          ]
      )

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

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

-- | /See:/ 'newDescribeRuleGroupResponse' smart constructor.
data DescribeRuleGroupResponse = DescribeRuleGroupResponse'
  { -- | The object that defines the rules in a rule group. This, along with
    -- RuleGroupResponse, define the rule group. You can retrieve all objects
    -- for a rule group by calling DescribeRuleGroup.
    --
    -- AWS Network Firewall uses a rule group to inspect and control network
    -- traffic. You define stateless rule groups to inspect individual packets
    -- and you define stateful rule groups to inspect packets in the context of
    -- their traffic flow.
    --
    -- To use a rule group, you include it by reference in an Network Firewall
    -- firewall policy, then you use the policy in a firewall. You can
    -- reference a rule group from more than one firewall policy, and you can
    -- use a firewall policy in more than one firewall.
    DescribeRuleGroupResponse -> Maybe RuleGroup
ruleGroup :: Prelude.Maybe RuleGroup,
    -- | The response's http status code.
    DescribeRuleGroupResponse -> Int
httpStatus :: Prelude.Int,
    -- | A token used for optimistic locking. Network Firewall returns a token to
    -- your requests that access the rule group. The token marks the state of
    -- the rule group resource at the time of the request.
    --
    -- To make changes to the rule group, you provide the token in your
    -- request. Network Firewall uses the token to ensure that the rule group
    -- hasn\'t changed since you last retrieved it. If it has changed, the
    -- operation fails with an @InvalidTokenException@. If this happens,
    -- retrieve the rule group again to get a current copy of it with a current
    -- token. Reapply your changes as needed, then try the operation again
    -- using the new token.
    DescribeRuleGroupResponse -> Text
updateToken :: Prelude.Text,
    -- | The high-level properties of a rule group. This, along with the
    -- RuleGroup, define the rule group. You can retrieve all objects for a
    -- rule group by calling DescribeRuleGroup.
    DescribeRuleGroupResponse -> RuleGroupResponse
ruleGroupResponse :: RuleGroupResponse
  }
  deriving (DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool
(DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool)
-> (DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool)
-> Eq DescribeRuleGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool
$c/= :: DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool
== :: DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool
$c== :: DescribeRuleGroupResponse -> DescribeRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRuleGroupResponse]
ReadPrec DescribeRuleGroupResponse
Int -> ReadS DescribeRuleGroupResponse
ReadS [DescribeRuleGroupResponse]
(Int -> ReadS DescribeRuleGroupResponse)
-> ReadS [DescribeRuleGroupResponse]
-> ReadPrec DescribeRuleGroupResponse
-> ReadPrec [DescribeRuleGroupResponse]
-> Read DescribeRuleGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRuleGroupResponse]
$creadListPrec :: ReadPrec [DescribeRuleGroupResponse]
readPrec :: ReadPrec DescribeRuleGroupResponse
$creadPrec :: ReadPrec DescribeRuleGroupResponse
readList :: ReadS [DescribeRuleGroupResponse]
$creadList :: ReadS [DescribeRuleGroupResponse]
readsPrec :: Int -> ReadS DescribeRuleGroupResponse
$creadsPrec :: Int -> ReadS DescribeRuleGroupResponse
Prelude.Read, Int -> DescribeRuleGroupResponse -> ShowS
[DescribeRuleGroupResponse] -> ShowS
DescribeRuleGroupResponse -> String
(Int -> DescribeRuleGroupResponse -> ShowS)
-> (DescribeRuleGroupResponse -> String)
-> ([DescribeRuleGroupResponse] -> ShowS)
-> Show DescribeRuleGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRuleGroupResponse] -> ShowS
$cshowList :: [DescribeRuleGroupResponse] -> ShowS
show :: DescribeRuleGroupResponse -> String
$cshow :: DescribeRuleGroupResponse -> String
showsPrec :: Int -> DescribeRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeRuleGroupResponse -> ShowS
Prelude.Show, (forall x.
 DescribeRuleGroupResponse -> Rep DescribeRuleGroupResponse x)
-> (forall x.
    Rep DescribeRuleGroupResponse x -> DescribeRuleGroupResponse)
-> Generic DescribeRuleGroupResponse
forall x.
Rep DescribeRuleGroupResponse x -> DescribeRuleGroupResponse
forall x.
DescribeRuleGroupResponse -> Rep DescribeRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRuleGroupResponse x -> DescribeRuleGroupResponse
$cfrom :: forall x.
DescribeRuleGroupResponse -> Rep DescribeRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRuleGroupResponse' 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:
--
-- 'ruleGroup', 'describeRuleGroupResponse_ruleGroup' - The object that defines the rules in a rule group. This, along with
-- RuleGroupResponse, define the rule group. You can retrieve all objects
-- for a rule group by calling DescribeRuleGroup.
--
-- AWS Network Firewall uses a rule group to inspect and control network
-- traffic. You define stateless rule groups to inspect individual packets
-- and you define stateful rule groups to inspect packets in the context of
-- their traffic flow.
--
-- To use a rule group, you include it by reference in an Network Firewall
-- firewall policy, then you use the policy in a firewall. You can
-- reference a rule group from more than one firewall policy, and you can
-- use a firewall policy in more than one firewall.
--
-- 'httpStatus', 'describeRuleGroupResponse_httpStatus' - The response's http status code.
--
-- 'updateToken', 'describeRuleGroupResponse_updateToken' - A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the rule group. The token marks the state of
-- the rule group resource at the time of the request.
--
-- To make changes to the rule group, you provide the token in your
-- request. Network Firewall uses the token to ensure that the rule group
-- hasn\'t changed since you last retrieved it. If it has changed, the
-- operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the rule group again to get a current copy of it with a current
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
--
-- 'ruleGroupResponse', 'describeRuleGroupResponse_ruleGroupResponse' - The high-level properties of a rule group. This, along with the
-- RuleGroup, define the rule group. You can retrieve all objects for a
-- rule group by calling DescribeRuleGroup.
newDescribeRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'updateToken'
  Prelude.Text ->
  -- | 'ruleGroupResponse'
  RuleGroupResponse ->
  DescribeRuleGroupResponse
newDescribeRuleGroupResponse :: Int -> Text -> RuleGroupResponse -> DescribeRuleGroupResponse
newDescribeRuleGroupResponse
  Int
pHttpStatus_
  Text
pUpdateToken_
  RuleGroupResponse
pRuleGroupResponse_ =
    DescribeRuleGroupResponse' :: Maybe RuleGroup
-> Int -> Text -> RuleGroupResponse -> DescribeRuleGroupResponse
DescribeRuleGroupResponse'
      { $sel:ruleGroup:DescribeRuleGroupResponse' :: Maybe RuleGroup
ruleGroup =
          Maybe RuleGroup
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:updateToken:DescribeRuleGroupResponse' :: Text
updateToken = Text
pUpdateToken_,
        $sel:ruleGroupResponse:DescribeRuleGroupResponse' :: RuleGroupResponse
ruleGroupResponse = RuleGroupResponse
pRuleGroupResponse_
      }

-- | The object that defines the rules in a rule group. This, along with
-- RuleGroupResponse, define the rule group. You can retrieve all objects
-- for a rule group by calling DescribeRuleGroup.
--
-- AWS Network Firewall uses a rule group to inspect and control network
-- traffic. You define stateless rule groups to inspect individual packets
-- and you define stateful rule groups to inspect packets in the context of
-- their traffic flow.
--
-- To use a rule group, you include it by reference in an Network Firewall
-- firewall policy, then you use the policy in a firewall. You can
-- reference a rule group from more than one firewall policy, and you can
-- use a firewall policy in more than one firewall.
describeRuleGroupResponse_ruleGroup :: Lens.Lens' DescribeRuleGroupResponse (Prelude.Maybe RuleGroup)
describeRuleGroupResponse_ruleGroup :: (Maybe RuleGroup -> f (Maybe RuleGroup))
-> DescribeRuleGroupResponse -> f DescribeRuleGroupResponse
describeRuleGroupResponse_ruleGroup = (DescribeRuleGroupResponse -> Maybe RuleGroup)
-> (DescribeRuleGroupResponse
    -> Maybe RuleGroup -> DescribeRuleGroupResponse)
-> Lens
     DescribeRuleGroupResponse
     DescribeRuleGroupResponse
     (Maybe RuleGroup)
     (Maybe RuleGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroupResponse' {Maybe RuleGroup
ruleGroup :: Maybe RuleGroup
$sel:ruleGroup:DescribeRuleGroupResponse' :: DescribeRuleGroupResponse -> Maybe RuleGroup
ruleGroup} -> Maybe RuleGroup
ruleGroup) (\s :: DescribeRuleGroupResponse
s@DescribeRuleGroupResponse' {} Maybe RuleGroup
a -> DescribeRuleGroupResponse
s {$sel:ruleGroup:DescribeRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = Maybe RuleGroup
a} :: DescribeRuleGroupResponse)

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

-- | A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the rule group. The token marks the state of
-- the rule group resource at the time of the request.
--
-- To make changes to the rule group, you provide the token in your
-- request. Network Firewall uses the token to ensure that the rule group
-- hasn\'t changed since you last retrieved it. If it has changed, the
-- operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the rule group again to get a current copy of it with a current
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
describeRuleGroupResponse_updateToken :: Lens.Lens' DescribeRuleGroupResponse Prelude.Text
describeRuleGroupResponse_updateToken :: (Text -> f Text)
-> DescribeRuleGroupResponse -> f DescribeRuleGroupResponse
describeRuleGroupResponse_updateToken = (DescribeRuleGroupResponse -> Text)
-> (DescribeRuleGroupResponse -> Text -> DescribeRuleGroupResponse)
-> Lens
     DescribeRuleGroupResponse DescribeRuleGroupResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroupResponse' {Text
updateToken :: Text
$sel:updateToken:DescribeRuleGroupResponse' :: DescribeRuleGroupResponse -> Text
updateToken} -> Text
updateToken) (\s :: DescribeRuleGroupResponse
s@DescribeRuleGroupResponse' {} Text
a -> DescribeRuleGroupResponse
s {$sel:updateToken:DescribeRuleGroupResponse' :: Text
updateToken = Text
a} :: DescribeRuleGroupResponse)

-- | The high-level properties of a rule group. This, along with the
-- RuleGroup, define the rule group. You can retrieve all objects for a
-- rule group by calling DescribeRuleGroup.
describeRuleGroupResponse_ruleGroupResponse :: Lens.Lens' DescribeRuleGroupResponse RuleGroupResponse
describeRuleGroupResponse_ruleGroupResponse :: (RuleGroupResponse -> f RuleGroupResponse)
-> DescribeRuleGroupResponse -> f DescribeRuleGroupResponse
describeRuleGroupResponse_ruleGroupResponse = (DescribeRuleGroupResponse -> RuleGroupResponse)
-> (DescribeRuleGroupResponse
    -> RuleGroupResponse -> DescribeRuleGroupResponse)
-> Lens
     DescribeRuleGroupResponse
     DescribeRuleGroupResponse
     RuleGroupResponse
     RuleGroupResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroupResponse' {RuleGroupResponse
ruleGroupResponse :: RuleGroupResponse
$sel:ruleGroupResponse:DescribeRuleGroupResponse' :: DescribeRuleGroupResponse -> RuleGroupResponse
ruleGroupResponse} -> RuleGroupResponse
ruleGroupResponse) (\s :: DescribeRuleGroupResponse
s@DescribeRuleGroupResponse' {} RuleGroupResponse
a -> DescribeRuleGroupResponse
s {$sel:ruleGroupResponse:DescribeRuleGroupResponse' :: RuleGroupResponse
ruleGroupResponse = RuleGroupResponse
a} :: DescribeRuleGroupResponse)

instance Prelude.NFData DescribeRuleGroupResponse