{-# 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.MacieV2.EnableMacie
(
EnableMacie (..),
newEnableMacie,
enableMacie_status,
enableMacie_clientToken,
enableMacie_findingPublishingFrequency,
EnableMacieResponse (..),
newEnableMacieResponse,
enableMacieResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data EnableMacie = EnableMacie'
{
EnableMacie -> Maybe MacieStatus
status :: Prelude.Maybe MacieStatus,
EnableMacie -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
EnableMacie -> Maybe FindingPublishingFrequency
findingPublishingFrequency :: Prelude.Maybe FindingPublishingFrequency
}
deriving (EnableMacie -> EnableMacie -> Bool
(EnableMacie -> EnableMacie -> Bool)
-> (EnableMacie -> EnableMacie -> Bool) -> Eq EnableMacie
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableMacie -> EnableMacie -> Bool
$c/= :: EnableMacie -> EnableMacie -> Bool
== :: EnableMacie -> EnableMacie -> Bool
$c== :: EnableMacie -> EnableMacie -> Bool
Prelude.Eq, ReadPrec [EnableMacie]
ReadPrec EnableMacie
Int -> ReadS EnableMacie
ReadS [EnableMacie]
(Int -> ReadS EnableMacie)
-> ReadS [EnableMacie]
-> ReadPrec EnableMacie
-> ReadPrec [EnableMacie]
-> Read EnableMacie
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableMacie]
$creadListPrec :: ReadPrec [EnableMacie]
readPrec :: ReadPrec EnableMacie
$creadPrec :: ReadPrec EnableMacie
readList :: ReadS [EnableMacie]
$creadList :: ReadS [EnableMacie]
readsPrec :: Int -> ReadS EnableMacie
$creadsPrec :: Int -> ReadS EnableMacie
Prelude.Read, Int -> EnableMacie -> ShowS
[EnableMacie] -> ShowS
EnableMacie -> String
(Int -> EnableMacie -> ShowS)
-> (EnableMacie -> String)
-> ([EnableMacie] -> ShowS)
-> Show EnableMacie
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableMacie] -> ShowS
$cshowList :: [EnableMacie] -> ShowS
show :: EnableMacie -> String
$cshow :: EnableMacie -> String
showsPrec :: Int -> EnableMacie -> ShowS
$cshowsPrec :: Int -> EnableMacie -> ShowS
Prelude.Show, (forall x. EnableMacie -> Rep EnableMacie x)
-> (forall x. Rep EnableMacie x -> EnableMacie)
-> Generic EnableMacie
forall x. Rep EnableMacie x -> EnableMacie
forall x. EnableMacie -> Rep EnableMacie x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableMacie x -> EnableMacie
$cfrom :: forall x. EnableMacie -> Rep EnableMacie x
Prelude.Generic)
newEnableMacie ::
EnableMacie
newEnableMacie :: EnableMacie
newEnableMacie =
EnableMacie' :: Maybe MacieStatus
-> Maybe Text -> Maybe FindingPublishingFrequency -> EnableMacie
EnableMacie'
{ $sel:status:EnableMacie' :: Maybe MacieStatus
status = Maybe MacieStatus
forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:EnableMacie' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:findingPublishingFrequency:EnableMacie' :: Maybe FindingPublishingFrequency
findingPublishingFrequency = Maybe FindingPublishingFrequency
forall a. Maybe a
Prelude.Nothing
}
enableMacie_status :: Lens.Lens' EnableMacie (Prelude.Maybe MacieStatus)
enableMacie_status :: (Maybe MacieStatus -> f (Maybe MacieStatus))
-> EnableMacie -> f EnableMacie
enableMacie_status = (EnableMacie -> Maybe MacieStatus)
-> (EnableMacie -> Maybe MacieStatus -> EnableMacie)
-> Lens
EnableMacie EnableMacie (Maybe MacieStatus) (Maybe MacieStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableMacie' {Maybe MacieStatus
status :: Maybe MacieStatus
$sel:status:EnableMacie' :: EnableMacie -> Maybe MacieStatus
status} -> Maybe MacieStatus
status) (\s :: EnableMacie
s@EnableMacie' {} Maybe MacieStatus
a -> EnableMacie
s {$sel:status:EnableMacie' :: Maybe MacieStatus
status = Maybe MacieStatus
a} :: EnableMacie)
enableMacie_clientToken :: Lens.Lens' EnableMacie (Prelude.Maybe Prelude.Text)
enableMacie_clientToken :: (Maybe Text -> f (Maybe Text)) -> EnableMacie -> f EnableMacie
enableMacie_clientToken = (EnableMacie -> Maybe Text)
-> (EnableMacie -> Maybe Text -> EnableMacie)
-> Lens EnableMacie EnableMacie (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableMacie' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:EnableMacie' :: EnableMacie -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: EnableMacie
s@EnableMacie' {} Maybe Text
a -> EnableMacie
s {$sel:clientToken:EnableMacie' :: Maybe Text
clientToken = Maybe Text
a} :: EnableMacie)
enableMacie_findingPublishingFrequency :: Lens.Lens' EnableMacie (Prelude.Maybe FindingPublishingFrequency)
enableMacie_findingPublishingFrequency :: (Maybe FindingPublishingFrequency
-> f (Maybe FindingPublishingFrequency))
-> EnableMacie -> f EnableMacie
enableMacie_findingPublishingFrequency = (EnableMacie -> Maybe FindingPublishingFrequency)
-> (EnableMacie -> Maybe FindingPublishingFrequency -> EnableMacie)
-> Lens
EnableMacie
EnableMacie
(Maybe FindingPublishingFrequency)
(Maybe FindingPublishingFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableMacie' {Maybe FindingPublishingFrequency
findingPublishingFrequency :: Maybe FindingPublishingFrequency
$sel:findingPublishingFrequency:EnableMacie' :: EnableMacie -> Maybe FindingPublishingFrequency
findingPublishingFrequency} -> Maybe FindingPublishingFrequency
findingPublishingFrequency) (\s :: EnableMacie
s@EnableMacie' {} Maybe FindingPublishingFrequency
a -> EnableMacie
s {$sel:findingPublishingFrequency:EnableMacie' :: Maybe FindingPublishingFrequency
findingPublishingFrequency = Maybe FindingPublishingFrequency
a} :: EnableMacie)
instance Core.AWSRequest EnableMacie where
type AWSResponse EnableMacie = EnableMacieResponse
request :: EnableMacie -> Request EnableMacie
request = Service -> EnableMacie -> Request EnableMacie
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableMacie
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableMacie)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse EnableMacie))
-> Logger
-> Service
-> Proxy EnableMacie
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableMacie)))
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 -> EnableMacieResponse
EnableMacieResponse'
(Int -> EnableMacieResponse)
-> Either String Int -> Either String EnableMacieResponse
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 EnableMacie
instance Prelude.NFData EnableMacie
instance Core.ToHeaders EnableMacie where
toHeaders :: EnableMacie -> ResponseHeaders
toHeaders =
ResponseHeaders -> EnableMacie -> 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 EnableMacie where
toJSON :: EnableMacie -> Value
toJSON EnableMacie' {Maybe Text
Maybe FindingPublishingFrequency
Maybe MacieStatus
findingPublishingFrequency :: Maybe FindingPublishingFrequency
clientToken :: Maybe Text
status :: Maybe MacieStatus
$sel:findingPublishingFrequency:EnableMacie' :: EnableMacie -> Maybe FindingPublishingFrequency
$sel:clientToken:EnableMacie' :: EnableMacie -> Maybe Text
$sel:status:EnableMacie' :: EnableMacie -> Maybe MacieStatus
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"status" Text -> MacieStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MacieStatus -> Pair) -> Maybe MacieStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MacieStatus
status,
(Text
"clientToken" 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
clientToken,
(Text
"findingPublishingFrequency" Text -> FindingPublishingFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FindingPublishingFrequency -> Pair)
-> Maybe FindingPublishingFrequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingPublishingFrequency
findingPublishingFrequency
]
)
instance Core.ToPath EnableMacie where
toPath :: EnableMacie -> ByteString
toPath = ByteString -> EnableMacie -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/macie"
instance Core.ToQuery EnableMacie where
toQuery :: EnableMacie -> QueryString
toQuery = QueryString -> EnableMacie -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EnableMacieResponse = EnableMacieResponse'
{
EnableMacieResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnableMacieResponse -> EnableMacieResponse -> Bool
(EnableMacieResponse -> EnableMacieResponse -> Bool)
-> (EnableMacieResponse -> EnableMacieResponse -> Bool)
-> Eq EnableMacieResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableMacieResponse -> EnableMacieResponse -> Bool
$c/= :: EnableMacieResponse -> EnableMacieResponse -> Bool
== :: EnableMacieResponse -> EnableMacieResponse -> Bool
$c== :: EnableMacieResponse -> EnableMacieResponse -> Bool
Prelude.Eq, ReadPrec [EnableMacieResponse]
ReadPrec EnableMacieResponse
Int -> ReadS EnableMacieResponse
ReadS [EnableMacieResponse]
(Int -> ReadS EnableMacieResponse)
-> ReadS [EnableMacieResponse]
-> ReadPrec EnableMacieResponse
-> ReadPrec [EnableMacieResponse]
-> Read EnableMacieResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableMacieResponse]
$creadListPrec :: ReadPrec [EnableMacieResponse]
readPrec :: ReadPrec EnableMacieResponse
$creadPrec :: ReadPrec EnableMacieResponse
readList :: ReadS [EnableMacieResponse]
$creadList :: ReadS [EnableMacieResponse]
readsPrec :: Int -> ReadS EnableMacieResponse
$creadsPrec :: Int -> ReadS EnableMacieResponse
Prelude.Read, Int -> EnableMacieResponse -> ShowS
[EnableMacieResponse] -> ShowS
EnableMacieResponse -> String
(Int -> EnableMacieResponse -> ShowS)
-> (EnableMacieResponse -> String)
-> ([EnableMacieResponse] -> ShowS)
-> Show EnableMacieResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableMacieResponse] -> ShowS
$cshowList :: [EnableMacieResponse] -> ShowS
show :: EnableMacieResponse -> String
$cshow :: EnableMacieResponse -> String
showsPrec :: Int -> EnableMacieResponse -> ShowS
$cshowsPrec :: Int -> EnableMacieResponse -> ShowS
Prelude.Show, (forall x. EnableMacieResponse -> Rep EnableMacieResponse x)
-> (forall x. Rep EnableMacieResponse x -> EnableMacieResponse)
-> Generic EnableMacieResponse
forall x. Rep EnableMacieResponse x -> EnableMacieResponse
forall x. EnableMacieResponse -> Rep EnableMacieResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableMacieResponse x -> EnableMacieResponse
$cfrom :: forall x. EnableMacieResponse -> Rep EnableMacieResponse x
Prelude.Generic)
newEnableMacieResponse ::
Prelude.Int ->
EnableMacieResponse
newEnableMacieResponse :: Int -> EnableMacieResponse
newEnableMacieResponse Int
pHttpStatus_ =
EnableMacieResponse' :: Int -> EnableMacieResponse
EnableMacieResponse' {$sel:httpStatus:EnableMacieResponse' :: Int
httpStatus = Int
pHttpStatus_}
enableMacieResponse_httpStatus :: Lens.Lens' EnableMacieResponse Prelude.Int
enableMacieResponse_httpStatus :: (Int -> f Int) -> EnableMacieResponse -> f EnableMacieResponse
enableMacieResponse_httpStatus = (EnableMacieResponse -> Int)
-> (EnableMacieResponse -> Int -> EnableMacieResponse)
-> Lens EnableMacieResponse EnableMacieResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableMacieResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnableMacieResponse' :: EnableMacieResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnableMacieResponse
s@EnableMacieResponse' {} Int
a -> EnableMacieResponse
s {$sel:httpStatus:EnableMacieResponse' :: Int
httpStatus = Int
a} :: EnableMacieResponse)
instance Prelude.NFData EnableMacieResponse