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