{-# 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.CloudTrail.PutInsightSelectors
(
PutInsightSelectors (..),
newPutInsightSelectors,
putInsightSelectors_trailName,
putInsightSelectors_insightSelectors,
PutInsightSelectorsResponse (..),
newPutInsightSelectorsResponse,
putInsightSelectorsResponse_trailARN,
putInsightSelectorsResponse_insightSelectors,
putInsightSelectorsResponse_httpStatus,
)
where
import Amazonka.CloudTrail.Types
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
data PutInsightSelectors = PutInsightSelectors'
{
PutInsightSelectors -> Text
trailName :: Prelude.Text,
PutInsightSelectors -> [InsightSelector]
insightSelectors :: [InsightSelector]
}
deriving (PutInsightSelectors -> PutInsightSelectors -> Bool
(PutInsightSelectors -> PutInsightSelectors -> Bool)
-> (PutInsightSelectors -> PutInsightSelectors -> Bool)
-> Eq PutInsightSelectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInsightSelectors -> PutInsightSelectors -> Bool
$c/= :: PutInsightSelectors -> PutInsightSelectors -> Bool
== :: PutInsightSelectors -> PutInsightSelectors -> Bool
$c== :: PutInsightSelectors -> PutInsightSelectors -> Bool
Prelude.Eq, ReadPrec [PutInsightSelectors]
ReadPrec PutInsightSelectors
Int -> ReadS PutInsightSelectors
ReadS [PutInsightSelectors]
(Int -> ReadS PutInsightSelectors)
-> ReadS [PutInsightSelectors]
-> ReadPrec PutInsightSelectors
-> ReadPrec [PutInsightSelectors]
-> Read PutInsightSelectors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInsightSelectors]
$creadListPrec :: ReadPrec [PutInsightSelectors]
readPrec :: ReadPrec PutInsightSelectors
$creadPrec :: ReadPrec PutInsightSelectors
readList :: ReadS [PutInsightSelectors]
$creadList :: ReadS [PutInsightSelectors]
readsPrec :: Int -> ReadS PutInsightSelectors
$creadsPrec :: Int -> ReadS PutInsightSelectors
Prelude.Read, Int -> PutInsightSelectors -> ShowS
[PutInsightSelectors] -> ShowS
PutInsightSelectors -> String
(Int -> PutInsightSelectors -> ShowS)
-> (PutInsightSelectors -> String)
-> ([PutInsightSelectors] -> ShowS)
-> Show PutInsightSelectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInsightSelectors] -> ShowS
$cshowList :: [PutInsightSelectors] -> ShowS
show :: PutInsightSelectors -> String
$cshow :: PutInsightSelectors -> String
showsPrec :: Int -> PutInsightSelectors -> ShowS
$cshowsPrec :: Int -> PutInsightSelectors -> ShowS
Prelude.Show, (forall x. PutInsightSelectors -> Rep PutInsightSelectors x)
-> (forall x. Rep PutInsightSelectors x -> PutInsightSelectors)
-> Generic PutInsightSelectors
forall x. Rep PutInsightSelectors x -> PutInsightSelectors
forall x. PutInsightSelectors -> Rep PutInsightSelectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInsightSelectors x -> PutInsightSelectors
$cfrom :: forall x. PutInsightSelectors -> Rep PutInsightSelectors x
Prelude.Generic)
newPutInsightSelectors ::
Prelude.Text ->
PutInsightSelectors
newPutInsightSelectors :: Text -> PutInsightSelectors
newPutInsightSelectors Text
pTrailName_ =
PutInsightSelectors' :: Text -> [InsightSelector] -> PutInsightSelectors
PutInsightSelectors'
{ $sel:trailName:PutInsightSelectors' :: Text
trailName = Text
pTrailName_,
$sel:insightSelectors:PutInsightSelectors' :: [InsightSelector]
insightSelectors = [InsightSelector]
forall a. Monoid a => a
Prelude.mempty
}
putInsightSelectors_trailName :: Lens.Lens' PutInsightSelectors Prelude.Text
putInsightSelectors_trailName :: (Text -> f Text) -> PutInsightSelectors -> f PutInsightSelectors
putInsightSelectors_trailName = (PutInsightSelectors -> Text)
-> (PutInsightSelectors -> Text -> PutInsightSelectors)
-> Lens PutInsightSelectors PutInsightSelectors Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightSelectors' {Text
trailName :: Text
$sel:trailName:PutInsightSelectors' :: PutInsightSelectors -> Text
trailName} -> Text
trailName) (\s :: PutInsightSelectors
s@PutInsightSelectors' {} Text
a -> PutInsightSelectors
s {$sel:trailName:PutInsightSelectors' :: Text
trailName = Text
a} :: PutInsightSelectors)
putInsightSelectors_insightSelectors :: Lens.Lens' PutInsightSelectors [InsightSelector]
putInsightSelectors_insightSelectors :: ([InsightSelector] -> f [InsightSelector])
-> PutInsightSelectors -> f PutInsightSelectors
putInsightSelectors_insightSelectors = (PutInsightSelectors -> [InsightSelector])
-> (PutInsightSelectors
-> [InsightSelector] -> PutInsightSelectors)
-> Lens
PutInsightSelectors
PutInsightSelectors
[InsightSelector]
[InsightSelector]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightSelectors' {[InsightSelector]
insightSelectors :: [InsightSelector]
$sel:insightSelectors:PutInsightSelectors' :: PutInsightSelectors -> [InsightSelector]
insightSelectors} -> [InsightSelector]
insightSelectors) (\s :: PutInsightSelectors
s@PutInsightSelectors' {} [InsightSelector]
a -> PutInsightSelectors
s {$sel:insightSelectors:PutInsightSelectors' :: [InsightSelector]
insightSelectors = [InsightSelector]
a} :: PutInsightSelectors) (([InsightSelector] -> f [InsightSelector])
-> PutInsightSelectors -> f PutInsightSelectors)
-> (([InsightSelector] -> f [InsightSelector])
-> [InsightSelector] -> f [InsightSelector])
-> ([InsightSelector] -> f [InsightSelector])
-> PutInsightSelectors
-> f PutInsightSelectors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([InsightSelector] -> f [InsightSelector])
-> [InsightSelector] -> f [InsightSelector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutInsightSelectors where
type
AWSResponse PutInsightSelectors =
PutInsightSelectorsResponse
request :: PutInsightSelectors -> Request PutInsightSelectors
request = Service -> PutInsightSelectors -> Request PutInsightSelectors
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutInsightSelectors
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutInsightSelectors)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutInsightSelectors))
-> Logger
-> Service
-> Proxy PutInsightSelectors
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutInsightSelectors)))
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 Text
-> Maybe [InsightSelector] -> Int -> PutInsightSelectorsResponse
PutInsightSelectorsResponse'
(Maybe Text
-> Maybe [InsightSelector] -> Int -> PutInsightSelectorsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [InsightSelector] -> Int -> PutInsightSelectorsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TrailARN")
Either
String
(Maybe [InsightSelector] -> Int -> PutInsightSelectorsResponse)
-> Either String (Maybe [InsightSelector])
-> Either String (Int -> PutInsightSelectorsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [InsightSelector]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InsightSelectors"
Either String (Maybe (Maybe [InsightSelector]))
-> Maybe [InsightSelector]
-> Either String (Maybe [InsightSelector])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [InsightSelector]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> PutInsightSelectorsResponse)
-> Either String Int -> Either String PutInsightSelectorsResponse
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 PutInsightSelectors
instance Prelude.NFData PutInsightSelectors
instance Core.ToHeaders PutInsightSelectors where
toHeaders :: PutInsightSelectors -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutInsightSelectors -> 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
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.PutInsightSelectors" ::
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 PutInsightSelectors where
toJSON :: PutInsightSelectors -> Value
toJSON PutInsightSelectors' {[InsightSelector]
Text
insightSelectors :: [InsightSelector]
trailName :: Text
$sel:insightSelectors:PutInsightSelectors' :: PutInsightSelectors -> [InsightSelector]
$sel:trailName:PutInsightSelectors' :: PutInsightSelectors -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrailName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trailName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"InsightSelectors" Text -> [InsightSelector] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [InsightSelector]
insightSelectors)
]
)
instance Core.ToPath PutInsightSelectors where
toPath :: PutInsightSelectors -> ByteString
toPath = ByteString -> PutInsightSelectors -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutInsightSelectors where
toQuery :: PutInsightSelectors -> QueryString
toQuery = QueryString -> PutInsightSelectors -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutInsightSelectorsResponse = PutInsightSelectorsResponse'
{
PutInsightSelectorsResponse -> Maybe Text
trailARN :: Prelude.Maybe Prelude.Text,
PutInsightSelectorsResponse -> Maybe [InsightSelector]
insightSelectors :: Prelude.Maybe [InsightSelector],
PutInsightSelectorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutInsightSelectorsResponse -> PutInsightSelectorsResponse -> Bool
(PutInsightSelectorsResponse
-> PutInsightSelectorsResponse -> Bool)
-> (PutInsightSelectorsResponse
-> PutInsightSelectorsResponse -> Bool)
-> Eq PutInsightSelectorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInsightSelectorsResponse -> PutInsightSelectorsResponse -> Bool
$c/= :: PutInsightSelectorsResponse -> PutInsightSelectorsResponse -> Bool
== :: PutInsightSelectorsResponse -> PutInsightSelectorsResponse -> Bool
$c== :: PutInsightSelectorsResponse -> PutInsightSelectorsResponse -> Bool
Prelude.Eq, ReadPrec [PutInsightSelectorsResponse]
ReadPrec PutInsightSelectorsResponse
Int -> ReadS PutInsightSelectorsResponse
ReadS [PutInsightSelectorsResponse]
(Int -> ReadS PutInsightSelectorsResponse)
-> ReadS [PutInsightSelectorsResponse]
-> ReadPrec PutInsightSelectorsResponse
-> ReadPrec [PutInsightSelectorsResponse]
-> Read PutInsightSelectorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInsightSelectorsResponse]
$creadListPrec :: ReadPrec [PutInsightSelectorsResponse]
readPrec :: ReadPrec PutInsightSelectorsResponse
$creadPrec :: ReadPrec PutInsightSelectorsResponse
readList :: ReadS [PutInsightSelectorsResponse]
$creadList :: ReadS [PutInsightSelectorsResponse]
readsPrec :: Int -> ReadS PutInsightSelectorsResponse
$creadsPrec :: Int -> ReadS PutInsightSelectorsResponse
Prelude.Read, Int -> PutInsightSelectorsResponse -> ShowS
[PutInsightSelectorsResponse] -> ShowS
PutInsightSelectorsResponse -> String
(Int -> PutInsightSelectorsResponse -> ShowS)
-> (PutInsightSelectorsResponse -> String)
-> ([PutInsightSelectorsResponse] -> ShowS)
-> Show PutInsightSelectorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInsightSelectorsResponse] -> ShowS
$cshowList :: [PutInsightSelectorsResponse] -> ShowS
show :: PutInsightSelectorsResponse -> String
$cshow :: PutInsightSelectorsResponse -> String
showsPrec :: Int -> PutInsightSelectorsResponse -> ShowS
$cshowsPrec :: Int -> PutInsightSelectorsResponse -> ShowS
Prelude.Show, (forall x.
PutInsightSelectorsResponse -> Rep PutInsightSelectorsResponse x)
-> (forall x.
Rep PutInsightSelectorsResponse x -> PutInsightSelectorsResponse)
-> Generic PutInsightSelectorsResponse
forall x.
Rep PutInsightSelectorsResponse x -> PutInsightSelectorsResponse
forall x.
PutInsightSelectorsResponse -> Rep PutInsightSelectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutInsightSelectorsResponse x -> PutInsightSelectorsResponse
$cfrom :: forall x.
PutInsightSelectorsResponse -> Rep PutInsightSelectorsResponse x
Prelude.Generic)
newPutInsightSelectorsResponse ::
Prelude.Int ->
PutInsightSelectorsResponse
newPutInsightSelectorsResponse :: Int -> PutInsightSelectorsResponse
newPutInsightSelectorsResponse Int
pHttpStatus_ =
PutInsightSelectorsResponse' :: Maybe Text
-> Maybe [InsightSelector] -> Int -> PutInsightSelectorsResponse
PutInsightSelectorsResponse'
{ $sel:trailARN:PutInsightSelectorsResponse' :: Maybe Text
trailARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:insightSelectors:PutInsightSelectorsResponse' :: Maybe [InsightSelector]
insightSelectors = Maybe [InsightSelector]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutInsightSelectorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putInsightSelectorsResponse_trailARN :: Lens.Lens' PutInsightSelectorsResponse (Prelude.Maybe Prelude.Text)
putInsightSelectorsResponse_trailARN :: (Maybe Text -> f (Maybe Text))
-> PutInsightSelectorsResponse -> f PutInsightSelectorsResponse
putInsightSelectorsResponse_trailARN = (PutInsightSelectorsResponse -> Maybe Text)
-> (PutInsightSelectorsResponse
-> Maybe Text -> PutInsightSelectorsResponse)
-> Lens
PutInsightSelectorsResponse
PutInsightSelectorsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightSelectorsResponse' {Maybe Text
trailARN :: Maybe Text
$sel:trailARN:PutInsightSelectorsResponse' :: PutInsightSelectorsResponse -> Maybe Text
trailARN} -> Maybe Text
trailARN) (\s :: PutInsightSelectorsResponse
s@PutInsightSelectorsResponse' {} Maybe Text
a -> PutInsightSelectorsResponse
s {$sel:trailARN:PutInsightSelectorsResponse' :: Maybe Text
trailARN = Maybe Text
a} :: PutInsightSelectorsResponse)
putInsightSelectorsResponse_insightSelectors :: Lens.Lens' PutInsightSelectorsResponse (Prelude.Maybe [InsightSelector])
putInsightSelectorsResponse_insightSelectors :: (Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> PutInsightSelectorsResponse -> f PutInsightSelectorsResponse
putInsightSelectorsResponse_insightSelectors = (PutInsightSelectorsResponse -> Maybe [InsightSelector])
-> (PutInsightSelectorsResponse
-> Maybe [InsightSelector] -> PutInsightSelectorsResponse)
-> Lens
PutInsightSelectorsResponse
PutInsightSelectorsResponse
(Maybe [InsightSelector])
(Maybe [InsightSelector])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightSelectorsResponse' {Maybe [InsightSelector]
insightSelectors :: Maybe [InsightSelector]
$sel:insightSelectors:PutInsightSelectorsResponse' :: PutInsightSelectorsResponse -> Maybe [InsightSelector]
insightSelectors} -> Maybe [InsightSelector]
insightSelectors) (\s :: PutInsightSelectorsResponse
s@PutInsightSelectorsResponse' {} Maybe [InsightSelector]
a -> PutInsightSelectorsResponse
s {$sel:insightSelectors:PutInsightSelectorsResponse' :: Maybe [InsightSelector]
insightSelectors = Maybe [InsightSelector]
a} :: PutInsightSelectorsResponse) ((Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> PutInsightSelectorsResponse -> f PutInsightSelectorsResponse)
-> ((Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> (Maybe [InsightSelector] -> f (Maybe [InsightSelector]))
-> PutInsightSelectorsResponse
-> f PutInsightSelectorsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[InsightSelector]
[InsightSelector]
[InsightSelector]
[InsightSelector]
-> Iso
(Maybe [InsightSelector])
(Maybe [InsightSelector])
(Maybe [InsightSelector])
(Maybe [InsightSelector])
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
[InsightSelector]
[InsightSelector]
[InsightSelector]
[InsightSelector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putInsightSelectorsResponse_httpStatus :: Lens.Lens' PutInsightSelectorsResponse Prelude.Int
putInsightSelectorsResponse_httpStatus :: (Int -> f Int)
-> PutInsightSelectorsResponse -> f PutInsightSelectorsResponse
putInsightSelectorsResponse_httpStatus = (PutInsightSelectorsResponse -> Int)
-> (PutInsightSelectorsResponse
-> Int -> PutInsightSelectorsResponse)
-> Lens
PutInsightSelectorsResponse PutInsightSelectorsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightSelectorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInsightSelectorsResponse' :: PutInsightSelectorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutInsightSelectorsResponse
s@PutInsightSelectorsResponse' {} Int
a -> PutInsightSelectorsResponse
s {$sel:httpStatus:PutInsightSelectorsResponse' :: Int
httpStatus = Int
a} :: PutInsightSelectorsResponse)
instance Prelude.NFData PutInsightSelectorsResponse