{-# 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.GuardDuty.UpdatePublishingDestination
(
UpdatePublishingDestination (..),
newUpdatePublishingDestination,
updatePublishingDestination_destinationProperties,
updatePublishingDestination_detectorId,
updatePublishingDestination_destinationId,
UpdatePublishingDestinationResponse (..),
newUpdatePublishingDestinationResponse,
updatePublishingDestinationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
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 UpdatePublishingDestination = UpdatePublishingDestination'
{
UpdatePublishingDestination -> Maybe DestinationProperties
destinationProperties :: Prelude.Maybe DestinationProperties,
UpdatePublishingDestination -> Text
detectorId :: Prelude.Text,
UpdatePublishingDestination -> Text
destinationId :: Prelude.Text
}
deriving (UpdatePublishingDestination -> UpdatePublishingDestination -> Bool
(UpdatePublishingDestination
-> UpdatePublishingDestination -> Bool)
-> (UpdatePublishingDestination
-> UpdatePublishingDestination -> Bool)
-> Eq UpdatePublishingDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePublishingDestination -> UpdatePublishingDestination -> Bool
$c/= :: UpdatePublishingDestination -> UpdatePublishingDestination -> Bool
== :: UpdatePublishingDestination -> UpdatePublishingDestination -> Bool
$c== :: UpdatePublishingDestination -> UpdatePublishingDestination -> Bool
Prelude.Eq, ReadPrec [UpdatePublishingDestination]
ReadPrec UpdatePublishingDestination
Int -> ReadS UpdatePublishingDestination
ReadS [UpdatePublishingDestination]
(Int -> ReadS UpdatePublishingDestination)
-> ReadS [UpdatePublishingDestination]
-> ReadPrec UpdatePublishingDestination
-> ReadPrec [UpdatePublishingDestination]
-> Read UpdatePublishingDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePublishingDestination]
$creadListPrec :: ReadPrec [UpdatePublishingDestination]
readPrec :: ReadPrec UpdatePublishingDestination
$creadPrec :: ReadPrec UpdatePublishingDestination
readList :: ReadS [UpdatePublishingDestination]
$creadList :: ReadS [UpdatePublishingDestination]
readsPrec :: Int -> ReadS UpdatePublishingDestination
$creadsPrec :: Int -> ReadS UpdatePublishingDestination
Prelude.Read, Int -> UpdatePublishingDestination -> ShowS
[UpdatePublishingDestination] -> ShowS
UpdatePublishingDestination -> String
(Int -> UpdatePublishingDestination -> ShowS)
-> (UpdatePublishingDestination -> String)
-> ([UpdatePublishingDestination] -> ShowS)
-> Show UpdatePublishingDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePublishingDestination] -> ShowS
$cshowList :: [UpdatePublishingDestination] -> ShowS
show :: UpdatePublishingDestination -> String
$cshow :: UpdatePublishingDestination -> String
showsPrec :: Int -> UpdatePublishingDestination -> ShowS
$cshowsPrec :: Int -> UpdatePublishingDestination -> ShowS
Prelude.Show, (forall x.
UpdatePublishingDestination -> Rep UpdatePublishingDestination x)
-> (forall x.
Rep UpdatePublishingDestination x -> UpdatePublishingDestination)
-> Generic UpdatePublishingDestination
forall x.
Rep UpdatePublishingDestination x -> UpdatePublishingDestination
forall x.
UpdatePublishingDestination -> Rep UpdatePublishingDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdatePublishingDestination x -> UpdatePublishingDestination
$cfrom :: forall x.
UpdatePublishingDestination -> Rep UpdatePublishingDestination x
Prelude.Generic)
newUpdatePublishingDestination ::
Prelude.Text ->
Prelude.Text ->
UpdatePublishingDestination
newUpdatePublishingDestination :: Text -> Text -> UpdatePublishingDestination
newUpdatePublishingDestination
Text
pDetectorId_
Text
pDestinationId_ =
UpdatePublishingDestination' :: Maybe DestinationProperties
-> Text -> Text -> UpdatePublishingDestination
UpdatePublishingDestination'
{ $sel:destinationProperties:UpdatePublishingDestination' :: Maybe DestinationProperties
destinationProperties =
Maybe DestinationProperties
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:UpdatePublishingDestination' :: Text
detectorId = Text
pDetectorId_,
$sel:destinationId:UpdatePublishingDestination' :: Text
destinationId = Text
pDestinationId_
}
updatePublishingDestination_destinationProperties :: Lens.Lens' UpdatePublishingDestination (Prelude.Maybe DestinationProperties)
updatePublishingDestination_destinationProperties :: (Maybe DestinationProperties -> f (Maybe DestinationProperties))
-> UpdatePublishingDestination -> f UpdatePublishingDestination
updatePublishingDestination_destinationProperties = (UpdatePublishingDestination -> Maybe DestinationProperties)
-> (UpdatePublishingDestination
-> Maybe DestinationProperties -> UpdatePublishingDestination)
-> Lens
UpdatePublishingDestination
UpdatePublishingDestination
(Maybe DestinationProperties)
(Maybe DestinationProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublishingDestination' {Maybe DestinationProperties
destinationProperties :: Maybe DestinationProperties
$sel:destinationProperties:UpdatePublishingDestination' :: UpdatePublishingDestination -> Maybe DestinationProperties
destinationProperties} -> Maybe DestinationProperties
destinationProperties) (\s :: UpdatePublishingDestination
s@UpdatePublishingDestination' {} Maybe DestinationProperties
a -> UpdatePublishingDestination
s {$sel:destinationProperties:UpdatePublishingDestination' :: Maybe DestinationProperties
destinationProperties = Maybe DestinationProperties
a} :: UpdatePublishingDestination)
updatePublishingDestination_detectorId :: Lens.Lens' UpdatePublishingDestination Prelude.Text
updatePublishingDestination_detectorId :: (Text -> f Text)
-> UpdatePublishingDestination -> f UpdatePublishingDestination
updatePublishingDestination_detectorId = (UpdatePublishingDestination -> Text)
-> (UpdatePublishingDestination
-> Text -> UpdatePublishingDestination)
-> Lens
UpdatePublishingDestination UpdatePublishingDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublishingDestination' {Text
detectorId :: Text
$sel:detectorId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
detectorId} -> Text
detectorId) (\s :: UpdatePublishingDestination
s@UpdatePublishingDestination' {} Text
a -> UpdatePublishingDestination
s {$sel:detectorId:UpdatePublishingDestination' :: Text
detectorId = Text
a} :: UpdatePublishingDestination)
updatePublishingDestination_destinationId :: Lens.Lens' UpdatePublishingDestination Prelude.Text
updatePublishingDestination_destinationId :: (Text -> f Text)
-> UpdatePublishingDestination -> f UpdatePublishingDestination
updatePublishingDestination_destinationId = (UpdatePublishingDestination -> Text)
-> (UpdatePublishingDestination
-> Text -> UpdatePublishingDestination)
-> Lens
UpdatePublishingDestination UpdatePublishingDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublishingDestination' {Text
destinationId :: Text
$sel:destinationId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
destinationId} -> Text
destinationId) (\s :: UpdatePublishingDestination
s@UpdatePublishingDestination' {} Text
a -> UpdatePublishingDestination
s {$sel:destinationId:UpdatePublishingDestination' :: Text
destinationId = Text
a} :: UpdatePublishingDestination)
instance Core.AWSRequest UpdatePublishingDestination where
type
AWSResponse UpdatePublishingDestination =
UpdatePublishingDestinationResponse
request :: UpdatePublishingDestination -> Request UpdatePublishingDestination
request = Service
-> UpdatePublishingDestination
-> Request UpdatePublishingDestination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePublishingDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdatePublishingDestination)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdatePublishingDestination))
-> Logger
-> Service
-> Proxy UpdatePublishingDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdatePublishingDestination)))
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 -> UpdatePublishingDestinationResponse
UpdatePublishingDestinationResponse'
(Int -> UpdatePublishingDestinationResponse)
-> Either String Int
-> Either String UpdatePublishingDestinationResponse
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 UpdatePublishingDestination
instance Prelude.NFData UpdatePublishingDestination
instance Core.ToHeaders UpdatePublishingDestination where
toHeaders :: UpdatePublishingDestination -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdatePublishingDestination -> 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 UpdatePublishingDestination where
toJSON :: UpdatePublishingDestination -> Value
toJSON UpdatePublishingDestination' {Maybe DestinationProperties
Text
destinationId :: Text
detectorId :: Text
destinationProperties :: Maybe DestinationProperties
$sel:destinationId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
$sel:detectorId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
$sel:destinationProperties:UpdatePublishingDestination' :: UpdatePublishingDestination -> Maybe DestinationProperties
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"destinationProperties" Text -> DestinationProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DestinationProperties -> Pair)
-> Maybe DestinationProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DestinationProperties
destinationProperties
]
)
instance Core.ToPath UpdatePublishingDestination where
toPath :: UpdatePublishingDestination -> ByteString
toPath UpdatePublishingDestination' {Maybe DestinationProperties
Text
destinationId :: Text
detectorId :: Text
destinationProperties :: Maybe DestinationProperties
$sel:destinationId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
$sel:detectorId:UpdatePublishingDestination' :: UpdatePublishingDestination -> Text
$sel:destinationProperties:UpdatePublishingDestination' :: UpdatePublishingDestination -> Maybe DestinationProperties
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/publishingDestination/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
destinationId
]
instance Core.ToQuery UpdatePublishingDestination where
toQuery :: UpdatePublishingDestination -> QueryString
toQuery = QueryString -> UpdatePublishingDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePublishingDestinationResponse = UpdatePublishingDestinationResponse'
{
UpdatePublishingDestinationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool
(UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool)
-> (UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool)
-> Eq UpdatePublishingDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool
$c/= :: UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool
== :: UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool
$c== :: UpdatePublishingDestinationResponse
-> UpdatePublishingDestinationResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePublishingDestinationResponse]
ReadPrec UpdatePublishingDestinationResponse
Int -> ReadS UpdatePublishingDestinationResponse
ReadS [UpdatePublishingDestinationResponse]
(Int -> ReadS UpdatePublishingDestinationResponse)
-> ReadS [UpdatePublishingDestinationResponse]
-> ReadPrec UpdatePublishingDestinationResponse
-> ReadPrec [UpdatePublishingDestinationResponse]
-> Read UpdatePublishingDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePublishingDestinationResponse]
$creadListPrec :: ReadPrec [UpdatePublishingDestinationResponse]
readPrec :: ReadPrec UpdatePublishingDestinationResponse
$creadPrec :: ReadPrec UpdatePublishingDestinationResponse
readList :: ReadS [UpdatePublishingDestinationResponse]
$creadList :: ReadS [UpdatePublishingDestinationResponse]
readsPrec :: Int -> ReadS UpdatePublishingDestinationResponse
$creadsPrec :: Int -> ReadS UpdatePublishingDestinationResponse
Prelude.Read, Int -> UpdatePublishingDestinationResponse -> ShowS
[UpdatePublishingDestinationResponse] -> ShowS
UpdatePublishingDestinationResponse -> String
(Int -> UpdatePublishingDestinationResponse -> ShowS)
-> (UpdatePublishingDestinationResponse -> String)
-> ([UpdatePublishingDestinationResponse] -> ShowS)
-> Show UpdatePublishingDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePublishingDestinationResponse] -> ShowS
$cshowList :: [UpdatePublishingDestinationResponse] -> ShowS
show :: UpdatePublishingDestinationResponse -> String
$cshow :: UpdatePublishingDestinationResponse -> String
showsPrec :: Int -> UpdatePublishingDestinationResponse -> ShowS
$cshowsPrec :: Int -> UpdatePublishingDestinationResponse -> ShowS
Prelude.Show, (forall x.
UpdatePublishingDestinationResponse
-> Rep UpdatePublishingDestinationResponse x)
-> (forall x.
Rep UpdatePublishingDestinationResponse x
-> UpdatePublishingDestinationResponse)
-> Generic UpdatePublishingDestinationResponse
forall x.
Rep UpdatePublishingDestinationResponse x
-> UpdatePublishingDestinationResponse
forall x.
UpdatePublishingDestinationResponse
-> Rep UpdatePublishingDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdatePublishingDestinationResponse x
-> UpdatePublishingDestinationResponse
$cfrom :: forall x.
UpdatePublishingDestinationResponse
-> Rep UpdatePublishingDestinationResponse x
Prelude.Generic)
newUpdatePublishingDestinationResponse ::
Prelude.Int ->
UpdatePublishingDestinationResponse
newUpdatePublishingDestinationResponse :: Int -> UpdatePublishingDestinationResponse
newUpdatePublishingDestinationResponse Int
pHttpStatus_ =
UpdatePublishingDestinationResponse' :: Int -> UpdatePublishingDestinationResponse
UpdatePublishingDestinationResponse'
{ $sel:httpStatus:UpdatePublishingDestinationResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updatePublishingDestinationResponse_httpStatus :: Lens.Lens' UpdatePublishingDestinationResponse Prelude.Int
updatePublishingDestinationResponse_httpStatus :: (Int -> f Int)
-> UpdatePublishingDestinationResponse
-> f UpdatePublishingDestinationResponse
updatePublishingDestinationResponse_httpStatus = (UpdatePublishingDestinationResponse -> Int)
-> (UpdatePublishingDestinationResponse
-> Int -> UpdatePublishingDestinationResponse)
-> Lens
UpdatePublishingDestinationResponse
UpdatePublishingDestinationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePublishingDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePublishingDestinationResponse' :: UpdatePublishingDestinationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePublishingDestinationResponse
s@UpdatePublishingDestinationResponse' {} Int
a -> UpdatePublishingDestinationResponse
s {$sel:httpStatus:UpdatePublishingDestinationResponse' :: Int
httpStatus = Int
a} :: UpdatePublishingDestinationResponse)
instance
Prelude.NFData
UpdatePublishingDestinationResponse