{-# 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.WAFV2.DescribeManagedRuleGroup -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Provides high-level information for a managed rule group, including -- descriptions of the rules. module Amazonka.WAFV2.DescribeManagedRuleGroup ( -- * Creating a Request DescribeManagedRuleGroup (..), newDescribeManagedRuleGroup, -- * Request Lenses describeManagedRuleGroup_versionName, describeManagedRuleGroup_vendorName, describeManagedRuleGroup_name, describeManagedRuleGroup_scope, -- * Destructuring the Response DescribeManagedRuleGroupResponse (..), newDescribeManagedRuleGroupResponse, -- * Response Lenses describeManagedRuleGroupResponse_availableLabels, describeManagedRuleGroupResponse_capacity, describeManagedRuleGroupResponse_consumedLabels, describeManagedRuleGroupResponse_labelNamespace, describeManagedRuleGroupResponse_rules, describeManagedRuleGroupResponse_snsTopicArn, describeManagedRuleGroupResponse_versionName, describeManagedRuleGroupResponse_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.WAFV2.Types -- | /See:/ 'newDescribeManagedRuleGroup' smart constructor. data DescribeManagedRuleGroup = DescribeManagedRuleGroup' { -- | The version of the rule group. You can only use a version that is not -- scheduled for expiration. If you don\'t provide this, WAF uses the -- vendor\'s default version. versionName :: Prelude.Maybe Prelude.Text, -- | The name of the managed rule group vendor. You use this, along with the -- rule group name, to identify the rule group. vendorName :: Prelude.Text, -- | The name of the managed rule group. You use this, along with the vendor -- name, to identify the rule group. name :: Prelude.Text, -- | Specifies whether this is for an Amazon CloudFront distribution or for a -- regional application. A regional application can be an Application Load -- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API, -- or an Amazon Cognito user pool. -- -- To work with CloudFront, you must also specify the Region US East (N. -- Virginia) as follows: -- -- - CLI - Specify the Region when you use the CloudFront scope: -- @--scope=CLOUDFRONT --region=us-east-1@. -- -- - API and SDKs - For all calls, use the Region endpoint us-east-1. scope :: Scope } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DescribeManagedRuleGroup' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'versionName', 'describeManagedRuleGroup_versionName' - The version of the rule group. You can only use a version that is not -- scheduled for expiration. If you don\'t provide this, WAF uses the -- vendor\'s default version. -- -- 'vendorName', 'describeManagedRuleGroup_vendorName' - The name of the managed rule group vendor. You use this, along with the -- rule group name, to identify the rule group. -- -- 'name', 'describeManagedRuleGroup_name' - The name of the managed rule group. You use this, along with the vendor -- name, to identify the rule group. -- -- 'scope', 'describeManagedRuleGroup_scope' - Specifies whether this is for an Amazon CloudFront distribution or for a -- regional application. A regional application can be an Application Load -- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API, -- or an Amazon Cognito user pool. -- -- To work with CloudFront, you must also specify the Region US East (N. -- Virginia) as follows: -- -- - CLI - Specify the Region when you use the CloudFront scope: -- @--scope=CLOUDFRONT --region=us-east-1@. -- -- - API and SDKs - For all calls, use the Region endpoint us-east-1. newDescribeManagedRuleGroup :: -- | 'vendorName' Prelude.Text -> -- | 'name' Prelude.Text -> -- | 'scope' Scope -> DescribeManagedRuleGroup newDescribeManagedRuleGroup pVendorName_ pName_ pScope_ = DescribeManagedRuleGroup' { versionName = Prelude.Nothing, vendorName = pVendorName_, name = pName_, scope = pScope_ } -- | The version of the rule group. You can only use a version that is not -- scheduled for expiration. If you don\'t provide this, WAF uses the -- vendor\'s default version. describeManagedRuleGroup_versionName :: Lens.Lens' DescribeManagedRuleGroup (Prelude.Maybe Prelude.Text) describeManagedRuleGroup_versionName = Lens.lens (\DescribeManagedRuleGroup' {versionName} -> versionName) (\s@DescribeManagedRuleGroup' {} a -> s {versionName = a} :: DescribeManagedRuleGroup) -- | The name of the managed rule group vendor. You use this, along with the -- rule group name, to identify the rule group. describeManagedRuleGroup_vendorName :: Lens.Lens' DescribeManagedRuleGroup Prelude.Text describeManagedRuleGroup_vendorName = Lens.lens (\DescribeManagedRuleGroup' {vendorName} -> vendorName) (\s@DescribeManagedRuleGroup' {} a -> s {vendorName = a} :: DescribeManagedRuleGroup) -- | The name of the managed rule group. You use this, along with the vendor -- name, to identify the rule group. describeManagedRuleGroup_name :: Lens.Lens' DescribeManagedRuleGroup Prelude.Text describeManagedRuleGroup_name = Lens.lens (\DescribeManagedRuleGroup' {name} -> name) (\s@DescribeManagedRuleGroup' {} a -> s {name = a} :: DescribeManagedRuleGroup) -- | Specifies whether this is for an Amazon CloudFront distribution or for a -- regional application. A regional application can be an Application Load -- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API, -- or an Amazon Cognito user pool. -- -- To work with CloudFront, you must also specify the Region US East (N. -- Virginia) as follows: -- -- - CLI - Specify the Region when you use the CloudFront scope: -- @--scope=CLOUDFRONT --region=us-east-1@. -- -- - API and SDKs - For all calls, use the Region endpoint us-east-1. describeManagedRuleGroup_scope :: Lens.Lens' DescribeManagedRuleGroup Scope describeManagedRuleGroup_scope = Lens.lens (\DescribeManagedRuleGroup' {scope} -> scope) (\s@DescribeManagedRuleGroup' {} a -> s {scope = a} :: DescribeManagedRuleGroup) instance Core.AWSRequest DescribeManagedRuleGroup where type AWSResponse DescribeManagedRuleGroup = DescribeManagedRuleGroupResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> DescribeManagedRuleGroupResponse' Prelude.<$> ( x Data..?> "AvailableLabels" Core..!@ Prelude.mempty ) Prelude.<*> (x Data..?> "Capacity") Prelude.<*> (x Data..?> "ConsumedLabels" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "LabelNamespace") Prelude.<*> (x Data..?> "Rules" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "SnsTopicArn") Prelude.<*> (x Data..?> "VersionName") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable DescribeManagedRuleGroup where hashWithSalt _salt DescribeManagedRuleGroup' {..} = _salt `Prelude.hashWithSalt` versionName `Prelude.hashWithSalt` vendorName `Prelude.hashWithSalt` name `Prelude.hashWithSalt` scope instance Prelude.NFData DescribeManagedRuleGroup where rnf DescribeManagedRuleGroup' {..} = Prelude.rnf versionName `Prelude.seq` Prelude.rnf vendorName `Prelude.seq` Prelude.rnf name `Prelude.seq` Prelude.rnf scope instance Data.ToHeaders DescribeManagedRuleGroup where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSWAF_20190729.DescribeManagedRuleGroup" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON DescribeManagedRuleGroup where toJSON DescribeManagedRuleGroup' {..} = Data.object ( Prelude.catMaybes [ ("VersionName" Data..=) Prelude.<$> versionName, Prelude.Just ("VendorName" Data..= vendorName), Prelude.Just ("Name" Data..= name), Prelude.Just ("Scope" Data..= scope) ] ) instance Data.ToPath DescribeManagedRuleGroup where toPath = Prelude.const "/" instance Data.ToQuery DescribeManagedRuleGroup where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newDescribeManagedRuleGroupResponse' smart constructor. data DescribeManagedRuleGroupResponse = DescribeManagedRuleGroupResponse' { -- | The labels that one or more rules in this rule group add to matching web -- requests. These labels are defined in the @RuleLabels@ for a Rule. availableLabels :: Prelude.Maybe [LabelSummary], -- | The web ACL capacity units (WCUs) required for this rule group. WAF uses -- web ACL capacity units (WCU) to calculate and control the operating -- resources that are used to run your rules, rule groups, and web ACLs. -- WAF calculates capacity differently for each rule type, to reflect each -- rule\'s relative cost. Rule group capacity is fixed at creation, so -- users can plan their web ACL WCU usage when they use a rule group. The -- WCU limit for web ACLs is 1,500. capacity :: Prelude.Maybe Prelude.Natural, -- | The labels that one or more rules in this rule group match against in -- label match statements. These labels are defined in a -- @LabelMatchStatement@ specification, in the Statement definition of a -- rule. consumedLabels :: Prelude.Maybe [LabelSummary], -- | The label namespace prefix for this rule group. All labels added by -- rules in this rule group have this prefix. -- -- - The syntax for the label namespace prefix for a managed rule group -- is the following: -- -- @awswaf:managed:\:\@: -- -- - When a rule with a label matches a web request, WAF adds the fully -- qualified label to the request. A fully qualified label is made up -- of the label namespace from the rule group or web ACL where the rule -- is defined and the label from the rule, separated by a colon: -- -- @\