{-# 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.AuditManager.UpdateSettings
(
UpdateSettings (..),
newUpdateSettings,
updateSettings_kmsKey,
updateSettings_defaultAssessmentReportsDestination,
updateSettings_snsTopic,
updateSettings_defaultProcessOwners,
UpdateSettingsResponse (..),
newUpdateSettingsResponse,
updateSettingsResponse_settings,
updateSettingsResponse_httpStatus,
)
where
import Amazonka.AuditManager.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 UpdateSettings = UpdateSettings'
{
UpdateSettings -> Maybe Text
kmsKey :: Prelude.Maybe Prelude.Text,
UpdateSettings -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination :: Prelude.Maybe AssessmentReportsDestination,
UpdateSettings -> Maybe Text
snsTopic :: Prelude.Maybe Prelude.Text,
UpdateSettings -> Maybe [Role]
defaultProcessOwners :: Prelude.Maybe [Role]
}
deriving (UpdateSettings -> UpdateSettings -> Bool
(UpdateSettings -> UpdateSettings -> Bool)
-> (UpdateSettings -> UpdateSettings -> Bool) -> Eq UpdateSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSettings -> UpdateSettings -> Bool
$c/= :: UpdateSettings -> UpdateSettings -> Bool
== :: UpdateSettings -> UpdateSettings -> Bool
$c== :: UpdateSettings -> UpdateSettings -> Bool
Prelude.Eq, ReadPrec [UpdateSettings]
ReadPrec UpdateSettings
Int -> ReadS UpdateSettings
ReadS [UpdateSettings]
(Int -> ReadS UpdateSettings)
-> ReadS [UpdateSettings]
-> ReadPrec UpdateSettings
-> ReadPrec [UpdateSettings]
-> Read UpdateSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSettings]
$creadListPrec :: ReadPrec [UpdateSettings]
readPrec :: ReadPrec UpdateSettings
$creadPrec :: ReadPrec UpdateSettings
readList :: ReadS [UpdateSettings]
$creadList :: ReadS [UpdateSettings]
readsPrec :: Int -> ReadS UpdateSettings
$creadsPrec :: Int -> ReadS UpdateSettings
Prelude.Read, Int -> UpdateSettings -> ShowS
[UpdateSettings] -> ShowS
UpdateSettings -> String
(Int -> UpdateSettings -> ShowS)
-> (UpdateSettings -> String)
-> ([UpdateSettings] -> ShowS)
-> Show UpdateSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSettings] -> ShowS
$cshowList :: [UpdateSettings] -> ShowS
show :: UpdateSettings -> String
$cshow :: UpdateSettings -> String
showsPrec :: Int -> UpdateSettings -> ShowS
$cshowsPrec :: Int -> UpdateSettings -> ShowS
Prelude.Show, (forall x. UpdateSettings -> Rep UpdateSettings x)
-> (forall x. Rep UpdateSettings x -> UpdateSettings)
-> Generic UpdateSettings
forall x. Rep UpdateSettings x -> UpdateSettings
forall x. UpdateSettings -> Rep UpdateSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSettings x -> UpdateSettings
$cfrom :: forall x. UpdateSettings -> Rep UpdateSettings x
Prelude.Generic)
newUpdateSettings ::
UpdateSettings
newUpdateSettings :: UpdateSettings
newUpdateSettings =
UpdateSettings' :: Maybe Text
-> Maybe AssessmentReportsDestination
-> Maybe Text
-> Maybe [Role]
-> UpdateSettings
UpdateSettings'
{ $sel:kmsKey:UpdateSettings' :: Maybe Text
kmsKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:defaultAssessmentReportsDestination:UpdateSettings' :: Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination =
Maybe AssessmentReportsDestination
forall a. Maybe a
Prelude.Nothing,
$sel:snsTopic:UpdateSettings' :: Maybe Text
snsTopic = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:defaultProcessOwners:UpdateSettings' :: Maybe [Role]
defaultProcessOwners = Maybe [Role]
forall a. Maybe a
Prelude.Nothing
}
updateSettings_kmsKey :: Lens.Lens' UpdateSettings (Prelude.Maybe Prelude.Text)
updateSettings_kmsKey :: (Maybe Text -> f (Maybe Text))
-> UpdateSettings -> f UpdateSettings
updateSettings_kmsKey = (UpdateSettings -> Maybe Text)
-> (UpdateSettings -> Maybe Text -> UpdateSettings)
-> Lens UpdateSettings UpdateSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {Maybe Text
kmsKey :: Maybe Text
$sel:kmsKey:UpdateSettings' :: UpdateSettings -> Maybe Text
kmsKey} -> Maybe Text
kmsKey) (\s :: UpdateSettings
s@UpdateSettings' {} Maybe Text
a -> UpdateSettings
s {$sel:kmsKey:UpdateSettings' :: Maybe Text
kmsKey = Maybe Text
a} :: UpdateSettings)
updateSettings_defaultAssessmentReportsDestination :: Lens.Lens' UpdateSettings (Prelude.Maybe AssessmentReportsDestination)
updateSettings_defaultAssessmentReportsDestination :: (Maybe AssessmentReportsDestination
-> f (Maybe AssessmentReportsDestination))
-> UpdateSettings -> f UpdateSettings
updateSettings_defaultAssessmentReportsDestination = (UpdateSettings -> Maybe AssessmentReportsDestination)
-> (UpdateSettings
-> Maybe AssessmentReportsDestination -> UpdateSettings)
-> Lens
UpdateSettings
UpdateSettings
(Maybe AssessmentReportsDestination)
(Maybe AssessmentReportsDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination :: Maybe AssessmentReportsDestination
$sel:defaultAssessmentReportsDestination:UpdateSettings' :: UpdateSettings -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination} -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination) (\s :: UpdateSettings
s@UpdateSettings' {} Maybe AssessmentReportsDestination
a -> UpdateSettings
s {$sel:defaultAssessmentReportsDestination:UpdateSettings' :: Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination = Maybe AssessmentReportsDestination
a} :: UpdateSettings)
updateSettings_snsTopic :: Lens.Lens' UpdateSettings (Prelude.Maybe Prelude.Text)
updateSettings_snsTopic :: (Maybe Text -> f (Maybe Text))
-> UpdateSettings -> f UpdateSettings
updateSettings_snsTopic = (UpdateSettings -> Maybe Text)
-> (UpdateSettings -> Maybe Text -> UpdateSettings)
-> Lens UpdateSettings UpdateSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {Maybe Text
snsTopic :: Maybe Text
$sel:snsTopic:UpdateSettings' :: UpdateSettings -> Maybe Text
snsTopic} -> Maybe Text
snsTopic) (\s :: UpdateSettings
s@UpdateSettings' {} Maybe Text
a -> UpdateSettings
s {$sel:snsTopic:UpdateSettings' :: Maybe Text
snsTopic = Maybe Text
a} :: UpdateSettings)
updateSettings_defaultProcessOwners :: Lens.Lens' UpdateSettings (Prelude.Maybe [Role])
updateSettings_defaultProcessOwners :: (Maybe [Role] -> f (Maybe [Role]))
-> UpdateSettings -> f UpdateSettings
updateSettings_defaultProcessOwners = (UpdateSettings -> Maybe [Role])
-> (UpdateSettings -> Maybe [Role] -> UpdateSettings)
-> Lens UpdateSettings UpdateSettings (Maybe [Role]) (Maybe [Role])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {Maybe [Role]
defaultProcessOwners :: Maybe [Role]
$sel:defaultProcessOwners:UpdateSettings' :: UpdateSettings -> Maybe [Role]
defaultProcessOwners} -> Maybe [Role]
defaultProcessOwners) (\s :: UpdateSettings
s@UpdateSettings' {} Maybe [Role]
a -> UpdateSettings
s {$sel:defaultProcessOwners:UpdateSettings' :: Maybe [Role]
defaultProcessOwners = Maybe [Role]
a} :: UpdateSettings) ((Maybe [Role] -> f (Maybe [Role]))
-> UpdateSettings -> f UpdateSettings)
-> ((Maybe [Role] -> f (Maybe [Role]))
-> Maybe [Role] -> f (Maybe [Role]))
-> (Maybe [Role] -> f (Maybe [Role]))
-> UpdateSettings
-> f UpdateSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Role] [Role] [Role] [Role]
-> Iso (Maybe [Role]) (Maybe [Role]) (Maybe [Role]) (Maybe [Role])
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 [Role] [Role] [Role] [Role]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateSettings where
type
AWSResponse UpdateSettings =
UpdateSettingsResponse
request :: UpdateSettings -> Request UpdateSettings
request = Service -> UpdateSettings -> Request UpdateSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSettings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSettings)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSettings))
-> Logger
-> Service
-> Proxy UpdateSettings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSettings)))
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 Settings -> Int -> UpdateSettingsResponse
UpdateSettingsResponse'
(Maybe Settings -> Int -> UpdateSettingsResponse)
-> Either String (Maybe Settings)
-> Either String (Int -> UpdateSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Settings)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"settings")
Either String (Int -> UpdateSettingsResponse)
-> Either String Int -> Either String UpdateSettingsResponse
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 UpdateSettings
instance Prelude.NFData UpdateSettings
instance Core.ToHeaders UpdateSettings where
toHeaders :: UpdateSettings -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSettings -> 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 UpdateSettings where
toJSON :: UpdateSettings -> Value
toJSON UpdateSettings' {Maybe [Role]
Maybe Text
Maybe AssessmentReportsDestination
defaultProcessOwners :: Maybe [Role]
snsTopic :: Maybe Text
defaultAssessmentReportsDestination :: Maybe AssessmentReportsDestination
kmsKey :: Maybe Text
$sel:defaultProcessOwners:UpdateSettings' :: UpdateSettings -> Maybe [Role]
$sel:snsTopic:UpdateSettings' :: UpdateSettings -> Maybe Text
$sel:defaultAssessmentReportsDestination:UpdateSettings' :: UpdateSettings -> Maybe AssessmentReportsDestination
$sel:kmsKey:UpdateSettings' :: UpdateSettings -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"kmsKey" 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
kmsKey,
(Text
"defaultAssessmentReportsDestination" Text -> AssessmentReportsDestination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AssessmentReportsDestination -> Pair)
-> Maybe AssessmentReportsDestination -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination,
(Text
"snsTopic" 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
snsTopic,
(Text
"defaultProcessOwners" Text -> [Role] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Role] -> Pair) -> Maybe [Role] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Role]
defaultProcessOwners
]
)
instance Core.ToPath UpdateSettings where
toPath :: UpdateSettings -> ByteString
toPath = ByteString -> UpdateSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/settings"
instance Core.ToQuery UpdateSettings where
toQuery :: UpdateSettings -> QueryString
toQuery = QueryString -> UpdateSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSettingsResponse = UpdateSettingsResponse'
{
UpdateSettingsResponse -> Maybe Settings
settings :: Prelude.Maybe Settings,
UpdateSettingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSettingsResponse -> UpdateSettingsResponse -> Bool
(UpdateSettingsResponse -> UpdateSettingsResponse -> Bool)
-> (UpdateSettingsResponse -> UpdateSettingsResponse -> Bool)
-> Eq UpdateSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSettingsResponse -> UpdateSettingsResponse -> Bool
$c/= :: UpdateSettingsResponse -> UpdateSettingsResponse -> Bool
== :: UpdateSettingsResponse -> UpdateSettingsResponse -> Bool
$c== :: UpdateSettingsResponse -> UpdateSettingsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSettingsResponse]
ReadPrec UpdateSettingsResponse
Int -> ReadS UpdateSettingsResponse
ReadS [UpdateSettingsResponse]
(Int -> ReadS UpdateSettingsResponse)
-> ReadS [UpdateSettingsResponse]
-> ReadPrec UpdateSettingsResponse
-> ReadPrec [UpdateSettingsResponse]
-> Read UpdateSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSettingsResponse]
$creadListPrec :: ReadPrec [UpdateSettingsResponse]
readPrec :: ReadPrec UpdateSettingsResponse
$creadPrec :: ReadPrec UpdateSettingsResponse
readList :: ReadS [UpdateSettingsResponse]
$creadList :: ReadS [UpdateSettingsResponse]
readsPrec :: Int -> ReadS UpdateSettingsResponse
$creadsPrec :: Int -> ReadS UpdateSettingsResponse
Prelude.Read, Int -> UpdateSettingsResponse -> ShowS
[UpdateSettingsResponse] -> ShowS
UpdateSettingsResponse -> String
(Int -> UpdateSettingsResponse -> ShowS)
-> (UpdateSettingsResponse -> String)
-> ([UpdateSettingsResponse] -> ShowS)
-> Show UpdateSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSettingsResponse] -> ShowS
$cshowList :: [UpdateSettingsResponse] -> ShowS
show :: UpdateSettingsResponse -> String
$cshow :: UpdateSettingsResponse -> String
showsPrec :: Int -> UpdateSettingsResponse -> ShowS
$cshowsPrec :: Int -> UpdateSettingsResponse -> ShowS
Prelude.Show, (forall x. UpdateSettingsResponse -> Rep UpdateSettingsResponse x)
-> (forall x.
Rep UpdateSettingsResponse x -> UpdateSettingsResponse)
-> Generic UpdateSettingsResponse
forall x. Rep UpdateSettingsResponse x -> UpdateSettingsResponse
forall x. UpdateSettingsResponse -> Rep UpdateSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSettingsResponse x -> UpdateSettingsResponse
$cfrom :: forall x. UpdateSettingsResponse -> Rep UpdateSettingsResponse x
Prelude.Generic)
newUpdateSettingsResponse ::
Prelude.Int ->
UpdateSettingsResponse
newUpdateSettingsResponse :: Int -> UpdateSettingsResponse
newUpdateSettingsResponse Int
pHttpStatus_ =
UpdateSettingsResponse' :: Maybe Settings -> Int -> UpdateSettingsResponse
UpdateSettingsResponse'
{ $sel:settings:UpdateSettingsResponse' :: Maybe Settings
settings = Maybe Settings
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSettingsResponse_settings :: Lens.Lens' UpdateSettingsResponse (Prelude.Maybe Settings)
updateSettingsResponse_settings :: (Maybe Settings -> f (Maybe Settings))
-> UpdateSettingsResponse -> f UpdateSettingsResponse
updateSettingsResponse_settings = (UpdateSettingsResponse -> Maybe Settings)
-> (UpdateSettingsResponse
-> Maybe Settings -> UpdateSettingsResponse)
-> Lens
UpdateSettingsResponse
UpdateSettingsResponse
(Maybe Settings)
(Maybe Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettingsResponse' {Maybe Settings
settings :: Maybe Settings
$sel:settings:UpdateSettingsResponse' :: UpdateSettingsResponse -> Maybe Settings
settings} -> Maybe Settings
settings) (\s :: UpdateSettingsResponse
s@UpdateSettingsResponse' {} Maybe Settings
a -> UpdateSettingsResponse
s {$sel:settings:UpdateSettingsResponse' :: Maybe Settings
settings = Maybe Settings
a} :: UpdateSettingsResponse)
updateSettingsResponse_httpStatus :: Lens.Lens' UpdateSettingsResponse Prelude.Int
updateSettingsResponse_httpStatus :: (Int -> f Int)
-> UpdateSettingsResponse -> f UpdateSettingsResponse
updateSettingsResponse_httpStatus = (UpdateSettingsResponse -> Int)
-> (UpdateSettingsResponse -> Int -> UpdateSettingsResponse)
-> Lens UpdateSettingsResponse UpdateSettingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSettingsResponse' :: UpdateSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSettingsResponse
s@UpdateSettingsResponse' {} Int
a -> UpdateSettingsResponse
s {$sel:httpStatus:UpdateSettingsResponse' :: Int
httpStatus = Int
a} :: UpdateSettingsResponse)
instance Prelude.NFData UpdateSettingsResponse