{-# 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.WAFRegional.CreateRuleGroup
-- 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)
--
-- This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Creates a @RuleGroup@. A rule group is a collection of predefined rules
-- that you add to a web ACL. You use UpdateRuleGroup to add rules to the
-- rule group.
--
-- Rule groups are subject to the following limits:
--
-- -   Three rule groups per account. You can request an increase to this
--     limit by contacting customer support.
--
-- -   One rule group per web ACL.
--
-- -   Ten rules per rule group.
--
-- For more information about how to use the AWS WAF API to allow or block
-- HTTP requests, see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/ AWS WAF Developer Guide>.
module Amazonka.WAFRegional.CreateRuleGroup
  ( -- * Creating a Request
    CreateRuleGroup (..),
    newCreateRuleGroup,

    -- * Request Lenses
    createRuleGroup_tags,
    createRuleGroup_name,
    createRuleGroup_metricName,
    createRuleGroup_changeToken,

    -- * Destructuring the Response
    CreateRuleGroupResponse (..),
    newCreateRuleGroupResponse,

    -- * Response Lenses
    createRuleGroupResponse_changeToken,
    createRuleGroupResponse_ruleGroup,
    createRuleGroupResponse_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.WAFRegional.Types

-- | /See:/ 'newCreateRuleGroup' smart constructor.
data CreateRuleGroup = CreateRuleGroup'
  { CreateRuleGroup -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | A friendly name or description of the RuleGroup. You can\'t change
    -- @Name@ after you create a @RuleGroup@.
    CreateRuleGroup -> Text
name :: Prelude.Text,
    -- | A friendly name or description for the metrics for this @RuleGroup@. The
    -- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
    -- maximum length 128 and minimum length one. It can\'t contain whitespace
    -- or metric names reserved for AWS WAF, including \"All\" and
    -- \"Default_Action.\" You can\'t change the name of the metric after you
    -- create the @RuleGroup@.
    CreateRuleGroup -> Text
metricName :: Prelude.Text,
    -- | The value returned by the most recent call to GetChangeToken.
    CreateRuleGroup -> Text
changeToken :: Prelude.Text
  }
  deriving (CreateRuleGroup -> CreateRuleGroup -> Bool
(CreateRuleGroup -> CreateRuleGroup -> Bool)
-> (CreateRuleGroup -> CreateRuleGroup -> Bool)
-> Eq CreateRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRuleGroup -> CreateRuleGroup -> Bool
$c/= :: CreateRuleGroup -> CreateRuleGroup -> Bool
== :: CreateRuleGroup -> CreateRuleGroup -> Bool
$c== :: CreateRuleGroup -> CreateRuleGroup -> Bool
Prelude.Eq, ReadPrec [CreateRuleGroup]
ReadPrec CreateRuleGroup
Int -> ReadS CreateRuleGroup
ReadS [CreateRuleGroup]
(Int -> ReadS CreateRuleGroup)
-> ReadS [CreateRuleGroup]
-> ReadPrec CreateRuleGroup
-> ReadPrec [CreateRuleGroup]
-> Read CreateRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRuleGroup]
$creadListPrec :: ReadPrec [CreateRuleGroup]
readPrec :: ReadPrec CreateRuleGroup
$creadPrec :: ReadPrec CreateRuleGroup
readList :: ReadS [CreateRuleGroup]
$creadList :: ReadS [CreateRuleGroup]
readsPrec :: Int -> ReadS CreateRuleGroup
$creadsPrec :: Int -> ReadS CreateRuleGroup
Prelude.Read, Int -> CreateRuleGroup -> ShowS
[CreateRuleGroup] -> ShowS
CreateRuleGroup -> String
(Int -> CreateRuleGroup -> ShowS)
-> (CreateRuleGroup -> String)
-> ([CreateRuleGroup] -> ShowS)
-> Show CreateRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRuleGroup] -> ShowS
$cshowList :: [CreateRuleGroup] -> ShowS
show :: CreateRuleGroup -> String
$cshow :: CreateRuleGroup -> String
showsPrec :: Int -> CreateRuleGroup -> ShowS
$cshowsPrec :: Int -> CreateRuleGroup -> ShowS
Prelude.Show, (forall x. CreateRuleGroup -> Rep CreateRuleGroup x)
-> (forall x. Rep CreateRuleGroup x -> CreateRuleGroup)
-> Generic CreateRuleGroup
forall x. Rep CreateRuleGroup x -> CreateRuleGroup
forall x. CreateRuleGroup -> Rep CreateRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRuleGroup x -> CreateRuleGroup
$cfrom :: forall x. CreateRuleGroup -> Rep CreateRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'CreateRuleGroup' 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:
--
-- 'tags', 'createRuleGroup_tags' -
--
-- 'name', 'createRuleGroup_name' - A friendly name or description of the RuleGroup. You can\'t change
-- @Name@ after you create a @RuleGroup@.
--
-- 'metricName', 'createRuleGroup_metricName' - A friendly name or description for the metrics for this @RuleGroup@. The
-- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
-- maximum length 128 and minimum length one. It can\'t contain whitespace
-- or metric names reserved for AWS WAF, including \"All\" and
-- \"Default_Action.\" You can\'t change the name of the metric after you
-- create the @RuleGroup@.
--
-- 'changeToken', 'createRuleGroup_changeToken' - The value returned by the most recent call to GetChangeToken.
newCreateRuleGroup ::
  -- | 'name'
  Prelude.Text ->
  -- | 'metricName'
  Prelude.Text ->
  -- | 'changeToken'
  Prelude.Text ->
  CreateRuleGroup
newCreateRuleGroup :: Text -> Text -> Text -> CreateRuleGroup
newCreateRuleGroup Text
pName_ Text
pMetricName_ Text
pChangeToken_ =
  CreateRuleGroup' :: Maybe (NonEmpty Tag) -> Text -> Text -> Text -> CreateRuleGroup
CreateRuleGroup'
    { $sel:tags:CreateRuleGroup' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateRuleGroup' :: Text
name = Text
pName_,
      $sel:metricName:CreateRuleGroup' :: Text
metricName = Text
pMetricName_,
      $sel:changeToken:CreateRuleGroup' :: Text
changeToken = Text
pChangeToken_
    }

-- |
createRuleGroup_tags :: Lens.Lens' CreateRuleGroup (Prelude.Maybe (Prelude.NonEmpty Tag))
createRuleGroup_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateRuleGroup -> f CreateRuleGroup
createRuleGroup_tags = (CreateRuleGroup -> Maybe (NonEmpty Tag))
-> (CreateRuleGroup -> Maybe (NonEmpty Tag) -> CreateRuleGroup)
-> Lens
     CreateRuleGroup
     CreateRuleGroup
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroup' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateRuleGroup' :: CreateRuleGroup -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateRuleGroup
s@CreateRuleGroup' {} Maybe (NonEmpty Tag)
a -> CreateRuleGroup
s {$sel:tags:CreateRuleGroup' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateRuleGroup) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateRuleGroup -> f CreateRuleGroup)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateRuleGroup
-> f CreateRuleGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A friendly name or description of the RuleGroup. You can\'t change
-- @Name@ after you create a @RuleGroup@.
createRuleGroup_name :: Lens.Lens' CreateRuleGroup Prelude.Text
createRuleGroup_name :: (Text -> f Text) -> CreateRuleGroup -> f CreateRuleGroup
createRuleGroup_name = (CreateRuleGroup -> Text)
-> (CreateRuleGroup -> Text -> CreateRuleGroup)
-> Lens CreateRuleGroup CreateRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroup' {Text
name :: Text
$sel:name:CreateRuleGroup' :: CreateRuleGroup -> Text
name} -> Text
name) (\s :: CreateRuleGroup
s@CreateRuleGroup' {} Text
a -> CreateRuleGroup
s {$sel:name:CreateRuleGroup' :: Text
name = Text
a} :: CreateRuleGroup)

-- | A friendly name or description for the metrics for this @RuleGroup@. The
-- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
-- maximum length 128 and minimum length one. It can\'t contain whitespace
-- or metric names reserved for AWS WAF, including \"All\" and
-- \"Default_Action.\" You can\'t change the name of the metric after you
-- create the @RuleGroup@.
createRuleGroup_metricName :: Lens.Lens' CreateRuleGroup Prelude.Text
createRuleGroup_metricName :: (Text -> f Text) -> CreateRuleGroup -> f CreateRuleGroup
createRuleGroup_metricName = (CreateRuleGroup -> Text)
-> (CreateRuleGroup -> Text -> CreateRuleGroup)
-> Lens CreateRuleGroup CreateRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroup' {Text
metricName :: Text
$sel:metricName:CreateRuleGroup' :: CreateRuleGroup -> Text
metricName} -> Text
metricName) (\s :: CreateRuleGroup
s@CreateRuleGroup' {} Text
a -> CreateRuleGroup
s {$sel:metricName:CreateRuleGroup' :: Text
metricName = Text
a} :: CreateRuleGroup)

-- | The value returned by the most recent call to GetChangeToken.
createRuleGroup_changeToken :: Lens.Lens' CreateRuleGroup Prelude.Text
createRuleGroup_changeToken :: (Text -> f Text) -> CreateRuleGroup -> f CreateRuleGroup
createRuleGroup_changeToken = (CreateRuleGroup -> Text)
-> (CreateRuleGroup -> Text -> CreateRuleGroup)
-> Lens CreateRuleGroup CreateRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroup' {Text
changeToken :: Text
$sel:changeToken:CreateRuleGroup' :: CreateRuleGroup -> Text
changeToken} -> Text
changeToken) (\s :: CreateRuleGroup
s@CreateRuleGroup' {} Text
a -> CreateRuleGroup
s {$sel:changeToken:CreateRuleGroup' :: Text
changeToken = Text
a} :: CreateRuleGroup)

instance Core.AWSRequest CreateRuleGroup where
  type
    AWSResponse CreateRuleGroup =
      CreateRuleGroupResponse
  request :: CreateRuleGroup -> Request CreateRuleGroup
request = Service -> CreateRuleGroup -> Request CreateRuleGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRuleGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRuleGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRuleGroup))
-> Logger
-> Service
-> Proxy CreateRuleGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRuleGroup)))
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 -> Maybe RuleGroup -> Int -> CreateRuleGroupResponse
CreateRuleGroupResponse'
            (Maybe Text -> Maybe RuleGroup -> Int -> CreateRuleGroupResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe RuleGroup -> Int -> CreateRuleGroupResponse)
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
"ChangeToken")
            Either String (Maybe RuleGroup -> Int -> CreateRuleGroupResponse)
-> Either String (Maybe RuleGroup)
-> Either String (Int -> CreateRuleGroupResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> CreateRuleGroupResponse)
-> Either String Int -> Either String CreateRuleGroupResponse
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 CreateRuleGroup

instance Prelude.NFData CreateRuleGroup

instance Core.ToHeaders CreateRuleGroup where
  toHeaders :: CreateRuleGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateRuleGroup -> 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
"AWSWAF_Regional_20161128.CreateRuleGroup" ::
                          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 CreateRuleGroup where
  toJSON :: CreateRuleGroup -> Value
toJSON CreateRuleGroup' {Maybe (NonEmpty Tag)
Text
changeToken :: Text
metricName :: Text
name :: Text
tags :: Maybe (NonEmpty Tag)
$sel:changeToken:CreateRuleGroup' :: CreateRuleGroup -> Text
$sel:metricName:CreateRuleGroup' :: CreateRuleGroup -> Text
$sel:name:CreateRuleGroup' :: CreateRuleGroup -> Text
$sel:tags:CreateRuleGroup' :: CreateRuleGroup -> Maybe (NonEmpty Tag)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
changeToken)
          ]
      )

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

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

-- | /See:/ 'newCreateRuleGroupResponse' smart constructor.
data CreateRuleGroupResponse = CreateRuleGroupResponse'
  { -- | The @ChangeToken@ that you used to submit the @CreateRuleGroup@ request.
    -- You can also use this value to query the status of the request. For more
    -- information, see GetChangeTokenStatus.
    CreateRuleGroupResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
    -- | An empty RuleGroup.
    CreateRuleGroupResponse -> Maybe RuleGroup
ruleGroup :: Prelude.Maybe RuleGroup,
    -- | The response's http status code.
    CreateRuleGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool
(CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool)
-> (CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool)
-> Eq CreateRuleGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool
$c/= :: CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool
== :: CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool
$c== :: CreateRuleGroupResponse -> CreateRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateRuleGroupResponse]
ReadPrec CreateRuleGroupResponse
Int -> ReadS CreateRuleGroupResponse
ReadS [CreateRuleGroupResponse]
(Int -> ReadS CreateRuleGroupResponse)
-> ReadS [CreateRuleGroupResponse]
-> ReadPrec CreateRuleGroupResponse
-> ReadPrec [CreateRuleGroupResponse]
-> Read CreateRuleGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRuleGroupResponse]
$creadListPrec :: ReadPrec [CreateRuleGroupResponse]
readPrec :: ReadPrec CreateRuleGroupResponse
$creadPrec :: ReadPrec CreateRuleGroupResponse
readList :: ReadS [CreateRuleGroupResponse]
$creadList :: ReadS [CreateRuleGroupResponse]
readsPrec :: Int -> ReadS CreateRuleGroupResponse
$creadsPrec :: Int -> ReadS CreateRuleGroupResponse
Prelude.Read, Int -> CreateRuleGroupResponse -> ShowS
[CreateRuleGroupResponse] -> ShowS
CreateRuleGroupResponse -> String
(Int -> CreateRuleGroupResponse -> ShowS)
-> (CreateRuleGroupResponse -> String)
-> ([CreateRuleGroupResponse] -> ShowS)
-> Show CreateRuleGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRuleGroupResponse] -> ShowS
$cshowList :: [CreateRuleGroupResponse] -> ShowS
show :: CreateRuleGroupResponse -> String
$cshow :: CreateRuleGroupResponse -> String
showsPrec :: Int -> CreateRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateRuleGroupResponse -> ShowS
Prelude.Show, (forall x.
 CreateRuleGroupResponse -> Rep CreateRuleGroupResponse x)
-> (forall x.
    Rep CreateRuleGroupResponse x -> CreateRuleGroupResponse)
-> Generic CreateRuleGroupResponse
forall x. Rep CreateRuleGroupResponse x -> CreateRuleGroupResponse
forall x. CreateRuleGroupResponse -> Rep CreateRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRuleGroupResponse x -> CreateRuleGroupResponse
$cfrom :: forall x. CreateRuleGroupResponse -> Rep CreateRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRuleGroupResponse' 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:
--
-- 'changeToken', 'createRuleGroupResponse_changeToken' - The @ChangeToken@ that you used to submit the @CreateRuleGroup@ request.
-- You can also use this value to query the status of the request. For more
-- information, see GetChangeTokenStatus.
--
-- 'ruleGroup', 'createRuleGroupResponse_ruleGroup' - An empty RuleGroup.
--
-- 'httpStatus', 'createRuleGroupResponse_httpStatus' - The response's http status code.
newCreateRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRuleGroupResponse
newCreateRuleGroupResponse :: Int -> CreateRuleGroupResponse
newCreateRuleGroupResponse Int
pHttpStatus_ =
  CreateRuleGroupResponse' :: Maybe Text -> Maybe RuleGroup -> Int -> CreateRuleGroupResponse
CreateRuleGroupResponse'
    { $sel:changeToken:CreateRuleGroupResponse' :: Maybe Text
changeToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleGroup:CreateRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = Maybe RuleGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @ChangeToken@ that you used to submit the @CreateRuleGroup@ request.
-- You can also use this value to query the status of the request. For more
-- information, see GetChangeTokenStatus.
createRuleGroupResponse_changeToken :: Lens.Lens' CreateRuleGroupResponse (Prelude.Maybe Prelude.Text)
createRuleGroupResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateRuleGroupResponse -> f CreateRuleGroupResponse
createRuleGroupResponse_changeToken = (CreateRuleGroupResponse -> Maybe Text)
-> (CreateRuleGroupResponse
    -> Maybe Text -> CreateRuleGroupResponse)
-> Lens
     CreateRuleGroupResponse
     CreateRuleGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateRuleGroupResponse' :: CreateRuleGroupResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateRuleGroupResponse
s@CreateRuleGroupResponse' {} Maybe Text
a -> CreateRuleGroupResponse
s {$sel:changeToken:CreateRuleGroupResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateRuleGroupResponse)

-- | An empty RuleGroup.
createRuleGroupResponse_ruleGroup :: Lens.Lens' CreateRuleGroupResponse (Prelude.Maybe RuleGroup)
createRuleGroupResponse_ruleGroup :: (Maybe RuleGroup -> f (Maybe RuleGroup))
-> CreateRuleGroupResponse -> f CreateRuleGroupResponse
createRuleGroupResponse_ruleGroup = (CreateRuleGroupResponse -> Maybe RuleGroup)
-> (CreateRuleGroupResponse
    -> Maybe RuleGroup -> CreateRuleGroupResponse)
-> Lens
     CreateRuleGroupResponse
     CreateRuleGroupResponse
     (Maybe RuleGroup)
     (Maybe RuleGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupResponse' {Maybe RuleGroup
ruleGroup :: Maybe RuleGroup
$sel:ruleGroup:CreateRuleGroupResponse' :: CreateRuleGroupResponse -> Maybe RuleGroup
ruleGroup} -> Maybe RuleGroup
ruleGroup) (\s :: CreateRuleGroupResponse
s@CreateRuleGroupResponse' {} Maybe RuleGroup
a -> CreateRuleGroupResponse
s {$sel:ruleGroup:CreateRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = Maybe RuleGroup
a} :: CreateRuleGroupResponse)

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

instance Prelude.NFData CreateRuleGroupResponse