{-# 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.Shield.UpdateProtectionGroup
-- 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)
--
-- Updates an existing protection group. A protection group is a grouping
-- of protected resources so they can be handled as a collective. This
-- resource grouping improves the accuracy of detection and reduces false
-- positives.
module Amazonka.Shield.UpdateProtectionGroup
  ( -- * Creating a Request
    UpdateProtectionGroup (..),
    newUpdateProtectionGroup,

    -- * Request Lenses
    updateProtectionGroup_resourceType,
    updateProtectionGroup_members,
    updateProtectionGroup_protectionGroupId,
    updateProtectionGroup_aggregation,
    updateProtectionGroup_pattern,

    -- * Destructuring the Response
    UpdateProtectionGroupResponse (..),
    newUpdateProtectionGroupResponse,

    -- * Response Lenses
    updateProtectionGroupResponse_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.Shield.Types

-- | /See:/ 'newUpdateProtectionGroup' smart constructor.
data UpdateProtectionGroup = UpdateProtectionGroup'
  { -- | The resource type to include in the protection group. All protected
    -- resources of this type are included in the protection group. You must
    -- set this when you set @Pattern@ to @BY_RESOURCE_TYPE@ and you must not
    -- set it for any other @Pattern@ setting.
    UpdateProtectionGroup -> Maybe ProtectedResourceType
resourceType :: Prelude.Maybe ProtectedResourceType,
    -- | The Amazon Resource Names (ARNs) of the resources to include in the
    -- protection group. You must set this when you set @Pattern@ to
    -- @ARBITRARY@ and you must not set it for any other @Pattern@ setting.
    UpdateProtectionGroup -> Maybe [Text]
members :: Prelude.Maybe [Prelude.Text],
    -- | The name of the protection group. You use this to identify the
    -- protection group in lists and to manage the protection group, for
    -- example to update, delete, or describe it.
    UpdateProtectionGroup -> Text
protectionGroupId :: Prelude.Text,
    -- | Defines how Shield combines resource data for the group in order to
    -- detect, mitigate, and report events.
    --
    -- -   Sum - Use the total traffic across the group. This is a good choice
    --     for most cases. Examples include Elastic IP addresses for EC2
    --     instances that scale manually or automatically.
    --
    -- -   Mean - Use the average of the traffic across the group. This is a
    --     good choice for resources that share traffic uniformly. Examples
    --     include accelerators and load balancers.
    --
    -- -   Max - Use the highest traffic from each resource. This is useful for
    --     resources that don\'t share traffic and for resources that share
    --     that traffic in a non-uniform way. Examples include Amazon
    --     CloudFront distributions and origin resources for CloudFront
    --     distributions.
    UpdateProtectionGroup -> ProtectionGroupAggregation
aggregation :: ProtectionGroupAggregation,
    -- | The criteria to use to choose the protected resources for inclusion in
    -- the group. You can include all resources that have protections, provide
    -- a list of resource Amazon Resource Names (ARNs), or include all
    -- resources of a specified resource type.
    UpdateProtectionGroup -> ProtectionGroupPattern
pattern' :: ProtectionGroupPattern
  }
  deriving (UpdateProtectionGroup -> UpdateProtectionGroup -> Bool
(UpdateProtectionGroup -> UpdateProtectionGroup -> Bool)
-> (UpdateProtectionGroup -> UpdateProtectionGroup -> Bool)
-> Eq UpdateProtectionGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProtectionGroup -> UpdateProtectionGroup -> Bool
$c/= :: UpdateProtectionGroup -> UpdateProtectionGroup -> Bool
== :: UpdateProtectionGroup -> UpdateProtectionGroup -> Bool
$c== :: UpdateProtectionGroup -> UpdateProtectionGroup -> Bool
Prelude.Eq, ReadPrec [UpdateProtectionGroup]
ReadPrec UpdateProtectionGroup
Int -> ReadS UpdateProtectionGroup
ReadS [UpdateProtectionGroup]
(Int -> ReadS UpdateProtectionGroup)
-> ReadS [UpdateProtectionGroup]
-> ReadPrec UpdateProtectionGroup
-> ReadPrec [UpdateProtectionGroup]
-> Read UpdateProtectionGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProtectionGroup]
$creadListPrec :: ReadPrec [UpdateProtectionGroup]
readPrec :: ReadPrec UpdateProtectionGroup
$creadPrec :: ReadPrec UpdateProtectionGroup
readList :: ReadS [UpdateProtectionGroup]
$creadList :: ReadS [UpdateProtectionGroup]
readsPrec :: Int -> ReadS UpdateProtectionGroup
$creadsPrec :: Int -> ReadS UpdateProtectionGroup
Prelude.Read, Int -> UpdateProtectionGroup -> ShowS
[UpdateProtectionGroup] -> ShowS
UpdateProtectionGroup -> String
(Int -> UpdateProtectionGroup -> ShowS)
-> (UpdateProtectionGroup -> String)
-> ([UpdateProtectionGroup] -> ShowS)
-> Show UpdateProtectionGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProtectionGroup] -> ShowS
$cshowList :: [UpdateProtectionGroup] -> ShowS
show :: UpdateProtectionGroup -> String
$cshow :: UpdateProtectionGroup -> String
showsPrec :: Int -> UpdateProtectionGroup -> ShowS
$cshowsPrec :: Int -> UpdateProtectionGroup -> ShowS
Prelude.Show, (forall x. UpdateProtectionGroup -> Rep UpdateProtectionGroup x)
-> (forall x. Rep UpdateProtectionGroup x -> UpdateProtectionGroup)
-> Generic UpdateProtectionGroup
forall x. Rep UpdateProtectionGroup x -> UpdateProtectionGroup
forall x. UpdateProtectionGroup -> Rep UpdateProtectionGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProtectionGroup x -> UpdateProtectionGroup
$cfrom :: forall x. UpdateProtectionGroup -> Rep UpdateProtectionGroup x
Prelude.Generic)

-- |
-- Create a value of 'UpdateProtectionGroup' 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:
--
-- 'resourceType', 'updateProtectionGroup_resourceType' - The resource type to include in the protection group. All protected
-- resources of this type are included in the protection group. You must
-- set this when you set @Pattern@ to @BY_RESOURCE_TYPE@ and you must not
-- set it for any other @Pattern@ setting.
--
-- 'members', 'updateProtectionGroup_members' - The Amazon Resource Names (ARNs) of the resources to include in the
-- protection group. You must set this when you set @Pattern@ to
-- @ARBITRARY@ and you must not set it for any other @Pattern@ setting.
--
-- 'protectionGroupId', 'updateProtectionGroup_protectionGroupId' - The name of the protection group. You use this to identify the
-- protection group in lists and to manage the protection group, for
-- example to update, delete, or describe it.
--
-- 'aggregation', 'updateProtectionGroup_aggregation' - Defines how Shield combines resource data for the group in order to
-- detect, mitigate, and report events.
--
-- -   Sum - Use the total traffic across the group. This is a good choice
--     for most cases. Examples include Elastic IP addresses for EC2
--     instances that scale manually or automatically.
--
-- -   Mean - Use the average of the traffic across the group. This is a
--     good choice for resources that share traffic uniformly. Examples
--     include accelerators and load balancers.
--
-- -   Max - Use the highest traffic from each resource. This is useful for
--     resources that don\'t share traffic and for resources that share
--     that traffic in a non-uniform way. Examples include Amazon
--     CloudFront distributions and origin resources for CloudFront
--     distributions.
--
-- 'pattern'', 'updateProtectionGroup_pattern' - The criteria to use to choose the protected resources for inclusion in
-- the group. You can include all resources that have protections, provide
-- a list of resource Amazon Resource Names (ARNs), or include all
-- resources of a specified resource type.
newUpdateProtectionGroup ::
  -- | 'protectionGroupId'
  Prelude.Text ->
  -- | 'aggregation'
  ProtectionGroupAggregation ->
  -- | 'pattern''
  ProtectionGroupPattern ->
  UpdateProtectionGroup
newUpdateProtectionGroup :: Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> UpdateProtectionGroup
newUpdateProtectionGroup
  Text
pProtectionGroupId_
  ProtectionGroupAggregation
pAggregation_
  ProtectionGroupPattern
pPattern_ =
    UpdateProtectionGroup' :: Maybe ProtectedResourceType
-> Maybe [Text]
-> Text
-> ProtectionGroupAggregation
-> ProtectionGroupPattern
-> UpdateProtectionGroup
UpdateProtectionGroup'
      { $sel:resourceType:UpdateProtectionGroup' :: Maybe ProtectedResourceType
resourceType =
          Maybe ProtectedResourceType
forall a. Maybe a
Prelude.Nothing,
        $sel:members:UpdateProtectionGroup' :: Maybe [Text]
members = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:protectionGroupId:UpdateProtectionGroup' :: Text
protectionGroupId = Text
pProtectionGroupId_,
        $sel:aggregation:UpdateProtectionGroup' :: ProtectionGroupAggregation
aggregation = ProtectionGroupAggregation
pAggregation_,
        $sel:pattern':UpdateProtectionGroup' :: ProtectionGroupPattern
pattern' = ProtectionGroupPattern
pPattern_
      }

-- | The resource type to include in the protection group. All protected
-- resources of this type are included in the protection group. You must
-- set this when you set @Pattern@ to @BY_RESOURCE_TYPE@ and you must not
-- set it for any other @Pattern@ setting.
updateProtectionGroup_resourceType :: Lens.Lens' UpdateProtectionGroup (Prelude.Maybe ProtectedResourceType)
updateProtectionGroup_resourceType :: (Maybe ProtectedResourceType -> f (Maybe ProtectedResourceType))
-> UpdateProtectionGroup -> f UpdateProtectionGroup
updateProtectionGroup_resourceType = (UpdateProtectionGroup -> Maybe ProtectedResourceType)
-> (UpdateProtectionGroup
    -> Maybe ProtectedResourceType -> UpdateProtectionGroup)
-> Lens
     UpdateProtectionGroup
     UpdateProtectionGroup
     (Maybe ProtectedResourceType)
     (Maybe ProtectedResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProtectionGroup' {Maybe ProtectedResourceType
resourceType :: Maybe ProtectedResourceType
$sel:resourceType:UpdateProtectionGroup' :: UpdateProtectionGroup -> Maybe ProtectedResourceType
resourceType} -> Maybe ProtectedResourceType
resourceType) (\s :: UpdateProtectionGroup
s@UpdateProtectionGroup' {} Maybe ProtectedResourceType
a -> UpdateProtectionGroup
s {$sel:resourceType:UpdateProtectionGroup' :: Maybe ProtectedResourceType
resourceType = Maybe ProtectedResourceType
a} :: UpdateProtectionGroup)

-- | The Amazon Resource Names (ARNs) of the resources to include in the
-- protection group. You must set this when you set @Pattern@ to
-- @ARBITRARY@ and you must not set it for any other @Pattern@ setting.
updateProtectionGroup_members :: Lens.Lens' UpdateProtectionGroup (Prelude.Maybe [Prelude.Text])
updateProtectionGroup_members :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateProtectionGroup -> f UpdateProtectionGroup
updateProtectionGroup_members = (UpdateProtectionGroup -> Maybe [Text])
-> (UpdateProtectionGroup -> Maybe [Text] -> UpdateProtectionGroup)
-> Lens
     UpdateProtectionGroup
     UpdateProtectionGroup
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProtectionGroup' {Maybe [Text]
members :: Maybe [Text]
$sel:members:UpdateProtectionGroup' :: UpdateProtectionGroup -> Maybe [Text]
members} -> Maybe [Text]
members) (\s :: UpdateProtectionGroup
s@UpdateProtectionGroup' {} Maybe [Text]
a -> UpdateProtectionGroup
s {$sel:members:UpdateProtectionGroup' :: Maybe [Text]
members = Maybe [Text]
a} :: UpdateProtectionGroup) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateProtectionGroup -> f UpdateProtectionGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateProtectionGroup
-> f UpdateProtectionGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the protection group. You use this to identify the
-- protection group in lists and to manage the protection group, for
-- example to update, delete, or describe it.
updateProtectionGroup_protectionGroupId :: Lens.Lens' UpdateProtectionGroup Prelude.Text
updateProtectionGroup_protectionGroupId :: (Text -> f Text)
-> UpdateProtectionGroup -> f UpdateProtectionGroup
updateProtectionGroup_protectionGroupId = (UpdateProtectionGroup -> Text)
-> (UpdateProtectionGroup -> Text -> UpdateProtectionGroup)
-> Lens UpdateProtectionGroup UpdateProtectionGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProtectionGroup' {Text
protectionGroupId :: Text
$sel:protectionGroupId:UpdateProtectionGroup' :: UpdateProtectionGroup -> Text
protectionGroupId} -> Text
protectionGroupId) (\s :: UpdateProtectionGroup
s@UpdateProtectionGroup' {} Text
a -> UpdateProtectionGroup
s {$sel:protectionGroupId:UpdateProtectionGroup' :: Text
protectionGroupId = Text
a} :: UpdateProtectionGroup)

-- | Defines how Shield combines resource data for the group in order to
-- detect, mitigate, and report events.
--
-- -   Sum - Use the total traffic across the group. This is a good choice
--     for most cases. Examples include Elastic IP addresses for EC2
--     instances that scale manually or automatically.
--
-- -   Mean - Use the average of the traffic across the group. This is a
--     good choice for resources that share traffic uniformly. Examples
--     include accelerators and load balancers.
--
-- -   Max - Use the highest traffic from each resource. This is useful for
--     resources that don\'t share traffic and for resources that share
--     that traffic in a non-uniform way. Examples include Amazon
--     CloudFront distributions and origin resources for CloudFront
--     distributions.
updateProtectionGroup_aggregation :: Lens.Lens' UpdateProtectionGroup ProtectionGroupAggregation
updateProtectionGroup_aggregation :: (ProtectionGroupAggregation -> f ProtectionGroupAggregation)
-> UpdateProtectionGroup -> f UpdateProtectionGroup
updateProtectionGroup_aggregation = (UpdateProtectionGroup -> ProtectionGroupAggregation)
-> (UpdateProtectionGroup
    -> ProtectionGroupAggregation -> UpdateProtectionGroup)
-> Lens
     UpdateProtectionGroup
     UpdateProtectionGroup
     ProtectionGroupAggregation
     ProtectionGroupAggregation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProtectionGroup' {ProtectionGroupAggregation
aggregation :: ProtectionGroupAggregation
$sel:aggregation:UpdateProtectionGroup' :: UpdateProtectionGroup -> ProtectionGroupAggregation
aggregation} -> ProtectionGroupAggregation
aggregation) (\s :: UpdateProtectionGroup
s@UpdateProtectionGroup' {} ProtectionGroupAggregation
a -> UpdateProtectionGroup
s {$sel:aggregation:UpdateProtectionGroup' :: ProtectionGroupAggregation
aggregation = ProtectionGroupAggregation
a} :: UpdateProtectionGroup)

-- | The criteria to use to choose the protected resources for inclusion in
-- the group. You can include all resources that have protections, provide
-- a list of resource Amazon Resource Names (ARNs), or include all
-- resources of a specified resource type.
updateProtectionGroup_pattern :: Lens.Lens' UpdateProtectionGroup ProtectionGroupPattern
updateProtectionGroup_pattern :: (ProtectionGroupPattern -> f ProtectionGroupPattern)
-> UpdateProtectionGroup -> f UpdateProtectionGroup
updateProtectionGroup_pattern = (UpdateProtectionGroup -> ProtectionGroupPattern)
-> (UpdateProtectionGroup
    -> ProtectionGroupPattern -> UpdateProtectionGroup)
-> Lens
     UpdateProtectionGroup
     UpdateProtectionGroup
     ProtectionGroupPattern
     ProtectionGroupPattern
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProtectionGroup' {ProtectionGroupPattern
pattern' :: ProtectionGroupPattern
$sel:pattern':UpdateProtectionGroup' :: UpdateProtectionGroup -> ProtectionGroupPattern
pattern'} -> ProtectionGroupPattern
pattern') (\s :: UpdateProtectionGroup
s@UpdateProtectionGroup' {} ProtectionGroupPattern
a -> UpdateProtectionGroup
s {$sel:pattern':UpdateProtectionGroup' :: ProtectionGroupPattern
pattern' = ProtectionGroupPattern
a} :: UpdateProtectionGroup)

instance Core.AWSRequest UpdateProtectionGroup where
  type
    AWSResponse UpdateProtectionGroup =
      UpdateProtectionGroupResponse
  request :: UpdateProtectionGroup -> Request UpdateProtectionGroup
request = Service -> UpdateProtectionGroup -> Request UpdateProtectionGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateProtectionGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateProtectionGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateProtectionGroup))
-> Logger
-> Service
-> Proxy UpdateProtectionGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateProtectionGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateProtectionGroupResponse
UpdateProtectionGroupResponse'
            (Int -> UpdateProtectionGroupResponse)
-> Either String Int -> Either String UpdateProtectionGroupResponse
forall (f :: * -> *) a b. Functor 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 UpdateProtectionGroup

instance Prelude.NFData UpdateProtectionGroup

instance Core.ToHeaders UpdateProtectionGroup where
  toHeaders :: UpdateProtectionGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateProtectionGroup -> 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
"AWSShield_20160616.UpdateProtectionGroup" ::
                          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 UpdateProtectionGroup where
  toJSON :: UpdateProtectionGroup -> Value
toJSON UpdateProtectionGroup' {Maybe [Text]
Maybe ProtectedResourceType
Text
ProtectionGroupAggregation
ProtectionGroupPattern
pattern' :: ProtectionGroupPattern
aggregation :: ProtectionGroupAggregation
protectionGroupId :: Text
members :: Maybe [Text]
resourceType :: Maybe ProtectedResourceType
$sel:pattern':UpdateProtectionGroup' :: UpdateProtectionGroup -> ProtectionGroupPattern
$sel:aggregation:UpdateProtectionGroup' :: UpdateProtectionGroup -> ProtectionGroupAggregation
$sel:protectionGroupId:UpdateProtectionGroup' :: UpdateProtectionGroup -> Text
$sel:members:UpdateProtectionGroup' :: UpdateProtectionGroup -> Maybe [Text]
$sel:resourceType:UpdateProtectionGroup' :: UpdateProtectionGroup -> Maybe ProtectedResourceType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceType" Text -> ProtectedResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProtectedResourceType -> Pair)
-> Maybe ProtectedResourceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProtectedResourceType
resourceType,
            (Text
"Members" 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]
members,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ProtectionGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
protectionGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Aggregation" Text -> ProtectionGroupAggregation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProtectionGroupAggregation
aggregation),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Pattern" Text -> ProtectionGroupPattern -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProtectionGroupPattern
pattern')
          ]
      )

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

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

-- | /See:/ 'newUpdateProtectionGroupResponse' smart constructor.
data UpdateProtectionGroupResponse = UpdateProtectionGroupResponse'
  { -- | The response's http status code.
    UpdateProtectionGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateProtectionGroupResponse
-> UpdateProtectionGroupResponse -> Bool
(UpdateProtectionGroupResponse
 -> UpdateProtectionGroupResponse -> Bool)
-> (UpdateProtectionGroupResponse
    -> UpdateProtectionGroupResponse -> Bool)
-> Eq UpdateProtectionGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProtectionGroupResponse
-> UpdateProtectionGroupResponse -> Bool
$c/= :: UpdateProtectionGroupResponse
-> UpdateProtectionGroupResponse -> Bool
== :: UpdateProtectionGroupResponse
-> UpdateProtectionGroupResponse -> Bool
$c== :: UpdateProtectionGroupResponse
-> UpdateProtectionGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateProtectionGroupResponse]
ReadPrec UpdateProtectionGroupResponse
Int -> ReadS UpdateProtectionGroupResponse
ReadS [UpdateProtectionGroupResponse]
(Int -> ReadS UpdateProtectionGroupResponse)
-> ReadS [UpdateProtectionGroupResponse]
-> ReadPrec UpdateProtectionGroupResponse
-> ReadPrec [UpdateProtectionGroupResponse]
-> Read UpdateProtectionGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProtectionGroupResponse]
$creadListPrec :: ReadPrec [UpdateProtectionGroupResponse]
readPrec :: ReadPrec UpdateProtectionGroupResponse
$creadPrec :: ReadPrec UpdateProtectionGroupResponse
readList :: ReadS [UpdateProtectionGroupResponse]
$creadList :: ReadS [UpdateProtectionGroupResponse]
readsPrec :: Int -> ReadS UpdateProtectionGroupResponse
$creadsPrec :: Int -> ReadS UpdateProtectionGroupResponse
Prelude.Read, Int -> UpdateProtectionGroupResponse -> ShowS
[UpdateProtectionGroupResponse] -> ShowS
UpdateProtectionGroupResponse -> String
(Int -> UpdateProtectionGroupResponse -> ShowS)
-> (UpdateProtectionGroupResponse -> String)
-> ([UpdateProtectionGroupResponse] -> ShowS)
-> Show UpdateProtectionGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProtectionGroupResponse] -> ShowS
$cshowList :: [UpdateProtectionGroupResponse] -> ShowS
show :: UpdateProtectionGroupResponse -> String
$cshow :: UpdateProtectionGroupResponse -> String
showsPrec :: Int -> UpdateProtectionGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateProtectionGroupResponse -> ShowS
Prelude.Show, (forall x.
 UpdateProtectionGroupResponse
 -> Rep UpdateProtectionGroupResponse x)
-> (forall x.
    Rep UpdateProtectionGroupResponse x
    -> UpdateProtectionGroupResponse)
-> Generic UpdateProtectionGroupResponse
forall x.
Rep UpdateProtectionGroupResponse x
-> UpdateProtectionGroupResponse
forall x.
UpdateProtectionGroupResponse
-> Rep UpdateProtectionGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateProtectionGroupResponse x
-> UpdateProtectionGroupResponse
$cfrom :: forall x.
UpdateProtectionGroupResponse
-> Rep UpdateProtectionGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateProtectionGroupResponse' 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:
--
-- 'httpStatus', 'updateProtectionGroupResponse_httpStatus' - The response's http status code.
newUpdateProtectionGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateProtectionGroupResponse
newUpdateProtectionGroupResponse :: Int -> UpdateProtectionGroupResponse
newUpdateProtectionGroupResponse Int
pHttpStatus_ =
  UpdateProtectionGroupResponse' :: Int -> UpdateProtectionGroupResponse
UpdateProtectionGroupResponse'
    { $sel:httpStatus:UpdateProtectionGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateProtectionGroupResponse