{-# 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.SecurityHub.UpdateInsight
(
UpdateInsight (..),
newUpdateInsight,
updateInsight_groupByAttribute,
updateInsight_filters,
updateInsight_name,
updateInsight_insightArn,
UpdateInsightResponse (..),
newUpdateInsightResponse,
updateInsightResponse_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.SecurityHub.Types
data UpdateInsight = UpdateInsight'
{
UpdateInsight -> Maybe Text
groupByAttribute :: Prelude.Maybe Prelude.Text,
UpdateInsight -> Maybe AwsSecurityFindingFilters
filters :: Prelude.Maybe AwsSecurityFindingFilters,
UpdateInsight -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateInsight -> Text
insightArn :: Prelude.Text
}
deriving (UpdateInsight -> UpdateInsight -> Bool
(UpdateInsight -> UpdateInsight -> Bool)
-> (UpdateInsight -> UpdateInsight -> Bool) -> Eq UpdateInsight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInsight -> UpdateInsight -> Bool
$c/= :: UpdateInsight -> UpdateInsight -> Bool
== :: UpdateInsight -> UpdateInsight -> Bool
$c== :: UpdateInsight -> UpdateInsight -> Bool
Prelude.Eq, ReadPrec [UpdateInsight]
ReadPrec UpdateInsight
Int -> ReadS UpdateInsight
ReadS [UpdateInsight]
(Int -> ReadS UpdateInsight)
-> ReadS [UpdateInsight]
-> ReadPrec UpdateInsight
-> ReadPrec [UpdateInsight]
-> Read UpdateInsight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInsight]
$creadListPrec :: ReadPrec [UpdateInsight]
readPrec :: ReadPrec UpdateInsight
$creadPrec :: ReadPrec UpdateInsight
readList :: ReadS [UpdateInsight]
$creadList :: ReadS [UpdateInsight]
readsPrec :: Int -> ReadS UpdateInsight
$creadsPrec :: Int -> ReadS UpdateInsight
Prelude.Read, Int -> UpdateInsight -> ShowS
[UpdateInsight] -> ShowS
UpdateInsight -> String
(Int -> UpdateInsight -> ShowS)
-> (UpdateInsight -> String)
-> ([UpdateInsight] -> ShowS)
-> Show UpdateInsight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInsight] -> ShowS
$cshowList :: [UpdateInsight] -> ShowS
show :: UpdateInsight -> String
$cshow :: UpdateInsight -> String
showsPrec :: Int -> UpdateInsight -> ShowS
$cshowsPrec :: Int -> UpdateInsight -> ShowS
Prelude.Show, (forall x. UpdateInsight -> Rep UpdateInsight x)
-> (forall x. Rep UpdateInsight x -> UpdateInsight)
-> Generic UpdateInsight
forall x. Rep UpdateInsight x -> UpdateInsight
forall x. UpdateInsight -> Rep UpdateInsight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInsight x -> UpdateInsight
$cfrom :: forall x. UpdateInsight -> Rep UpdateInsight x
Prelude.Generic)
newUpdateInsight ::
Prelude.Text ->
UpdateInsight
newUpdateInsight :: Text -> UpdateInsight
newUpdateInsight Text
pInsightArn_ =
UpdateInsight' :: Maybe Text
-> Maybe AwsSecurityFindingFilters
-> Maybe Text
-> Text
-> UpdateInsight
UpdateInsight'
{ $sel:groupByAttribute:UpdateInsight' :: Maybe Text
groupByAttribute = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:filters:UpdateInsight' :: Maybe AwsSecurityFindingFilters
filters = Maybe AwsSecurityFindingFilters
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateInsight' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:insightArn:UpdateInsight' :: Text
insightArn = Text
pInsightArn_
}
updateInsight_groupByAttribute :: Lens.Lens' UpdateInsight (Prelude.Maybe Prelude.Text)
updateInsight_groupByAttribute :: (Maybe Text -> f (Maybe Text)) -> UpdateInsight -> f UpdateInsight
updateInsight_groupByAttribute = (UpdateInsight -> Maybe Text)
-> (UpdateInsight -> Maybe Text -> UpdateInsight)
-> Lens UpdateInsight UpdateInsight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInsight' {Maybe Text
groupByAttribute :: Maybe Text
$sel:groupByAttribute:UpdateInsight' :: UpdateInsight -> Maybe Text
groupByAttribute} -> Maybe Text
groupByAttribute) (\s :: UpdateInsight
s@UpdateInsight' {} Maybe Text
a -> UpdateInsight
s {$sel:groupByAttribute:UpdateInsight' :: Maybe Text
groupByAttribute = Maybe Text
a} :: UpdateInsight)
updateInsight_filters :: Lens.Lens' UpdateInsight (Prelude.Maybe AwsSecurityFindingFilters)
updateInsight_filters :: (Maybe AwsSecurityFindingFilters
-> f (Maybe AwsSecurityFindingFilters))
-> UpdateInsight -> f UpdateInsight
updateInsight_filters = (UpdateInsight -> Maybe AwsSecurityFindingFilters)
-> (UpdateInsight
-> Maybe AwsSecurityFindingFilters -> UpdateInsight)
-> Lens
UpdateInsight
UpdateInsight
(Maybe AwsSecurityFindingFilters)
(Maybe AwsSecurityFindingFilters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInsight' {Maybe AwsSecurityFindingFilters
filters :: Maybe AwsSecurityFindingFilters
$sel:filters:UpdateInsight' :: UpdateInsight -> Maybe AwsSecurityFindingFilters
filters} -> Maybe AwsSecurityFindingFilters
filters) (\s :: UpdateInsight
s@UpdateInsight' {} Maybe AwsSecurityFindingFilters
a -> UpdateInsight
s {$sel:filters:UpdateInsight' :: Maybe AwsSecurityFindingFilters
filters = Maybe AwsSecurityFindingFilters
a} :: UpdateInsight)
updateInsight_name :: Lens.Lens' UpdateInsight (Prelude.Maybe Prelude.Text)
updateInsight_name :: (Maybe Text -> f (Maybe Text)) -> UpdateInsight -> f UpdateInsight
updateInsight_name = (UpdateInsight -> Maybe Text)
-> (UpdateInsight -> Maybe Text -> UpdateInsight)
-> Lens UpdateInsight UpdateInsight (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInsight' {Maybe Text
name :: Maybe Text
$sel:name:UpdateInsight' :: UpdateInsight -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateInsight
s@UpdateInsight' {} Maybe Text
a -> UpdateInsight
s {$sel:name:UpdateInsight' :: Maybe Text
name = Maybe Text
a} :: UpdateInsight)
updateInsight_insightArn :: Lens.Lens' UpdateInsight Prelude.Text
updateInsight_insightArn :: (Text -> f Text) -> UpdateInsight -> f UpdateInsight
updateInsight_insightArn = (UpdateInsight -> Text)
-> (UpdateInsight -> Text -> UpdateInsight)
-> Lens UpdateInsight UpdateInsight Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInsight' {Text
insightArn :: Text
$sel:insightArn:UpdateInsight' :: UpdateInsight -> Text
insightArn} -> Text
insightArn) (\s :: UpdateInsight
s@UpdateInsight' {} Text
a -> UpdateInsight
s {$sel:insightArn:UpdateInsight' :: Text
insightArn = Text
a} :: UpdateInsight)
instance Core.AWSRequest UpdateInsight where
type
AWSResponse UpdateInsight =
UpdateInsightResponse
request :: UpdateInsight -> Request UpdateInsight
request = Service -> UpdateInsight -> Request UpdateInsight
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateInsight
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateInsight)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateInsight))
-> Logger
-> Service
-> Proxy UpdateInsight
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateInsight)))
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 -> UpdateInsightResponse
UpdateInsightResponse'
(Int -> UpdateInsightResponse)
-> Either String Int -> Either String UpdateInsightResponse
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 UpdateInsight
instance Prelude.NFData UpdateInsight
instance Core.ToHeaders UpdateInsight where
toHeaders :: UpdateInsight -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateInsight -> 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 UpdateInsight where
toJSON :: UpdateInsight -> Value
toJSON UpdateInsight' {Maybe Text
Maybe AwsSecurityFindingFilters
Text
insightArn :: Text
name :: Maybe Text
filters :: Maybe AwsSecurityFindingFilters
groupByAttribute :: Maybe Text
$sel:insightArn:UpdateInsight' :: UpdateInsight -> Text
$sel:name:UpdateInsight' :: UpdateInsight -> Maybe Text
$sel:filters:UpdateInsight' :: UpdateInsight -> Maybe AwsSecurityFindingFilters
$sel:groupByAttribute:UpdateInsight' :: UpdateInsight -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"GroupByAttribute" 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
groupByAttribute,
(Text
"Filters" Text -> AwsSecurityFindingFilters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsSecurityFindingFilters -> Pair)
-> Maybe AwsSecurityFindingFilters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsSecurityFindingFilters
filters,
(Text
"Name" 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
name
]
)
instance Core.ToPath UpdateInsight where
toPath :: UpdateInsight -> ByteString
toPath UpdateInsight' {Maybe Text
Maybe AwsSecurityFindingFilters
Text
insightArn :: Text
name :: Maybe Text
filters :: Maybe AwsSecurityFindingFilters
groupByAttribute :: Maybe Text
$sel:insightArn:UpdateInsight' :: UpdateInsight -> Text
$sel:name:UpdateInsight' :: UpdateInsight -> Maybe Text
$sel:filters:UpdateInsight' :: UpdateInsight -> Maybe AwsSecurityFindingFilters
$sel:groupByAttribute:UpdateInsight' :: UpdateInsight -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/insights/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
insightArn]
instance Core.ToQuery UpdateInsight where
toQuery :: UpdateInsight -> QueryString
toQuery = QueryString -> UpdateInsight -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateInsightResponse = UpdateInsightResponse'
{
UpdateInsightResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateInsightResponse -> UpdateInsightResponse -> Bool
(UpdateInsightResponse -> UpdateInsightResponse -> Bool)
-> (UpdateInsightResponse -> UpdateInsightResponse -> Bool)
-> Eq UpdateInsightResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInsightResponse -> UpdateInsightResponse -> Bool
$c/= :: UpdateInsightResponse -> UpdateInsightResponse -> Bool
== :: UpdateInsightResponse -> UpdateInsightResponse -> Bool
$c== :: UpdateInsightResponse -> UpdateInsightResponse -> Bool
Prelude.Eq, ReadPrec [UpdateInsightResponse]
ReadPrec UpdateInsightResponse
Int -> ReadS UpdateInsightResponse
ReadS [UpdateInsightResponse]
(Int -> ReadS UpdateInsightResponse)
-> ReadS [UpdateInsightResponse]
-> ReadPrec UpdateInsightResponse
-> ReadPrec [UpdateInsightResponse]
-> Read UpdateInsightResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInsightResponse]
$creadListPrec :: ReadPrec [UpdateInsightResponse]
readPrec :: ReadPrec UpdateInsightResponse
$creadPrec :: ReadPrec UpdateInsightResponse
readList :: ReadS [UpdateInsightResponse]
$creadList :: ReadS [UpdateInsightResponse]
readsPrec :: Int -> ReadS UpdateInsightResponse
$creadsPrec :: Int -> ReadS UpdateInsightResponse
Prelude.Read, Int -> UpdateInsightResponse -> ShowS
[UpdateInsightResponse] -> ShowS
UpdateInsightResponse -> String
(Int -> UpdateInsightResponse -> ShowS)
-> (UpdateInsightResponse -> String)
-> ([UpdateInsightResponse] -> ShowS)
-> Show UpdateInsightResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInsightResponse] -> ShowS
$cshowList :: [UpdateInsightResponse] -> ShowS
show :: UpdateInsightResponse -> String
$cshow :: UpdateInsightResponse -> String
showsPrec :: Int -> UpdateInsightResponse -> ShowS
$cshowsPrec :: Int -> UpdateInsightResponse -> ShowS
Prelude.Show, (forall x. UpdateInsightResponse -> Rep UpdateInsightResponse x)
-> (forall x. Rep UpdateInsightResponse x -> UpdateInsightResponse)
-> Generic UpdateInsightResponse
forall x. Rep UpdateInsightResponse x -> UpdateInsightResponse
forall x. UpdateInsightResponse -> Rep UpdateInsightResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInsightResponse x -> UpdateInsightResponse
$cfrom :: forall x. UpdateInsightResponse -> Rep UpdateInsightResponse x
Prelude.Generic)
newUpdateInsightResponse ::
Prelude.Int ->
UpdateInsightResponse
newUpdateInsightResponse :: Int -> UpdateInsightResponse
newUpdateInsightResponse Int
pHttpStatus_ =
UpdateInsightResponse' :: Int -> UpdateInsightResponse
UpdateInsightResponse' {$sel:httpStatus:UpdateInsightResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateInsightResponse_httpStatus :: Lens.Lens' UpdateInsightResponse Prelude.Int
updateInsightResponse_httpStatus :: (Int -> f Int) -> UpdateInsightResponse -> f UpdateInsightResponse
updateInsightResponse_httpStatus = (UpdateInsightResponse -> Int)
-> (UpdateInsightResponse -> Int -> UpdateInsightResponse)
-> Lens UpdateInsightResponse UpdateInsightResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInsightResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateInsightResponse' :: UpdateInsightResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateInsightResponse
s@UpdateInsightResponse' {} Int
a -> UpdateInsightResponse
s {$sel:httpStatus:UpdateInsightResponse' :: Int
httpStatus = Int
a} :: UpdateInsightResponse)
instance Prelude.NFData UpdateInsightResponse