{-# 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.CreatePublishingDestination
(
CreatePublishingDestination (..),
newCreatePublishingDestination,
createPublishingDestination_clientToken,
createPublishingDestination_detectorId,
createPublishingDestination_destinationType,
createPublishingDestination_destinationProperties,
CreatePublishingDestinationResponse (..),
newCreatePublishingDestinationResponse,
createPublishingDestinationResponse_httpStatus,
createPublishingDestinationResponse_destinationId,
)
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 CreatePublishingDestination = CreatePublishingDestination'
{
CreatePublishingDestination -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreatePublishingDestination -> Text
detectorId :: Prelude.Text,
CreatePublishingDestination -> DestinationType
destinationType :: DestinationType,
CreatePublishingDestination -> DestinationProperties
destinationProperties :: DestinationProperties
}
deriving (CreatePublishingDestination -> CreatePublishingDestination -> Bool
(CreatePublishingDestination
-> CreatePublishingDestination -> Bool)
-> (CreatePublishingDestination
-> CreatePublishingDestination -> Bool)
-> Eq CreatePublishingDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePublishingDestination -> CreatePublishingDestination -> Bool
$c/= :: CreatePublishingDestination -> CreatePublishingDestination -> Bool
== :: CreatePublishingDestination -> CreatePublishingDestination -> Bool
$c== :: CreatePublishingDestination -> CreatePublishingDestination -> Bool
Prelude.Eq, ReadPrec [CreatePublishingDestination]
ReadPrec CreatePublishingDestination
Int -> ReadS CreatePublishingDestination
ReadS [CreatePublishingDestination]
(Int -> ReadS CreatePublishingDestination)
-> ReadS [CreatePublishingDestination]
-> ReadPrec CreatePublishingDestination
-> ReadPrec [CreatePublishingDestination]
-> Read CreatePublishingDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePublishingDestination]
$creadListPrec :: ReadPrec [CreatePublishingDestination]
readPrec :: ReadPrec CreatePublishingDestination
$creadPrec :: ReadPrec CreatePublishingDestination
readList :: ReadS [CreatePublishingDestination]
$creadList :: ReadS [CreatePublishingDestination]
readsPrec :: Int -> ReadS CreatePublishingDestination
$creadsPrec :: Int -> ReadS CreatePublishingDestination
Prelude.Read, Int -> CreatePublishingDestination -> ShowS
[CreatePublishingDestination] -> ShowS
CreatePublishingDestination -> String
(Int -> CreatePublishingDestination -> ShowS)
-> (CreatePublishingDestination -> String)
-> ([CreatePublishingDestination] -> ShowS)
-> Show CreatePublishingDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePublishingDestination] -> ShowS
$cshowList :: [CreatePublishingDestination] -> ShowS
show :: CreatePublishingDestination -> String
$cshow :: CreatePublishingDestination -> String
showsPrec :: Int -> CreatePublishingDestination -> ShowS
$cshowsPrec :: Int -> CreatePublishingDestination -> ShowS
Prelude.Show, (forall x.
CreatePublishingDestination -> Rep CreatePublishingDestination x)
-> (forall x.
Rep CreatePublishingDestination x -> CreatePublishingDestination)
-> Generic CreatePublishingDestination
forall x.
Rep CreatePublishingDestination x -> CreatePublishingDestination
forall x.
CreatePublishingDestination -> Rep CreatePublishingDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePublishingDestination x -> CreatePublishingDestination
$cfrom :: forall x.
CreatePublishingDestination -> Rep CreatePublishingDestination x
Prelude.Generic)
newCreatePublishingDestination ::
Prelude.Text ->
DestinationType ->
DestinationProperties ->
CreatePublishingDestination
newCreatePublishingDestination :: Text
-> DestinationType
-> DestinationProperties
-> CreatePublishingDestination
newCreatePublishingDestination
Text
pDetectorId_
DestinationType
pDestinationType_
DestinationProperties
pDestinationProperties_ =
CreatePublishingDestination' :: Maybe Text
-> Text
-> DestinationType
-> DestinationProperties
-> CreatePublishingDestination
CreatePublishingDestination'
{ $sel:clientToken:CreatePublishingDestination' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:CreatePublishingDestination' :: Text
detectorId = Text
pDetectorId_,
$sel:destinationType:CreatePublishingDestination' :: DestinationType
destinationType = DestinationType
pDestinationType_,
$sel:destinationProperties:CreatePublishingDestination' :: DestinationProperties
destinationProperties =
DestinationProperties
pDestinationProperties_
}
createPublishingDestination_clientToken :: Lens.Lens' CreatePublishingDestination (Prelude.Maybe Prelude.Text)
createPublishingDestination_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreatePublishingDestination -> f CreatePublishingDestination
createPublishingDestination_clientToken = (CreatePublishingDestination -> Maybe Text)
-> (CreatePublishingDestination
-> Maybe Text -> CreatePublishingDestination)
-> Lens
CreatePublishingDestination
CreatePublishingDestination
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestination' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreatePublishingDestination' :: CreatePublishingDestination -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreatePublishingDestination
s@CreatePublishingDestination' {} Maybe Text
a -> CreatePublishingDestination
s {$sel:clientToken:CreatePublishingDestination' :: Maybe Text
clientToken = Maybe Text
a} :: CreatePublishingDestination)
createPublishingDestination_detectorId :: Lens.Lens' CreatePublishingDestination Prelude.Text
createPublishingDestination_detectorId :: (Text -> f Text)
-> CreatePublishingDestination -> f CreatePublishingDestination
createPublishingDestination_detectorId = (CreatePublishingDestination -> Text)
-> (CreatePublishingDestination
-> Text -> CreatePublishingDestination)
-> Lens
CreatePublishingDestination CreatePublishingDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestination' {Text
detectorId :: Text
$sel:detectorId:CreatePublishingDestination' :: CreatePublishingDestination -> Text
detectorId} -> Text
detectorId) (\s :: CreatePublishingDestination
s@CreatePublishingDestination' {} Text
a -> CreatePublishingDestination
s {$sel:detectorId:CreatePublishingDestination' :: Text
detectorId = Text
a} :: CreatePublishingDestination)
createPublishingDestination_destinationType :: Lens.Lens' CreatePublishingDestination DestinationType
createPublishingDestination_destinationType :: (DestinationType -> f DestinationType)
-> CreatePublishingDestination -> f CreatePublishingDestination
createPublishingDestination_destinationType = (CreatePublishingDestination -> DestinationType)
-> (CreatePublishingDestination
-> DestinationType -> CreatePublishingDestination)
-> Lens
CreatePublishingDestination
CreatePublishingDestination
DestinationType
DestinationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestination' {DestinationType
destinationType :: DestinationType
$sel:destinationType:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationType
destinationType} -> DestinationType
destinationType) (\s :: CreatePublishingDestination
s@CreatePublishingDestination' {} DestinationType
a -> CreatePublishingDestination
s {$sel:destinationType:CreatePublishingDestination' :: DestinationType
destinationType = DestinationType
a} :: CreatePublishingDestination)
createPublishingDestination_destinationProperties :: Lens.Lens' CreatePublishingDestination DestinationProperties
createPublishingDestination_destinationProperties :: (DestinationProperties -> f DestinationProperties)
-> CreatePublishingDestination -> f CreatePublishingDestination
createPublishingDestination_destinationProperties = (CreatePublishingDestination -> DestinationProperties)
-> (CreatePublishingDestination
-> DestinationProperties -> CreatePublishingDestination)
-> Lens
CreatePublishingDestination
CreatePublishingDestination
DestinationProperties
DestinationProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestination' {DestinationProperties
destinationProperties :: DestinationProperties
$sel:destinationProperties:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationProperties
destinationProperties} -> DestinationProperties
destinationProperties) (\s :: CreatePublishingDestination
s@CreatePublishingDestination' {} DestinationProperties
a -> CreatePublishingDestination
s {$sel:destinationProperties:CreatePublishingDestination' :: DestinationProperties
destinationProperties = DestinationProperties
a} :: CreatePublishingDestination)
instance Core.AWSRequest CreatePublishingDestination where
type
AWSResponse CreatePublishingDestination =
CreatePublishingDestinationResponse
request :: CreatePublishingDestination -> Request CreatePublishingDestination
request = Service
-> CreatePublishingDestination
-> Request CreatePublishingDestination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePublishingDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePublishingDestination)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePublishingDestination))
-> Logger
-> Service
-> Proxy CreatePublishingDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePublishingDestination)))
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 ->
Int -> Text -> CreatePublishingDestinationResponse
CreatePublishingDestinationResponse'
(Int -> Text -> CreatePublishingDestinationResponse)
-> Either String Int
-> Either String (Text -> CreatePublishingDestinationResponse)
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))
Either String (Text -> CreatePublishingDestinationResponse)
-> Either String Text
-> Either String CreatePublishingDestinationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"destinationId")
)
instance Prelude.Hashable CreatePublishingDestination
instance Prelude.NFData CreatePublishingDestination
instance Core.ToHeaders CreatePublishingDestination where
toHeaders :: CreatePublishingDestination -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePublishingDestination -> 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 CreatePublishingDestination where
toJSON :: CreatePublishingDestination -> Value
toJSON CreatePublishingDestination' {Maybe Text
Text
DestinationProperties
DestinationType
destinationProperties :: DestinationProperties
destinationType :: DestinationType
detectorId :: Text
clientToken :: Maybe Text
$sel:destinationProperties:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationProperties
$sel:destinationType:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationType
$sel:detectorId:CreatePublishingDestination' :: CreatePublishingDestination -> Text
$sel:clientToken:CreatePublishingDestination' :: CreatePublishingDestination -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"destinationType" Text -> DestinationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DestinationType
destinationType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"destinationProperties"
Text -> DestinationProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DestinationProperties
destinationProperties
)
]
)
instance Core.ToPath CreatePublishingDestination where
toPath :: CreatePublishingDestination -> ByteString
toPath CreatePublishingDestination' {Maybe Text
Text
DestinationProperties
DestinationType
destinationProperties :: DestinationProperties
destinationType :: DestinationType
detectorId :: Text
clientToken :: Maybe Text
$sel:destinationProperties:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationProperties
$sel:destinationType:CreatePublishingDestination' :: CreatePublishingDestination -> DestinationType
$sel:detectorId:CreatePublishingDestination' :: CreatePublishingDestination -> Text
$sel:clientToken:CreatePublishingDestination' :: CreatePublishingDestination -> Maybe Text
..} =
[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"
]
instance Core.ToQuery CreatePublishingDestination where
toQuery :: CreatePublishingDestination -> QueryString
toQuery = QueryString -> CreatePublishingDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePublishingDestinationResponse = CreatePublishingDestinationResponse'
{
CreatePublishingDestinationResponse -> Int
httpStatus :: Prelude.Int,
CreatePublishingDestinationResponse -> Text
destinationId :: Prelude.Text
}
deriving (CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
(CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool)
-> (CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool)
-> Eq CreatePublishingDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
$c/= :: CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
== :: CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
$c== :: CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
Prelude.Eq, ReadPrec [CreatePublishingDestinationResponse]
ReadPrec CreatePublishingDestinationResponse
Int -> ReadS CreatePublishingDestinationResponse
ReadS [CreatePublishingDestinationResponse]
(Int -> ReadS CreatePublishingDestinationResponse)
-> ReadS [CreatePublishingDestinationResponse]
-> ReadPrec CreatePublishingDestinationResponse
-> ReadPrec [CreatePublishingDestinationResponse]
-> Read CreatePublishingDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePublishingDestinationResponse]
$creadListPrec :: ReadPrec [CreatePublishingDestinationResponse]
readPrec :: ReadPrec CreatePublishingDestinationResponse
$creadPrec :: ReadPrec CreatePublishingDestinationResponse
readList :: ReadS [CreatePublishingDestinationResponse]
$creadList :: ReadS [CreatePublishingDestinationResponse]
readsPrec :: Int -> ReadS CreatePublishingDestinationResponse
$creadsPrec :: Int -> ReadS CreatePublishingDestinationResponse
Prelude.Read, Int -> CreatePublishingDestinationResponse -> ShowS
[CreatePublishingDestinationResponse] -> ShowS
CreatePublishingDestinationResponse -> String
(Int -> CreatePublishingDestinationResponse -> ShowS)
-> (CreatePublishingDestinationResponse -> String)
-> ([CreatePublishingDestinationResponse] -> ShowS)
-> Show CreatePublishingDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePublishingDestinationResponse] -> ShowS
$cshowList :: [CreatePublishingDestinationResponse] -> ShowS
show :: CreatePublishingDestinationResponse -> String
$cshow :: CreatePublishingDestinationResponse -> String
showsPrec :: Int -> CreatePublishingDestinationResponse -> ShowS
$cshowsPrec :: Int -> CreatePublishingDestinationResponse -> ShowS
Prelude.Show, (forall x.
CreatePublishingDestinationResponse
-> Rep CreatePublishingDestinationResponse x)
-> (forall x.
Rep CreatePublishingDestinationResponse x
-> CreatePublishingDestinationResponse)
-> Generic CreatePublishingDestinationResponse
forall x.
Rep CreatePublishingDestinationResponse x
-> CreatePublishingDestinationResponse
forall x.
CreatePublishingDestinationResponse
-> Rep CreatePublishingDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePublishingDestinationResponse x
-> CreatePublishingDestinationResponse
$cfrom :: forall x.
CreatePublishingDestinationResponse
-> Rep CreatePublishingDestinationResponse x
Prelude.Generic)
newCreatePublishingDestinationResponse ::
Prelude.Int ->
Prelude.Text ->
CreatePublishingDestinationResponse
newCreatePublishingDestinationResponse :: Int -> Text -> CreatePublishingDestinationResponse
newCreatePublishingDestinationResponse
Int
pHttpStatus_
Text
pDestinationId_ =
CreatePublishingDestinationResponse' :: Int -> Text -> CreatePublishingDestinationResponse
CreatePublishingDestinationResponse'
{ $sel:httpStatus:CreatePublishingDestinationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:destinationId:CreatePublishingDestinationResponse' :: Text
destinationId = Text
pDestinationId_
}
createPublishingDestinationResponse_httpStatus :: Lens.Lens' CreatePublishingDestinationResponse Prelude.Int
createPublishingDestinationResponse_httpStatus :: (Int -> f Int)
-> CreatePublishingDestinationResponse
-> f CreatePublishingDestinationResponse
createPublishingDestinationResponse_httpStatus = (CreatePublishingDestinationResponse -> Int)
-> (CreatePublishingDestinationResponse
-> Int -> CreatePublishingDestinationResponse)
-> Lens
CreatePublishingDestinationResponse
CreatePublishingDestinationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePublishingDestinationResponse' :: CreatePublishingDestinationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePublishingDestinationResponse
s@CreatePublishingDestinationResponse' {} Int
a -> CreatePublishingDestinationResponse
s {$sel:httpStatus:CreatePublishingDestinationResponse' :: Int
httpStatus = Int
a} :: CreatePublishingDestinationResponse)
createPublishingDestinationResponse_destinationId :: Lens.Lens' CreatePublishingDestinationResponse Prelude.Text
createPublishingDestinationResponse_destinationId :: (Text -> f Text)
-> CreatePublishingDestinationResponse
-> f CreatePublishingDestinationResponse
createPublishingDestinationResponse_destinationId = (CreatePublishingDestinationResponse -> Text)
-> (CreatePublishingDestinationResponse
-> Text -> CreatePublishingDestinationResponse)
-> Lens
CreatePublishingDestinationResponse
CreatePublishingDestinationResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublishingDestinationResponse' {Text
destinationId :: Text
$sel:destinationId:CreatePublishingDestinationResponse' :: CreatePublishingDestinationResponse -> Text
destinationId} -> Text
destinationId) (\s :: CreatePublishingDestinationResponse
s@CreatePublishingDestinationResponse' {} Text
a -> CreatePublishingDestinationResponse
s {$sel:destinationId:CreatePublishingDestinationResponse' :: Text
destinationId = Text
a} :: CreatePublishingDestinationResponse)
instance
Prelude.NFData
CreatePublishingDestinationResponse