{-# 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.AssociateFirewallRuleGroup
-- 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)
--
-- Associates a FirewallRuleGroup with a VPC, to provide DNS filtering for
-- the VPC.
module Amazonka.Route53Resolver.AssociateFirewallRuleGroup
  ( -- * Creating a Request
    AssociateFirewallRuleGroup (..),
    newAssociateFirewallRuleGroup,

    -- * Request Lenses
    associateFirewallRuleGroup_mutationProtection,
    associateFirewallRuleGroup_tags,
    associateFirewallRuleGroup_creatorRequestId,
    associateFirewallRuleGroup_firewallRuleGroupId,
    associateFirewallRuleGroup_vpcId,
    associateFirewallRuleGroup_priority,
    associateFirewallRuleGroup_name,

    -- * Destructuring the Response
    AssociateFirewallRuleGroupResponse (..),
    newAssociateFirewallRuleGroupResponse,

    -- * Response Lenses
    associateFirewallRuleGroupResponse_firewallRuleGroupAssociation,
    associateFirewallRuleGroupResponse_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:/ 'newAssociateFirewallRuleGroup' smart constructor.
data AssociateFirewallRuleGroup = AssociateFirewallRuleGroup'
  { -- | If enabled, this setting disallows modification or removal of the
    -- association, to help prevent against accidentally altering DNS firewall
    -- protections. When you create the association, the default setting is
    -- @DISABLED@.
    AssociateFirewallRuleGroup -> Maybe MutationProtectionStatus
mutationProtection :: Prelude.Maybe MutationProtectionStatus,
    -- | A list of the tag keys and values that you want to associate with the
    -- rule group association.
    AssociateFirewallRuleGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A unique string that identifies the request and that allows failed
    -- requests to be retried without the risk of running the operation twice.
    -- @CreatorRequestId@ can be any unique string, for example, a date\/time
    -- stamp.
    AssociateFirewallRuleGroup -> Text
creatorRequestId :: Prelude.Text,
    -- | The unique identifier of the firewall rule group.
    AssociateFirewallRuleGroup -> Text
firewallRuleGroupId :: Prelude.Text,
    -- | The unique identifier of the VPC that you want to associate with the
    -- rule group.
    AssociateFirewallRuleGroup -> Text
vpcId :: Prelude.Text,
    -- | The setting that determines the processing order of the rule group among
    -- the rule groups that you associate with the specified VPC. DNS Firewall
    -- filters VPC traffic starting from the rule group with the lowest numeric
    -- priority setting.
    --
    -- You must specify a unique priority for each rule group that you
    -- associate with a single VPC. To make it easier to insert rule groups
    -- later, leave space between the numbers, for example, use 101, 200, and
    -- so on. You can change the priority setting for a rule group association
    -- after you create it.
    --
    -- The allowed values for @Priority@ are between 100 and 9900.
    AssociateFirewallRuleGroup -> Int
priority :: Prelude.Int,
    -- | A name that lets you identify the association, to manage and use it.
    AssociateFirewallRuleGroup -> Text
name :: Prelude.Text
  }
  deriving (AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool
(AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool)
-> (AssociateFirewallRuleGroup
    -> AssociateFirewallRuleGroup -> Bool)
-> Eq AssociateFirewallRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool
$c/= :: AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool
== :: AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool
$c== :: AssociateFirewallRuleGroup -> AssociateFirewallRuleGroup -> Bool
Prelude.Eq, ReadPrec [AssociateFirewallRuleGroup]
ReadPrec AssociateFirewallRuleGroup
Int -> ReadS AssociateFirewallRuleGroup
ReadS [AssociateFirewallRuleGroup]
(Int -> ReadS AssociateFirewallRuleGroup)
-> ReadS [AssociateFirewallRuleGroup]
-> ReadPrec AssociateFirewallRuleGroup
-> ReadPrec [AssociateFirewallRuleGroup]
-> Read AssociateFirewallRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateFirewallRuleGroup]
$creadListPrec :: ReadPrec [AssociateFirewallRuleGroup]
readPrec :: ReadPrec AssociateFirewallRuleGroup
$creadPrec :: ReadPrec AssociateFirewallRuleGroup
readList :: ReadS [AssociateFirewallRuleGroup]
$creadList :: ReadS [AssociateFirewallRuleGroup]
readsPrec :: Int -> ReadS AssociateFirewallRuleGroup
$creadsPrec :: Int -> ReadS AssociateFirewallRuleGroup
Prelude.Read, Int -> AssociateFirewallRuleGroup -> ShowS
[AssociateFirewallRuleGroup] -> ShowS
AssociateFirewallRuleGroup -> String
(Int -> AssociateFirewallRuleGroup -> ShowS)
-> (AssociateFirewallRuleGroup -> String)
-> ([AssociateFirewallRuleGroup] -> ShowS)
-> Show AssociateFirewallRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateFirewallRuleGroup] -> ShowS
$cshowList :: [AssociateFirewallRuleGroup] -> ShowS
show :: AssociateFirewallRuleGroup -> String
$cshow :: AssociateFirewallRuleGroup -> String
showsPrec :: Int -> AssociateFirewallRuleGroup -> ShowS
$cshowsPrec :: Int -> AssociateFirewallRuleGroup -> ShowS
Prelude.Show, (forall x.
 AssociateFirewallRuleGroup -> Rep AssociateFirewallRuleGroup x)
-> (forall x.
    Rep AssociateFirewallRuleGroup x -> AssociateFirewallRuleGroup)
-> Generic AssociateFirewallRuleGroup
forall x.
Rep AssociateFirewallRuleGroup x -> AssociateFirewallRuleGroup
forall x.
AssociateFirewallRuleGroup -> Rep AssociateFirewallRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateFirewallRuleGroup x -> AssociateFirewallRuleGroup
$cfrom :: forall x.
AssociateFirewallRuleGroup -> Rep AssociateFirewallRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'AssociateFirewallRuleGroup' 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:
--
-- 'mutationProtection', 'associateFirewallRuleGroup_mutationProtection' - If enabled, this setting disallows modification or removal of the
-- association, to help prevent against accidentally altering DNS firewall
-- protections. When you create the association, the default setting is
-- @DISABLED@.
--
-- 'tags', 'associateFirewallRuleGroup_tags' - A list of the tag keys and values that you want to associate with the
-- rule group association.
--
-- 'creatorRequestId', 'associateFirewallRuleGroup_creatorRequestId' - A unique string that identifies the request and that allows failed
-- requests to be retried without the risk of running the operation twice.
-- @CreatorRequestId@ can be any unique string, for example, a date\/time
-- stamp.
--
-- 'firewallRuleGroupId', 'associateFirewallRuleGroup_firewallRuleGroupId' - The unique identifier of the firewall rule group.
--
-- 'vpcId', 'associateFirewallRuleGroup_vpcId' - The unique identifier of the VPC that you want to associate with the
-- rule group.
--
-- 'priority', 'associateFirewallRuleGroup_priority' - The setting that determines the processing order of the rule group among
-- the rule groups that you associate with the specified VPC. DNS Firewall
-- filters VPC traffic starting from the rule group with the lowest numeric
-- priority setting.
--
-- You must specify a unique priority for each rule group that you
-- associate with a single VPC. To make it easier to insert rule groups
-- later, leave space between the numbers, for example, use 101, 200, and
-- so on. You can change the priority setting for a rule group association
-- after you create it.
--
-- The allowed values for @Priority@ are between 100 and 9900.
--
-- 'name', 'associateFirewallRuleGroup_name' - A name that lets you identify the association, to manage and use it.
newAssociateFirewallRuleGroup ::
  -- | 'creatorRequestId'
  Prelude.Text ->
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  -- | 'vpcId'
  Prelude.Text ->
  -- | 'priority'
  Prelude.Int ->
  -- | 'name'
  Prelude.Text ->
  AssociateFirewallRuleGroup
newAssociateFirewallRuleGroup :: Text -> Text -> Text -> Int -> Text -> AssociateFirewallRuleGroup
newAssociateFirewallRuleGroup
  Text
pCreatorRequestId_
  Text
pFirewallRuleGroupId_
  Text
pVpcId_
  Int
pPriority_
  Text
pName_ =
    AssociateFirewallRuleGroup' :: Maybe MutationProtectionStatus
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Int
-> Text
-> AssociateFirewallRuleGroup
AssociateFirewallRuleGroup'
      { $sel:mutationProtection:AssociateFirewallRuleGroup' :: Maybe MutationProtectionStatus
mutationProtection =
          Maybe MutationProtectionStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:AssociateFirewallRuleGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:creatorRequestId:AssociateFirewallRuleGroup' :: Text
creatorRequestId = Text
pCreatorRequestId_,
        $sel:firewallRuleGroupId:AssociateFirewallRuleGroup' :: Text
firewallRuleGroupId = Text
pFirewallRuleGroupId_,
        $sel:vpcId:AssociateFirewallRuleGroup' :: Text
vpcId = Text
pVpcId_,
        $sel:priority:AssociateFirewallRuleGroup' :: Int
priority = Int
pPriority_,
        $sel:name:AssociateFirewallRuleGroup' :: Text
name = Text
pName_
      }

-- | If enabled, this setting disallows modification or removal of the
-- association, to help prevent against accidentally altering DNS firewall
-- protections. When you create the association, the default setting is
-- @DISABLED@.
associateFirewallRuleGroup_mutationProtection :: Lens.Lens' AssociateFirewallRuleGroup (Prelude.Maybe MutationProtectionStatus)
associateFirewallRuleGroup_mutationProtection :: (Maybe MutationProtectionStatus
 -> f (Maybe MutationProtectionStatus))
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_mutationProtection = (AssociateFirewallRuleGroup -> Maybe MutationProtectionStatus)
-> (AssociateFirewallRuleGroup
    -> Maybe MutationProtectionStatus -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup
     AssociateFirewallRuleGroup
     (Maybe MutationProtectionStatus)
     (Maybe MutationProtectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Maybe MutationProtectionStatus
mutationProtection :: Maybe MutationProtectionStatus
$sel:mutationProtection:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Maybe MutationProtectionStatus
mutationProtection} -> Maybe MutationProtectionStatus
mutationProtection) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Maybe MutationProtectionStatus
a -> AssociateFirewallRuleGroup
s {$sel:mutationProtection:AssociateFirewallRuleGroup' :: Maybe MutationProtectionStatus
mutationProtection = Maybe MutationProtectionStatus
a} :: AssociateFirewallRuleGroup)

-- | A list of the tag keys and values that you want to associate with the
-- rule group association.
associateFirewallRuleGroup_tags :: Lens.Lens' AssociateFirewallRuleGroup (Prelude.Maybe [Tag])
associateFirewallRuleGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_tags = (AssociateFirewallRuleGroup -> Maybe [Tag])
-> (AssociateFirewallRuleGroup
    -> Maybe [Tag] -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup
     AssociateFirewallRuleGroup
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Maybe [Tag]
a -> AssociateFirewallRuleGroup
s {$sel:tags:AssociateFirewallRuleGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: AssociateFirewallRuleGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> AssociateFirewallRuleGroup
-> f AssociateFirewallRuleGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique string that identifies the request and that allows failed
-- requests to be retried without the risk of running the operation twice.
-- @CreatorRequestId@ can be any unique string, for example, a date\/time
-- stamp.
associateFirewallRuleGroup_creatorRequestId :: Lens.Lens' AssociateFirewallRuleGroup Prelude.Text
associateFirewallRuleGroup_creatorRequestId :: (Text -> f Text)
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_creatorRequestId = (AssociateFirewallRuleGroup -> Text)
-> (AssociateFirewallRuleGroup
    -> Text -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup AssociateFirewallRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Text
creatorRequestId :: Text
$sel:creatorRequestId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
creatorRequestId} -> Text
creatorRequestId) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Text
a -> AssociateFirewallRuleGroup
s {$sel:creatorRequestId:AssociateFirewallRuleGroup' :: Text
creatorRequestId = Text
a} :: AssociateFirewallRuleGroup)

-- | The unique identifier of the firewall rule group.
associateFirewallRuleGroup_firewallRuleGroupId :: Lens.Lens' AssociateFirewallRuleGroup Prelude.Text
associateFirewallRuleGroup_firewallRuleGroupId :: (Text -> f Text)
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_firewallRuleGroupId = (AssociateFirewallRuleGroup -> Text)
-> (AssociateFirewallRuleGroup
    -> Text -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup AssociateFirewallRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
firewallRuleGroupId} -> Text
firewallRuleGroupId) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Text
a -> AssociateFirewallRuleGroup
s {$sel:firewallRuleGroupId:AssociateFirewallRuleGroup' :: Text
firewallRuleGroupId = Text
a} :: AssociateFirewallRuleGroup)

-- | The unique identifier of the VPC that you want to associate with the
-- rule group.
associateFirewallRuleGroup_vpcId :: Lens.Lens' AssociateFirewallRuleGroup Prelude.Text
associateFirewallRuleGroup_vpcId :: (Text -> f Text)
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_vpcId = (AssociateFirewallRuleGroup -> Text)
-> (AssociateFirewallRuleGroup
    -> Text -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup AssociateFirewallRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Text
vpcId :: Text
$sel:vpcId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
vpcId} -> Text
vpcId) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Text
a -> AssociateFirewallRuleGroup
s {$sel:vpcId:AssociateFirewallRuleGroup' :: Text
vpcId = Text
a} :: AssociateFirewallRuleGroup)

-- | The setting that determines the processing order of the rule group among
-- the rule groups that you associate with the specified VPC. DNS Firewall
-- filters VPC traffic starting from the rule group with the lowest numeric
-- priority setting.
--
-- You must specify a unique priority for each rule group that you
-- associate with a single VPC. To make it easier to insert rule groups
-- later, leave space between the numbers, for example, use 101, 200, and
-- so on. You can change the priority setting for a rule group association
-- after you create it.
--
-- The allowed values for @Priority@ are between 100 and 9900.
associateFirewallRuleGroup_priority :: Lens.Lens' AssociateFirewallRuleGroup Prelude.Int
associateFirewallRuleGroup_priority :: (Int -> f Int)
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_priority = (AssociateFirewallRuleGroup -> Int)
-> (AssociateFirewallRuleGroup
    -> Int -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup AssociateFirewallRuleGroup Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Int
priority :: Int
$sel:priority:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Int
priority} -> Int
priority) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Int
a -> AssociateFirewallRuleGroup
s {$sel:priority:AssociateFirewallRuleGroup' :: Int
priority = Int
a} :: AssociateFirewallRuleGroup)

-- | A name that lets you identify the association, to manage and use it.
associateFirewallRuleGroup_name :: Lens.Lens' AssociateFirewallRuleGroup Prelude.Text
associateFirewallRuleGroup_name :: (Text -> f Text)
-> AssociateFirewallRuleGroup -> f AssociateFirewallRuleGroup
associateFirewallRuleGroup_name = (AssociateFirewallRuleGroup -> Text)
-> (AssociateFirewallRuleGroup
    -> Text -> AssociateFirewallRuleGroup)
-> Lens
     AssociateFirewallRuleGroup AssociateFirewallRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroup' {Text
name :: Text
$sel:name:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
name} -> Text
name) (\s :: AssociateFirewallRuleGroup
s@AssociateFirewallRuleGroup' {} Text
a -> AssociateFirewallRuleGroup
s {$sel:name:AssociateFirewallRuleGroup' :: Text
name = Text
a} :: AssociateFirewallRuleGroup)

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

instance Prelude.NFData AssociateFirewallRuleGroup

instance Core.ToHeaders AssociateFirewallRuleGroup where
  toHeaders :: AssociateFirewallRuleGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateFirewallRuleGroup -> 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.AssociateFirewallRuleGroup" ::
                          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 AssociateFirewallRuleGroup where
  toJSON :: AssociateFirewallRuleGroup -> Value
toJSON AssociateFirewallRuleGroup' {Int
Maybe [Tag]
Maybe MutationProtectionStatus
Text
name :: Text
priority :: Int
vpcId :: Text
firewallRuleGroupId :: Text
creatorRequestId :: Text
tags :: Maybe [Tag]
mutationProtection :: Maybe MutationProtectionStatus
$sel:name:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
$sel:priority:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Int
$sel:vpcId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
$sel:firewallRuleGroupId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
$sel:creatorRequestId:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Text
$sel:tags:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Maybe [Tag]
$sel:mutationProtection:AssociateFirewallRuleGroup' :: AssociateFirewallRuleGroup -> Maybe MutationProtectionStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MutationProtection" Text -> MutationProtectionStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MutationProtectionStatus -> Pair)
-> Maybe MutationProtectionStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MutationProtectionStatus
mutationProtection,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"CreatorRequestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
creatorRequestId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FirewallRuleGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallRuleGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VpcId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
priority),
            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)
          ]
      )

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

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

-- | /See:/ 'newAssociateFirewallRuleGroupResponse' smart constructor.
data AssociateFirewallRuleGroupResponse = AssociateFirewallRuleGroupResponse'
  { -- | The association that you just created. The association has an ID that
    -- you can use to identify it in other requests, like update and delete.
    AssociateFirewallRuleGroupResponse
-> Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation :: Prelude.Maybe FirewallRuleGroupAssociation,
    -- | The response's http status code.
    AssociateFirewallRuleGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateFirewallRuleGroupResponse
-> AssociateFirewallRuleGroupResponse -> Bool
(AssociateFirewallRuleGroupResponse
 -> AssociateFirewallRuleGroupResponse -> Bool)
-> (AssociateFirewallRuleGroupResponse
    -> AssociateFirewallRuleGroupResponse -> Bool)
-> Eq AssociateFirewallRuleGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateFirewallRuleGroupResponse
-> AssociateFirewallRuleGroupResponse -> Bool
$c/= :: AssociateFirewallRuleGroupResponse
-> AssociateFirewallRuleGroupResponse -> Bool
== :: AssociateFirewallRuleGroupResponse
-> AssociateFirewallRuleGroupResponse -> Bool
$c== :: AssociateFirewallRuleGroupResponse
-> AssociateFirewallRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [AssociateFirewallRuleGroupResponse]
ReadPrec AssociateFirewallRuleGroupResponse
Int -> ReadS AssociateFirewallRuleGroupResponse
ReadS [AssociateFirewallRuleGroupResponse]
(Int -> ReadS AssociateFirewallRuleGroupResponse)
-> ReadS [AssociateFirewallRuleGroupResponse]
-> ReadPrec AssociateFirewallRuleGroupResponse
-> ReadPrec [AssociateFirewallRuleGroupResponse]
-> Read AssociateFirewallRuleGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateFirewallRuleGroupResponse]
$creadListPrec :: ReadPrec [AssociateFirewallRuleGroupResponse]
readPrec :: ReadPrec AssociateFirewallRuleGroupResponse
$creadPrec :: ReadPrec AssociateFirewallRuleGroupResponse
readList :: ReadS [AssociateFirewallRuleGroupResponse]
$creadList :: ReadS [AssociateFirewallRuleGroupResponse]
readsPrec :: Int -> ReadS AssociateFirewallRuleGroupResponse
$creadsPrec :: Int -> ReadS AssociateFirewallRuleGroupResponse
Prelude.Read, Int -> AssociateFirewallRuleGroupResponse -> ShowS
[AssociateFirewallRuleGroupResponse] -> ShowS
AssociateFirewallRuleGroupResponse -> String
(Int -> AssociateFirewallRuleGroupResponse -> ShowS)
-> (AssociateFirewallRuleGroupResponse -> String)
-> ([AssociateFirewallRuleGroupResponse] -> ShowS)
-> Show AssociateFirewallRuleGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateFirewallRuleGroupResponse] -> ShowS
$cshowList :: [AssociateFirewallRuleGroupResponse] -> ShowS
show :: AssociateFirewallRuleGroupResponse -> String
$cshow :: AssociateFirewallRuleGroupResponse -> String
showsPrec :: Int -> AssociateFirewallRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> AssociateFirewallRuleGroupResponse -> ShowS
Prelude.Show, (forall x.
 AssociateFirewallRuleGroupResponse
 -> Rep AssociateFirewallRuleGroupResponse x)
-> (forall x.
    Rep AssociateFirewallRuleGroupResponse x
    -> AssociateFirewallRuleGroupResponse)
-> Generic AssociateFirewallRuleGroupResponse
forall x.
Rep AssociateFirewallRuleGroupResponse x
-> AssociateFirewallRuleGroupResponse
forall x.
AssociateFirewallRuleGroupResponse
-> Rep AssociateFirewallRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateFirewallRuleGroupResponse x
-> AssociateFirewallRuleGroupResponse
$cfrom :: forall x.
AssociateFirewallRuleGroupResponse
-> Rep AssociateFirewallRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateFirewallRuleGroupResponse' 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:
--
-- 'firewallRuleGroupAssociation', 'associateFirewallRuleGroupResponse_firewallRuleGroupAssociation' - The association that you just created. The association has an ID that
-- you can use to identify it in other requests, like update and delete.
--
-- 'httpStatus', 'associateFirewallRuleGroupResponse_httpStatus' - The response's http status code.
newAssociateFirewallRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateFirewallRuleGroupResponse
newAssociateFirewallRuleGroupResponse :: Int -> AssociateFirewallRuleGroupResponse
newAssociateFirewallRuleGroupResponse Int
pHttpStatus_ =
  AssociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
-> Int -> AssociateFirewallRuleGroupResponse
AssociateFirewallRuleGroupResponse'
    { $sel:firewallRuleGroupAssociation:AssociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation =
        Maybe FirewallRuleGroupAssociation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateFirewallRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The association that you just created. The association has an ID that
-- you can use to identify it in other requests, like update and delete.
associateFirewallRuleGroupResponse_firewallRuleGroupAssociation :: Lens.Lens' AssociateFirewallRuleGroupResponse (Prelude.Maybe FirewallRuleGroupAssociation)
associateFirewallRuleGroupResponse_firewallRuleGroupAssociation :: (Maybe FirewallRuleGroupAssociation
 -> f (Maybe FirewallRuleGroupAssociation))
-> AssociateFirewallRuleGroupResponse
-> f AssociateFirewallRuleGroupResponse
associateFirewallRuleGroupResponse_firewallRuleGroupAssociation = (AssociateFirewallRuleGroupResponse
 -> Maybe FirewallRuleGroupAssociation)
-> (AssociateFirewallRuleGroupResponse
    -> Maybe FirewallRuleGroupAssociation
    -> AssociateFirewallRuleGroupResponse)
-> Lens
     AssociateFirewallRuleGroupResponse
     AssociateFirewallRuleGroupResponse
     (Maybe FirewallRuleGroupAssociation)
     (Maybe FirewallRuleGroupAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallRuleGroupResponse' {Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation :: Maybe FirewallRuleGroupAssociation
$sel:firewallRuleGroupAssociation:AssociateFirewallRuleGroupResponse' :: AssociateFirewallRuleGroupResponse
-> Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation} -> Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation) (\s :: AssociateFirewallRuleGroupResponse
s@AssociateFirewallRuleGroupResponse' {} Maybe FirewallRuleGroupAssociation
a -> AssociateFirewallRuleGroupResponse
s {$sel:firewallRuleGroupAssociation:AssociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation = Maybe FirewallRuleGroupAssociation
a} :: AssociateFirewallRuleGroupResponse)

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

instance
  Prelude.NFData
    AssociateFirewallRuleGroupResponse