{-# 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 #-}
module Amazonka.GuardDuty.UpdateFilter
(
UpdateFilter (..),
newUpdateFilter,
updateFilter_findingCriteria,
updateFilter_action,
updateFilter_description,
updateFilter_rank,
updateFilter_detectorId,
updateFilter_filterName,
UpdateFilterResponse (..),
newUpdateFilterResponse,
updateFilterResponse_httpStatus,
updateFilterResponse_name,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateFilter = UpdateFilter'
{
UpdateFilter -> Maybe FindingCriteria
findingCriteria :: Prelude.Maybe FindingCriteria,
UpdateFilter -> Maybe FilterAction
action :: Prelude.Maybe FilterAction,
UpdateFilter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateFilter -> Maybe Natural
rank :: Prelude.Maybe Prelude.Natural,
UpdateFilter -> Text
detectorId :: Prelude.Text,
UpdateFilter -> Text
filterName :: Prelude.Text
}
deriving (UpdateFilter -> UpdateFilter -> Bool
(UpdateFilter -> UpdateFilter -> Bool)
-> (UpdateFilter -> UpdateFilter -> Bool) -> Eq UpdateFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFilter -> UpdateFilter -> Bool
$c/= :: UpdateFilter -> UpdateFilter -> Bool
== :: UpdateFilter -> UpdateFilter -> Bool
$c== :: UpdateFilter -> UpdateFilter -> Bool
Prelude.Eq, ReadPrec [UpdateFilter]
ReadPrec UpdateFilter
Int -> ReadS UpdateFilter
ReadS [UpdateFilter]
(Int -> ReadS UpdateFilter)
-> ReadS [UpdateFilter]
-> ReadPrec UpdateFilter
-> ReadPrec [UpdateFilter]
-> Read UpdateFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFilter]
$creadListPrec :: ReadPrec [UpdateFilter]
readPrec :: ReadPrec UpdateFilter
$creadPrec :: ReadPrec UpdateFilter
readList :: ReadS [UpdateFilter]
$creadList :: ReadS [UpdateFilter]
readsPrec :: Int -> ReadS UpdateFilter
$creadsPrec :: Int -> ReadS UpdateFilter
Prelude.Read, Int -> UpdateFilter -> ShowS
[UpdateFilter] -> ShowS
UpdateFilter -> String
(Int -> UpdateFilter -> ShowS)
-> (UpdateFilter -> String)
-> ([UpdateFilter] -> ShowS)
-> Show UpdateFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFilter] -> ShowS
$cshowList :: [UpdateFilter] -> ShowS
show :: UpdateFilter -> String
$cshow :: UpdateFilter -> String
showsPrec :: Int -> UpdateFilter -> ShowS
$cshowsPrec :: Int -> UpdateFilter -> ShowS
Prelude.Show, (forall x. UpdateFilter -> Rep UpdateFilter x)
-> (forall x. Rep UpdateFilter x -> UpdateFilter)
-> Generic UpdateFilter
forall x. Rep UpdateFilter x -> UpdateFilter
forall x. UpdateFilter -> Rep UpdateFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFilter x -> UpdateFilter
$cfrom :: forall x. UpdateFilter -> Rep UpdateFilter x
Prelude.Generic)
newUpdateFilter ::
Prelude.Text ->
Prelude.Text ->
UpdateFilter
newUpdateFilter :: Text -> Text -> UpdateFilter
newUpdateFilter Text
pDetectorId_ Text
pFilterName_ =
UpdateFilter' :: Maybe FindingCriteria
-> Maybe FilterAction
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> UpdateFilter
UpdateFilter'
{ $sel:findingCriteria:UpdateFilter' :: Maybe FindingCriteria
findingCriteria = Maybe FindingCriteria
forall a. Maybe a
Prelude.Nothing,
$sel:action:UpdateFilter' :: Maybe FilterAction
action = Maybe FilterAction
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateFilter' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:rank:UpdateFilter' :: Maybe Natural
rank = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:UpdateFilter' :: Text
detectorId = Text
pDetectorId_,
$sel:filterName:UpdateFilter' :: Text
filterName = Text
pFilterName_
}
updateFilter_findingCriteria :: Lens.Lens' UpdateFilter (Prelude.Maybe FindingCriteria)
updateFilter_findingCriteria :: (Maybe FindingCriteria -> f (Maybe FindingCriteria))
-> UpdateFilter -> f UpdateFilter
updateFilter_findingCriteria = (UpdateFilter -> Maybe FindingCriteria)
-> (UpdateFilter -> Maybe FindingCriteria -> UpdateFilter)
-> Lens
UpdateFilter
UpdateFilter
(Maybe FindingCriteria)
(Maybe FindingCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Maybe FindingCriteria
findingCriteria :: Maybe FindingCriteria
$sel:findingCriteria:UpdateFilter' :: UpdateFilter -> Maybe FindingCriteria
findingCriteria} -> Maybe FindingCriteria
findingCriteria) (\s :: UpdateFilter
s@UpdateFilter' {} Maybe FindingCriteria
a -> UpdateFilter
s {$sel:findingCriteria:UpdateFilter' :: Maybe FindingCriteria
findingCriteria = Maybe FindingCriteria
a} :: UpdateFilter)
updateFilter_action :: Lens.Lens' UpdateFilter (Prelude.Maybe FilterAction)
updateFilter_action :: (Maybe FilterAction -> f (Maybe FilterAction))
-> UpdateFilter -> f UpdateFilter
updateFilter_action = (UpdateFilter -> Maybe FilterAction)
-> (UpdateFilter -> Maybe FilterAction -> UpdateFilter)
-> Lens
UpdateFilter UpdateFilter (Maybe FilterAction) (Maybe FilterAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Maybe FilterAction
action :: Maybe FilterAction
$sel:action:UpdateFilter' :: UpdateFilter -> Maybe FilterAction
action} -> Maybe FilterAction
action) (\s :: UpdateFilter
s@UpdateFilter' {} Maybe FilterAction
a -> UpdateFilter
s {$sel:action:UpdateFilter' :: Maybe FilterAction
action = Maybe FilterAction
a} :: UpdateFilter)
updateFilter_description :: Lens.Lens' UpdateFilter (Prelude.Maybe Prelude.Text)
updateFilter_description :: (Maybe Text -> f (Maybe Text)) -> UpdateFilter -> f UpdateFilter
updateFilter_description = (UpdateFilter -> Maybe Text)
-> (UpdateFilter -> Maybe Text -> UpdateFilter)
-> Lens UpdateFilter UpdateFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Maybe Text
description :: Maybe Text
$sel:description:UpdateFilter' :: UpdateFilter -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateFilter
s@UpdateFilter' {} Maybe Text
a -> UpdateFilter
s {$sel:description:UpdateFilter' :: Maybe Text
description = Maybe Text
a} :: UpdateFilter)
updateFilter_rank :: Lens.Lens' UpdateFilter (Prelude.Maybe Prelude.Natural)
updateFilter_rank :: (Maybe Natural -> f (Maybe Natural))
-> UpdateFilter -> f UpdateFilter
updateFilter_rank = (UpdateFilter -> Maybe Natural)
-> (UpdateFilter -> Maybe Natural -> UpdateFilter)
-> Lens UpdateFilter UpdateFilter (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Maybe Natural
rank :: Maybe Natural
$sel:rank:UpdateFilter' :: UpdateFilter -> Maybe Natural
rank} -> Maybe Natural
rank) (\s :: UpdateFilter
s@UpdateFilter' {} Maybe Natural
a -> UpdateFilter
s {$sel:rank:UpdateFilter' :: Maybe Natural
rank = Maybe Natural
a} :: UpdateFilter)
updateFilter_detectorId :: Lens.Lens' UpdateFilter Prelude.Text
updateFilter_detectorId :: (Text -> f Text) -> UpdateFilter -> f UpdateFilter
updateFilter_detectorId = (UpdateFilter -> Text)
-> (UpdateFilter -> Text -> UpdateFilter)
-> Lens UpdateFilter UpdateFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Text
detectorId :: Text
$sel:detectorId:UpdateFilter' :: UpdateFilter -> Text
detectorId} -> Text
detectorId) (\s :: UpdateFilter
s@UpdateFilter' {} Text
a -> UpdateFilter
s {$sel:detectorId:UpdateFilter' :: Text
detectorId = Text
a} :: UpdateFilter)
updateFilter_filterName :: Lens.Lens' UpdateFilter Prelude.Text
updateFilter_filterName :: (Text -> f Text) -> UpdateFilter -> f UpdateFilter
updateFilter_filterName = (UpdateFilter -> Text)
-> (UpdateFilter -> Text -> UpdateFilter)
-> Lens UpdateFilter UpdateFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilter' {Text
filterName :: Text
$sel:filterName:UpdateFilter' :: UpdateFilter -> Text
filterName} -> Text
filterName) (\s :: UpdateFilter
s@UpdateFilter' {} Text
a -> UpdateFilter
s {$sel:filterName:UpdateFilter' :: Text
filterName = Text
a} :: UpdateFilter)
instance Core.AWSRequest UpdateFilter where
type AWSResponse UpdateFilter = UpdateFilterResponse
request :: UpdateFilter -> Request UpdateFilter
request = Service -> UpdateFilter -> Request UpdateFilter
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFilter)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateFilter))
-> Logger
-> Service
-> Proxy UpdateFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFilter)))
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 ->
Int -> Text -> UpdateFilterResponse
UpdateFilterResponse'
(Int -> Text -> UpdateFilterResponse)
-> Either String Int
-> Either String (Text -> UpdateFilterResponse)
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))
Either String (Text -> UpdateFilterResponse)
-> Either String Text -> Either String UpdateFilterResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"name")
)
instance Prelude.Hashable UpdateFilter
instance Prelude.NFData UpdateFilter
instance Core.ToHeaders UpdateFilter where
toHeaders :: UpdateFilter -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateFilter -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateFilter where
toJSON :: UpdateFilter -> Value
toJSON UpdateFilter' {Maybe Natural
Maybe Text
Maybe FilterAction
Maybe FindingCriteria
Text
filterName :: Text
detectorId :: Text
rank :: Maybe Natural
description :: Maybe Text
action :: Maybe FilterAction
findingCriteria :: Maybe FindingCriteria
$sel:filterName:UpdateFilter' :: UpdateFilter -> Text
$sel:detectorId:UpdateFilter' :: UpdateFilter -> Text
$sel:rank:UpdateFilter' :: UpdateFilter -> Maybe Natural
$sel:description:UpdateFilter' :: UpdateFilter -> Maybe Text
$sel:action:UpdateFilter' :: UpdateFilter -> Maybe FilterAction
$sel:findingCriteria:UpdateFilter' :: UpdateFilter -> Maybe FindingCriteria
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"findingCriteria" Text -> FindingCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FindingCriteria -> Pair) -> Maybe FindingCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingCriteria
findingCriteria,
(Text
"action" Text -> FilterAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FilterAction -> Pair) -> Maybe FilterAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterAction
action,
(Text
"description" 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
description,
(Text
"rank" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
rank
]
)
instance Core.ToPath UpdateFilter where
toPath :: UpdateFilter -> ByteString
toPath UpdateFilter' {Maybe Natural
Maybe Text
Maybe FilterAction
Maybe FindingCriteria
Text
filterName :: Text
detectorId :: Text
rank :: Maybe Natural
description :: Maybe Text
action :: Maybe FilterAction
findingCriteria :: Maybe FindingCriteria
$sel:filterName:UpdateFilter' :: UpdateFilter -> Text
$sel:detectorId:UpdateFilter' :: UpdateFilter -> Text
$sel:rank:UpdateFilter' :: UpdateFilter -> Maybe Natural
$sel:description:UpdateFilter' :: UpdateFilter -> Maybe Text
$sel:action:UpdateFilter' :: UpdateFilter -> Maybe FilterAction
$sel:findingCriteria:UpdateFilter' :: UpdateFilter -> Maybe FindingCriteria
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/filter/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
filterName
]
instance Core.ToQuery UpdateFilter where
toQuery :: UpdateFilter -> QueryString
toQuery = QueryString -> UpdateFilter -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFilterResponse = UpdateFilterResponse'
{
UpdateFilterResponse -> Int
httpStatus :: Prelude.Int,
UpdateFilterResponse -> Text
name :: Prelude.Text
}
deriving (UpdateFilterResponse -> UpdateFilterResponse -> Bool
(UpdateFilterResponse -> UpdateFilterResponse -> Bool)
-> (UpdateFilterResponse -> UpdateFilterResponse -> Bool)
-> Eq UpdateFilterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFilterResponse -> UpdateFilterResponse -> Bool
$c/= :: UpdateFilterResponse -> UpdateFilterResponse -> Bool
== :: UpdateFilterResponse -> UpdateFilterResponse -> Bool
$c== :: UpdateFilterResponse -> UpdateFilterResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFilterResponse]
ReadPrec UpdateFilterResponse
Int -> ReadS UpdateFilterResponse
ReadS [UpdateFilterResponse]
(Int -> ReadS UpdateFilterResponse)
-> ReadS [UpdateFilterResponse]
-> ReadPrec UpdateFilterResponse
-> ReadPrec [UpdateFilterResponse]
-> Read UpdateFilterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFilterResponse]
$creadListPrec :: ReadPrec [UpdateFilterResponse]
readPrec :: ReadPrec UpdateFilterResponse
$creadPrec :: ReadPrec UpdateFilterResponse
readList :: ReadS [UpdateFilterResponse]
$creadList :: ReadS [UpdateFilterResponse]
readsPrec :: Int -> ReadS UpdateFilterResponse
$creadsPrec :: Int -> ReadS UpdateFilterResponse
Prelude.Read, Int -> UpdateFilterResponse -> ShowS
[UpdateFilterResponse] -> ShowS
UpdateFilterResponse -> String
(Int -> UpdateFilterResponse -> ShowS)
-> (UpdateFilterResponse -> String)
-> ([UpdateFilterResponse] -> ShowS)
-> Show UpdateFilterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFilterResponse] -> ShowS
$cshowList :: [UpdateFilterResponse] -> ShowS
show :: UpdateFilterResponse -> String
$cshow :: UpdateFilterResponse -> String
showsPrec :: Int -> UpdateFilterResponse -> ShowS
$cshowsPrec :: Int -> UpdateFilterResponse -> ShowS
Prelude.Show, (forall x. UpdateFilterResponse -> Rep UpdateFilterResponse x)
-> (forall x. Rep UpdateFilterResponse x -> UpdateFilterResponse)
-> Generic UpdateFilterResponse
forall x. Rep UpdateFilterResponse x -> UpdateFilterResponse
forall x. UpdateFilterResponse -> Rep UpdateFilterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFilterResponse x -> UpdateFilterResponse
$cfrom :: forall x. UpdateFilterResponse -> Rep UpdateFilterResponse x
Prelude.Generic)
newUpdateFilterResponse ::
Prelude.Int ->
Prelude.Text ->
UpdateFilterResponse
newUpdateFilterResponse :: Int -> Text -> UpdateFilterResponse
newUpdateFilterResponse Int
pHttpStatus_ Text
pName_ =
UpdateFilterResponse' :: Int -> Text -> UpdateFilterResponse
UpdateFilterResponse'
{ $sel:httpStatus:UpdateFilterResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:UpdateFilterResponse' :: Text
name = Text
pName_
}
updateFilterResponse_httpStatus :: Lens.Lens' UpdateFilterResponse Prelude.Int
updateFilterResponse_httpStatus :: (Int -> f Int) -> UpdateFilterResponse -> f UpdateFilterResponse
updateFilterResponse_httpStatus = (UpdateFilterResponse -> Int)
-> (UpdateFilterResponse -> Int -> UpdateFilterResponse)
-> Lens UpdateFilterResponse UpdateFilterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilterResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFilterResponse' :: UpdateFilterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFilterResponse
s@UpdateFilterResponse' {} Int
a -> UpdateFilterResponse
s {$sel:httpStatus:UpdateFilterResponse' :: Int
httpStatus = Int
a} :: UpdateFilterResponse)
updateFilterResponse_name :: Lens.Lens' UpdateFilterResponse Prelude.Text
updateFilterResponse_name :: (Text -> f Text) -> UpdateFilterResponse -> f UpdateFilterResponse
updateFilterResponse_name = (UpdateFilterResponse -> Text)
-> (UpdateFilterResponse -> Text -> UpdateFilterResponse)
-> Lens UpdateFilterResponse UpdateFilterResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFilterResponse' {Text
name :: Text
$sel:name:UpdateFilterResponse' :: UpdateFilterResponse -> Text
name} -> Text
name) (\s :: UpdateFilterResponse
s@UpdateFilterResponse' {} Text
a -> UpdateFilterResponse
s {$sel:name:UpdateFilterResponse' :: Text
name = Text
a} :: UpdateFilterResponse)
instance Prelude.NFData UpdateFilterResponse