{-# 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.DisassociateS3Resources
(
DisassociateS3Resources (..),
newDisassociateS3Resources,
disassociateS3Resources_memberAccountId,
disassociateS3Resources_associatedS3Resources,
DisassociateS3ResourcesResponse (..),
newDisassociateS3ResourcesResponse,
disassociateS3ResourcesResponse_failedS3Resources,
disassociateS3ResourcesResponse_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 DisassociateS3Resources = DisassociateS3Resources'
{
DisassociateS3Resources -> Maybe Text
memberAccountId :: Prelude.Maybe Prelude.Text,
DisassociateS3Resources -> [S3Resource]
associatedS3Resources :: [S3Resource]
}
deriving (DisassociateS3Resources -> DisassociateS3Resources -> Bool
(DisassociateS3Resources -> DisassociateS3Resources -> Bool)
-> (DisassociateS3Resources -> DisassociateS3Resources -> Bool)
-> Eq DisassociateS3Resources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateS3Resources -> DisassociateS3Resources -> Bool
$c/= :: DisassociateS3Resources -> DisassociateS3Resources -> Bool
== :: DisassociateS3Resources -> DisassociateS3Resources -> Bool
$c== :: DisassociateS3Resources -> DisassociateS3Resources -> Bool
Prelude.Eq, ReadPrec [DisassociateS3Resources]
ReadPrec DisassociateS3Resources
Int -> ReadS DisassociateS3Resources
ReadS [DisassociateS3Resources]
(Int -> ReadS DisassociateS3Resources)
-> ReadS [DisassociateS3Resources]
-> ReadPrec DisassociateS3Resources
-> ReadPrec [DisassociateS3Resources]
-> Read DisassociateS3Resources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateS3Resources]
$creadListPrec :: ReadPrec [DisassociateS3Resources]
readPrec :: ReadPrec DisassociateS3Resources
$creadPrec :: ReadPrec DisassociateS3Resources
readList :: ReadS [DisassociateS3Resources]
$creadList :: ReadS [DisassociateS3Resources]
readsPrec :: Int -> ReadS DisassociateS3Resources
$creadsPrec :: Int -> ReadS DisassociateS3Resources
Prelude.Read, Int -> DisassociateS3Resources -> ShowS
[DisassociateS3Resources] -> ShowS
DisassociateS3Resources -> String
(Int -> DisassociateS3Resources -> ShowS)
-> (DisassociateS3Resources -> String)
-> ([DisassociateS3Resources] -> ShowS)
-> Show DisassociateS3Resources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateS3Resources] -> ShowS
$cshowList :: [DisassociateS3Resources] -> ShowS
show :: DisassociateS3Resources -> String
$cshow :: DisassociateS3Resources -> String
showsPrec :: Int -> DisassociateS3Resources -> ShowS
$cshowsPrec :: Int -> DisassociateS3Resources -> ShowS
Prelude.Show, (forall x.
DisassociateS3Resources -> Rep DisassociateS3Resources x)
-> (forall x.
Rep DisassociateS3Resources x -> DisassociateS3Resources)
-> Generic DisassociateS3Resources
forall x. Rep DisassociateS3Resources x -> DisassociateS3Resources
forall x. DisassociateS3Resources -> Rep DisassociateS3Resources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateS3Resources x -> DisassociateS3Resources
$cfrom :: forall x. DisassociateS3Resources -> Rep DisassociateS3Resources x
Prelude.Generic)
newDisassociateS3Resources ::
DisassociateS3Resources
newDisassociateS3Resources :: DisassociateS3Resources
newDisassociateS3Resources =
DisassociateS3Resources' :: Maybe Text -> [S3Resource] -> DisassociateS3Resources
DisassociateS3Resources'
{ $sel:memberAccountId:DisassociateS3Resources' :: Maybe Text
memberAccountId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:associatedS3Resources:DisassociateS3Resources' :: [S3Resource]
associatedS3Resources = [S3Resource]
forall a. Monoid a => a
Prelude.mempty
}
disassociateS3Resources_memberAccountId :: Lens.Lens' DisassociateS3Resources (Prelude.Maybe Prelude.Text)
disassociateS3Resources_memberAccountId :: (Maybe Text -> f (Maybe Text))
-> DisassociateS3Resources -> f DisassociateS3Resources
disassociateS3Resources_memberAccountId = (DisassociateS3Resources -> Maybe Text)
-> (DisassociateS3Resources
-> Maybe Text -> DisassociateS3Resources)
-> Lens
DisassociateS3Resources
DisassociateS3Resources
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateS3Resources' {Maybe Text
memberAccountId :: Maybe Text
$sel:memberAccountId:DisassociateS3Resources' :: DisassociateS3Resources -> Maybe Text
memberAccountId} -> Maybe Text
memberAccountId) (\s :: DisassociateS3Resources
s@DisassociateS3Resources' {} Maybe Text
a -> DisassociateS3Resources
s {$sel:memberAccountId:DisassociateS3Resources' :: Maybe Text
memberAccountId = Maybe Text
a} :: DisassociateS3Resources)
disassociateS3Resources_associatedS3Resources :: Lens.Lens' DisassociateS3Resources [S3Resource]
disassociateS3Resources_associatedS3Resources :: ([S3Resource] -> f [S3Resource])
-> DisassociateS3Resources -> f DisassociateS3Resources
disassociateS3Resources_associatedS3Resources = (DisassociateS3Resources -> [S3Resource])
-> (DisassociateS3Resources
-> [S3Resource] -> DisassociateS3Resources)
-> Lens
DisassociateS3Resources
DisassociateS3Resources
[S3Resource]
[S3Resource]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateS3Resources' {[S3Resource]
associatedS3Resources :: [S3Resource]
$sel:associatedS3Resources:DisassociateS3Resources' :: DisassociateS3Resources -> [S3Resource]
associatedS3Resources} -> [S3Resource]
associatedS3Resources) (\s :: DisassociateS3Resources
s@DisassociateS3Resources' {} [S3Resource]
a -> DisassociateS3Resources
s {$sel:associatedS3Resources:DisassociateS3Resources' :: [S3Resource]
associatedS3Resources = [S3Resource]
a} :: DisassociateS3Resources) (([S3Resource] -> f [S3Resource])
-> DisassociateS3Resources -> f DisassociateS3Resources)
-> (([S3Resource] -> f [S3Resource])
-> [S3Resource] -> f [S3Resource])
-> ([S3Resource] -> f [S3Resource])
-> DisassociateS3Resources
-> f DisassociateS3Resources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([S3Resource] -> f [S3Resource]) -> [S3Resource] -> f [S3Resource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DisassociateS3Resources where
type
AWSResponse DisassociateS3Resources =
DisassociateS3ResourcesResponse
request :: DisassociateS3Resources -> Request DisassociateS3Resources
request = Service
-> DisassociateS3Resources -> Request DisassociateS3Resources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DisassociateS3Resources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisassociateS3Resources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DisassociateS3Resources))
-> Logger
-> Service
-> Proxy DisassociateS3Resources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisassociateS3Resources)))
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 -> DisassociateS3ResourcesResponse
DisassociateS3ResourcesResponse'
(Maybe [FailedS3Resource]
-> Int -> DisassociateS3ResourcesResponse)
-> Either String (Maybe [FailedS3Resource])
-> Either String (Int -> DisassociateS3ResourcesResponse)
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 -> DisassociateS3ResourcesResponse)
-> Either String Int
-> Either String DisassociateS3ResourcesResponse
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 DisassociateS3Resources
instance Prelude.NFData DisassociateS3Resources
instance Core.ToHeaders DisassociateS3Resources where
toHeaders :: DisassociateS3Resources -> ResponseHeaders
toHeaders =
ResponseHeaders -> DisassociateS3Resources -> 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.DisassociateS3Resources" ::
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 DisassociateS3Resources where
toJSON :: DisassociateS3Resources -> Value
toJSON DisassociateS3Resources' {[S3Resource]
Maybe Text
associatedS3Resources :: [S3Resource]
memberAccountId :: Maybe Text
$sel:associatedS3Resources:DisassociateS3Resources' :: DisassociateS3Resources -> [S3Resource]
$sel:memberAccountId:DisassociateS3Resources' :: DisassociateS3Resources -> 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
"associatedS3Resources"
Text -> [S3Resource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [S3Resource]
associatedS3Resources
)
]
)
instance Core.ToPath DisassociateS3Resources where
toPath :: DisassociateS3Resources -> ByteString
toPath = ByteString -> DisassociateS3Resources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DisassociateS3Resources where
toQuery :: DisassociateS3Resources -> QueryString
toQuery = QueryString -> DisassociateS3Resources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DisassociateS3ResourcesResponse = DisassociateS3ResourcesResponse'
{
DisassociateS3ResourcesResponse -> Maybe [FailedS3Resource]
failedS3Resources :: Prelude.Maybe [FailedS3Resource],
DisassociateS3ResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool
(DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool)
-> (DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool)
-> Eq DisassociateS3ResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool
$c/= :: DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool
== :: DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool
$c== :: DisassociateS3ResourcesResponse
-> DisassociateS3ResourcesResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateS3ResourcesResponse]
ReadPrec DisassociateS3ResourcesResponse
Int -> ReadS DisassociateS3ResourcesResponse
ReadS [DisassociateS3ResourcesResponse]
(Int -> ReadS DisassociateS3ResourcesResponse)
-> ReadS [DisassociateS3ResourcesResponse]
-> ReadPrec DisassociateS3ResourcesResponse
-> ReadPrec [DisassociateS3ResourcesResponse]
-> Read DisassociateS3ResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateS3ResourcesResponse]
$creadListPrec :: ReadPrec [DisassociateS3ResourcesResponse]
readPrec :: ReadPrec DisassociateS3ResourcesResponse
$creadPrec :: ReadPrec DisassociateS3ResourcesResponse
readList :: ReadS [DisassociateS3ResourcesResponse]
$creadList :: ReadS [DisassociateS3ResourcesResponse]
readsPrec :: Int -> ReadS DisassociateS3ResourcesResponse
$creadsPrec :: Int -> ReadS DisassociateS3ResourcesResponse
Prelude.Read, Int -> DisassociateS3ResourcesResponse -> ShowS
[DisassociateS3ResourcesResponse] -> ShowS
DisassociateS3ResourcesResponse -> String
(Int -> DisassociateS3ResourcesResponse -> ShowS)
-> (DisassociateS3ResourcesResponse -> String)
-> ([DisassociateS3ResourcesResponse] -> ShowS)
-> Show DisassociateS3ResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateS3ResourcesResponse] -> ShowS
$cshowList :: [DisassociateS3ResourcesResponse] -> ShowS
show :: DisassociateS3ResourcesResponse -> String
$cshow :: DisassociateS3ResourcesResponse -> String
showsPrec :: Int -> DisassociateS3ResourcesResponse -> ShowS
$cshowsPrec :: Int -> DisassociateS3ResourcesResponse -> ShowS
Prelude.Show, (forall x.
DisassociateS3ResourcesResponse
-> Rep DisassociateS3ResourcesResponse x)
-> (forall x.
Rep DisassociateS3ResourcesResponse x
-> DisassociateS3ResourcesResponse)
-> Generic DisassociateS3ResourcesResponse
forall x.
Rep DisassociateS3ResourcesResponse x
-> DisassociateS3ResourcesResponse
forall x.
DisassociateS3ResourcesResponse
-> Rep DisassociateS3ResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateS3ResourcesResponse x
-> DisassociateS3ResourcesResponse
$cfrom :: forall x.
DisassociateS3ResourcesResponse
-> Rep DisassociateS3ResourcesResponse x
Prelude.Generic)
newDisassociateS3ResourcesResponse ::
Prelude.Int ->
DisassociateS3ResourcesResponse
newDisassociateS3ResourcesResponse :: Int -> DisassociateS3ResourcesResponse
newDisassociateS3ResourcesResponse Int
pHttpStatus_ =
DisassociateS3ResourcesResponse' :: Maybe [FailedS3Resource] -> Int -> DisassociateS3ResourcesResponse
DisassociateS3ResourcesResponse'
{ $sel:failedS3Resources:DisassociateS3ResourcesResponse' :: Maybe [FailedS3Resource]
failedS3Resources =
Maybe [FailedS3Resource]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DisassociateS3ResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
disassociateS3ResourcesResponse_failedS3Resources :: Lens.Lens' DisassociateS3ResourcesResponse (Prelude.Maybe [FailedS3Resource])
disassociateS3ResourcesResponse_failedS3Resources :: (Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> DisassociateS3ResourcesResponse
-> f DisassociateS3ResourcesResponse
disassociateS3ResourcesResponse_failedS3Resources = (DisassociateS3ResourcesResponse -> Maybe [FailedS3Resource])
-> (DisassociateS3ResourcesResponse
-> Maybe [FailedS3Resource] -> DisassociateS3ResourcesResponse)
-> Lens
DisassociateS3ResourcesResponse
DisassociateS3ResourcesResponse
(Maybe [FailedS3Resource])
(Maybe [FailedS3Resource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateS3ResourcesResponse' {Maybe [FailedS3Resource]
failedS3Resources :: Maybe [FailedS3Resource]
$sel:failedS3Resources:DisassociateS3ResourcesResponse' :: DisassociateS3ResourcesResponse -> Maybe [FailedS3Resource]
failedS3Resources} -> Maybe [FailedS3Resource]
failedS3Resources) (\s :: DisassociateS3ResourcesResponse
s@DisassociateS3ResourcesResponse' {} Maybe [FailedS3Resource]
a -> DisassociateS3ResourcesResponse
s {$sel:failedS3Resources:DisassociateS3ResourcesResponse' :: Maybe [FailedS3Resource]
failedS3Resources = Maybe [FailedS3Resource]
a} :: DisassociateS3ResourcesResponse) ((Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> DisassociateS3ResourcesResponse
-> f DisassociateS3ResourcesResponse)
-> ((Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> (Maybe [FailedS3Resource] -> f (Maybe [FailedS3Resource]))
-> DisassociateS3ResourcesResponse
-> f DisassociateS3ResourcesResponse
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
disassociateS3ResourcesResponse_httpStatus :: Lens.Lens' DisassociateS3ResourcesResponse Prelude.Int
disassociateS3ResourcesResponse_httpStatus :: (Int -> f Int)
-> DisassociateS3ResourcesResponse
-> f DisassociateS3ResourcesResponse
disassociateS3ResourcesResponse_httpStatus = (DisassociateS3ResourcesResponse -> Int)
-> (DisassociateS3ResourcesResponse
-> Int -> DisassociateS3ResourcesResponse)
-> Lens
DisassociateS3ResourcesResponse
DisassociateS3ResourcesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateS3ResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateS3ResourcesResponse' :: DisassociateS3ResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisassociateS3ResourcesResponse
s@DisassociateS3ResourcesResponse' {} Int
a -> DisassociateS3ResourcesResponse
s {$sel:httpStatus:DisassociateS3ResourcesResponse' :: Int
httpStatus = Int
a} :: DisassociateS3ResourcesResponse)
instance
Prelude.NFData
DisassociateS3ResourcesResponse