{-# 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.Macie.UpdateS3Resources
(
UpdateS3Resources (..),
newUpdateS3Resources,
updateS3Resources_memberAccountId,
updateS3Resources_s3ResourcesUpdate,
UpdateS3ResourcesResponse (..),
newUpdateS3ResourcesResponse,
updateS3ResourcesResponse_failedS3Resources,
updateS3ResourcesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Macie.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateS3Resources = UpdateS3Resources'
{
UpdateS3Resources -> Maybe Text
memberAccountId :: Prelude.Maybe Prelude.Text,
UpdateS3Resources -> [S3ResourceClassificationUpdate]
s3ResourcesUpdate :: [S3ResourceClassificationUpdate]
}
deriving (UpdateS3Resources -> UpdateS3Resources -> Bool
(UpdateS3Resources -> UpdateS3Resources -> Bool)
-> (UpdateS3Resources -> UpdateS3Resources -> Bool)
-> Eq UpdateS3Resources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateS3Resources -> UpdateS3Resources -> Bool
$c/= :: UpdateS3Resources -> UpdateS3Resources -> Bool
== :: UpdateS3Resources -> UpdateS3Resources -> Bool
$c== :: UpdateS3Resources -> UpdateS3Resources -> Bool
Prelude.Eq, ReadPrec [UpdateS3Resources]
ReadPrec UpdateS3Resources
Int -> ReadS UpdateS3Resources
ReadS [UpdateS3Resources]
(Int -> ReadS UpdateS3Resources)
-> ReadS [UpdateS3Resources]
-> ReadPrec UpdateS3Resources
-> ReadPrec [UpdateS3Resources]
-> Read UpdateS3Resources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateS3Resources]
$creadListPrec :: ReadPrec [UpdateS3Resources]
readPrec :: ReadPrec UpdateS3Resources
$creadPrec :: ReadPrec UpdateS3Resources
readList :: ReadS [UpdateS3Resources]
$creadList :: ReadS [UpdateS3Resources]
readsPrec :: Int -> ReadS UpdateS3Resources
$creadsPrec :: Int -> ReadS UpdateS3Resources
Prelude.Read, Int -> UpdateS3Resources -> ShowS
[UpdateS3Resources] -> ShowS
UpdateS3Resources -> String
(Int -> UpdateS3Resources -> ShowS)
-> (UpdateS3Resources -> String)
-> ([UpdateS3Resources] -> ShowS)
-> Show UpdateS3Resources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateS3Resources] -> ShowS
$cshowList :: [UpdateS3Resources] -> ShowS
show :: UpdateS3Resources -> String
$cshow :: UpdateS3Resources -> String
showsPrec :: Int -> UpdateS3Resources -> ShowS
$cshowsPrec :: Int -> UpdateS3Resources -> ShowS
Prelude.Show, (forall x. UpdateS3Resources -> Rep UpdateS3Resources x)
-> (forall x. Rep UpdateS3Resources x -> UpdateS3Resources)
-> Generic UpdateS3Resources
forall x. Rep UpdateS3Resources x -> UpdateS3Resources
forall x. UpdateS3Resources -> Rep UpdateS3Resources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateS3Resources x -> UpdateS3Resources
$cfrom :: forall x. UpdateS3Resources -> Rep UpdateS3Resources x
Prelude.Generic)
newUpdateS3Resources ::
UpdateS3Resources
newUpdateS3Resources :: UpdateS3Resources
newUpdateS3Resources =
UpdateS3Resources' :: Maybe Text -> [S3ResourceClassificationUpdate] -> UpdateS3Resources
UpdateS3Resources'
{ $sel:memberAccountId:UpdateS3Resources' :: Maybe Text
memberAccountId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:s3ResourcesUpdate:UpdateS3Resources' :: [S3ResourceClassificationUpdate]
s3ResourcesUpdate = [S3ResourceClassificationUpdate]
forall a. Monoid a => a
Prelude.mempty
}
updateS3Resources_memberAccountId :: Lens.Lens' UpdateS3Resources (Prelude.Maybe Prelude.Text)
updateS3Resources_memberAccountId :: (Maybe Text -> f (Maybe Text))
-> UpdateS3Resources -> f UpdateS3Resources
updateS3Resources_memberAccountId = (UpdateS3Resources -> Maybe Text)
-> (UpdateS3Resources -> Maybe Text -> UpdateS3Resources)
-> Lens
UpdateS3Resources UpdateS3Resources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateS3Resources' {Maybe Text
memberAccountId :: Maybe Text
$sel:memberAccountId:UpdateS3Resources' :: UpdateS3Resources -> Maybe Text
memberAccountId} -> Maybe Text
memberAccountId) (\s :: UpdateS3Resources
s@UpdateS3Resources' {} Maybe Text
a -> UpdateS3Resources
s {$sel:memberAccountId:UpdateS3Resources' :: Maybe Text
memberAccountId = Maybe Text
a} :: UpdateS3Resources)
updateS3Resources_s3ResourcesUpdate :: Lens.Lens' UpdateS3Resources [S3ResourceClassificationUpdate]
updateS3Resources_s3ResourcesUpdate :: ([S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> UpdateS3Resources -> f UpdateS3Resources
updateS3Resources_s3ResourcesUpdate = (UpdateS3Resources -> [S3ResourceClassificationUpdate])
-> (UpdateS3Resources
-> [S3ResourceClassificationUpdate] -> UpdateS3Resources)
-> Lens
UpdateS3Resources
UpdateS3Resources
[S3ResourceClassificationUpdate]
[S3ResourceClassificationUpdate]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateS3Resources' {[S3ResourceClassificationUpdate]
s3ResourcesUpdate :: [S3ResourceClassificationUpdate]
$sel:s3ResourcesUpdate:UpdateS3Resources' :: UpdateS3Resources -> [S3ResourceClassificationUpdate]
s3ResourcesUpdate} -> [S3ResourceClassificationUpdate]
s3ResourcesUpdate) (\s :: UpdateS3Resources
s@UpdateS3Resources' {} [S3ResourceClassificationUpdate]
a -> UpdateS3Resources
s {$sel:s3ResourcesUpdate:UpdateS3Resources' :: [S3ResourceClassificationUpdate]
s3ResourcesUpdate = [S3ResourceClassificationUpdate]
a} :: UpdateS3Resources) (([S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> UpdateS3Resources -> f UpdateS3Resources)
-> (([S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> [S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> ([S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> UpdateS3Resources
-> f UpdateS3Resources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate])
-> [S3ResourceClassificationUpdate]
-> f [S3ResourceClassificationUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateS3Resources where
type
AWSResponse UpdateS3Resources =
UpdateS3ResourcesResponse
request :: UpdateS3Resources -> Request UpdateS3Resources
request = Service -> UpdateS3Resources -> Request UpdateS3Resources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateS3Resources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateS3Resources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateS3Resources))
-> Logger
-> Service
-> Proxy UpdateS3Resources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateS3Resources)))
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 [FailedS3Resource] -> Int -> UpdateS3ResourcesResponse
UpdateS3ResourcesResponse'
(Maybe [FailedS3Resource] -> Int -> UpdateS3ResourcesResponse)
-> Either String (Maybe [FailedS3Resource])
-> Either String (Int -> UpdateS3ResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [FailedS3Resource]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failedS3Resources"
Either String (Maybe (Maybe [FailedS3Resource]))
-> Maybe [FailedS3Resource]
-> Either String (Maybe [FailedS3Resource])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FailedS3Resource]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> UpdateS3ResourcesResponse)
-> Either String Int -> Either String UpdateS3ResourcesResponse
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 UpdateS3Resources
instance Prelude.NFData UpdateS3Resources
instance Core.ToHeaders UpdateS3Resources where
toHeaders :: UpdateS3Resources -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateS3Resources -> 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
"MacieService.UpdateS3Resources" ::
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 UpdateS3Resources where
toJSON :: UpdateS3Resources -> Value
toJSON UpdateS3Resources' {[S3ResourceClassificationUpdate]
Maybe Text
s3ResourcesUpdate :: [S3ResourceClassificationUpdate]
memberAccountId :: Maybe Text
$sel:s3ResourcesUpdate:UpdateS3Resources' :: UpdateS3Resources -> [S3ResourceClassificationUpdate]
$sel:memberAccountId:UpdateS3Resources' :: UpdateS3Resources -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"memberAccountId" 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
memberAccountId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"s3ResourcesUpdate" Text -> [S3ResourceClassificationUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [S3ResourceClassificationUpdate]
s3ResourcesUpdate)
]
)
instance Core.ToPath UpdateS3Resources where
toPath :: UpdateS3Resources -> ByteString
toPath = ByteString -> UpdateS3Resources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateS3Resources where
toQuery :: UpdateS3Resources -> QueryString
toQuery = QueryString -> UpdateS3Resources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateS3ResourcesResponse = UpdateS3ResourcesResponse'
{
UpdateS3ResourcesResponse -> Maybe [FailedS3Resource]
failedS3Resources :: Prelude.Maybe [FailedS3Resource],
UpdateS3ResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool
(UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool)
-> (UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool)
-> Eq UpdateS3ResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool
$c/= :: UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool
== :: UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool
$c== :: UpdateS3ResourcesResponse -> UpdateS3ResourcesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateS3ResourcesResponse]
ReadPrec UpdateS3ResourcesResponse
Int -> ReadS UpdateS3ResourcesResponse
ReadS [UpdateS3ResourcesResponse]
(Int -> ReadS UpdateS3ResourcesResponse)
-> ReadS [UpdateS3ResourcesResponse]
-> ReadPrec UpdateS3ResourcesResponse
-> ReadPrec [UpdateS3ResourcesResponse]
-> Read UpdateS3ResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateS3ResourcesResponse]
$creadListPrec :: ReadPrec [UpdateS3ResourcesResponse]
readPrec :: ReadPrec UpdateS3ResourcesResponse
$creadPrec :: ReadPrec UpdateS3ResourcesResponse
readList :: ReadS [UpdateS3ResourcesResponse]
$creadList :: ReadS [UpdateS3ResourcesResponse]
readsPrec :: Int -> ReadS UpdateS3ResourcesResponse
$creadsPrec :: Int -> ReadS UpdateS3ResourcesResponse
Prelude.Read, Int -> UpdateS3ResourcesResponse -> ShowS
[UpdateS3ResourcesResponse] -> ShowS
UpdateS3ResourcesResponse -> String
(Int -> UpdateS3ResourcesResponse -> ShowS)
-> (UpdateS3ResourcesResponse -> String)
-> ([UpdateS3ResourcesResponse] -> ShowS)
-> Show UpdateS3ResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateS3ResourcesResponse] -> ShowS
$cshowList :: [UpdateS3ResourcesResponse] -> ShowS
show :: UpdateS3ResourcesResponse -> String
$cshow :: UpdateS3ResourcesResponse -> String
showsPrec :: Int -> UpdateS3ResourcesResponse -> ShowS
$cshowsPrec :: Int -> UpdateS3ResourcesResponse -> ShowS
Prelude.Show, (forall x.
UpdateS3ResourcesResponse -> Rep UpdateS3ResourcesResponse x)
-> (forall x.
Rep UpdateS3ResourcesResponse x -> UpdateS3ResourcesResponse)
-> Generic UpdateS3ResourcesResponse
forall x.
Rep UpdateS3ResourcesResponse x -> UpdateS3ResourcesResponse
forall x.
UpdateS3ResourcesResponse -> Rep UpdateS3ResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateS3ResourcesResponse x -> UpdateS3ResourcesResponse
$cfrom :: forall x.
UpdateS3ResourcesResponse -> Rep UpdateS3ResourcesResponse x
Prelude.Generic)
newUpdateS3ResourcesResponse ::
Prelude.Int ->
UpdateS3ResourcesResponse
newUpdateS3ResourcesResponse :: Int -> UpdateS3ResourcesResponse
newUpdateS3ResourcesResponse Int
pHttpStatus_ =
UpdateS3ResourcesResponse' :: Maybe [FailedS3Resource] -> Int -> UpdateS3ResourcesResponse
UpdateS3ResourcesResponse'
{ $sel:failedS3Resources:UpdateS3ResourcesResponse' :: Maybe [FailedS3Resource]
failedS3Resources =
Maybe [FailedS3Resource]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateS3ResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateS3ResourcesResponse_failedS3Resources :: Lens.Lens' UpdateS3ResourcesResponse (Prelude.Maybe [FailedS3Resource])
updateS3ResourcesResponse_failedS3Resources :: (Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> UpdateS3ResourcesResponse -> f UpdateS3ResourcesResponse
updateS3ResourcesResponse_failedS3Resources = (UpdateS3ResourcesResponse -> Maybe [FailedS3Resource])
-> (UpdateS3ResourcesResponse
-> Maybe [FailedS3Resource] -> UpdateS3ResourcesResponse)
-> Lens
UpdateS3ResourcesResponse
UpdateS3ResourcesResponse
(Maybe [FailedS3Resource])
(Maybe [FailedS3Resource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateS3ResourcesResponse' {Maybe [FailedS3Resource]
failedS3Resources :: Maybe [FailedS3Resource]
$sel:failedS3Resources:UpdateS3ResourcesResponse' :: UpdateS3ResourcesResponse -> Maybe [FailedS3Resource]
failedS3Resources} -> Maybe [FailedS3Resource]
failedS3Resources) (\s :: UpdateS3ResourcesResponse
s@UpdateS3ResourcesResponse' {} Maybe [FailedS3Resource]
a -> UpdateS3ResourcesResponse
s {$sel:failedS3Resources:UpdateS3ResourcesResponse' :: Maybe [FailedS3Resource]
failedS3Resources = Maybe [FailedS3Resource]
a} :: UpdateS3ResourcesResponse) ((Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> UpdateS3ResourcesResponse -> f UpdateS3ResourcesResponse)
-> ((Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> (Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> UpdateS3ResourcesResponse
-> f UpdateS3ResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[FailedS3Resource]
[FailedS3Resource]
[FailedS3Resource]
[FailedS3Resource]
-> Iso
(Maybe [FailedS3Resource])
(Maybe [FailedS3Resource])
(Maybe [FailedS3Resource])
(Maybe [FailedS3Resource])
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
[FailedS3Resource]
[FailedS3Resource]
[FailedS3Resource]
[FailedS3Resource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateS3ResourcesResponse_httpStatus :: Lens.Lens' UpdateS3ResourcesResponse Prelude.Int
updateS3ResourcesResponse_httpStatus :: (Int -> f Int)
-> UpdateS3ResourcesResponse -> f UpdateS3ResourcesResponse
updateS3ResourcesResponse_httpStatus = (UpdateS3ResourcesResponse -> Int)
-> (UpdateS3ResourcesResponse -> Int -> UpdateS3ResourcesResponse)
-> Lens UpdateS3ResourcesResponse UpdateS3ResourcesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateS3ResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateS3ResourcesResponse' :: UpdateS3ResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateS3ResourcesResponse
s@UpdateS3ResourcesResponse' {} Int
a -> UpdateS3ResourcesResponse
s {$sel:httpStatus:UpdateS3ResourcesResponse' :: Int
httpStatus = Int
a} :: UpdateS3ResourcesResponse)
instance Prelude.NFData UpdateS3ResourcesResponse