{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types
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
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]
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
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.
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'
{ $sel:clientToken:CreatePublishingDestination' :: Maybe Text
clientToken =
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 :: Lens' CreatePublishingDestination (Maybe Text)
createPublishingDestination_clientToken = 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 :: Lens' CreatePublishingDestination Text
createPublishingDestination_detectorId = 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 :: Lens' CreatePublishingDestination DestinationType
createPublishingDestination_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 :: Lens' CreatePublishingDestination DestinationProperties
createPublishingDestination_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 :: (Service -> Service)
-> CreatePublishingDestination
-> Request CreatePublishingDestination
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePublishingDestination
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePublishingDestination)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> CreatePublishingDestinationResponse
CreatePublishingDestinationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"destinationId")
)
instance Prelude.Hashable CreatePublishingDestination where
hashWithSalt :: Int -> CreatePublishingDestination -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DestinationType
destinationType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DestinationProperties
destinationProperties
instance Prelude.NFData CreatePublishingDestination where
rnf :: CreatePublishingDestination -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DestinationType
destinationType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DestinationProperties
destinationProperties
instance Data.ToHeaders CreatePublishingDestination where
toHeaders :: CreatePublishingDestination -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"clientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
forall a. a -> Maybe a
Prelude.Just
(Key
"destinationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DestinationType
destinationType),
forall a. a -> Maybe a
Prelude.Just
( Key
"destinationProperties"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DestinationProperties
destinationProperties
)
]
)
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
detectorId,
ByteString
"/publishingDestination"
]
instance Data.ToQuery CreatePublishingDestination where
toQuery :: CreatePublishingDestination -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreatePublishingDestinationResponse = CreatePublishingDestinationResponse'
{
CreatePublishingDestinationResponse -> Int
httpStatus :: Prelude.Int,
CreatePublishingDestinationResponse -> Text
destinationId :: Prelude.Text
}
deriving (CreatePublishingDestinationResponse
-> CreatePublishingDestinationResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:CreatePublishingDestinationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:destinationId:CreatePublishingDestinationResponse' :: Text
destinationId = Text
pDestinationId_
}
createPublishingDestinationResponse_httpStatus :: Lens.Lens' CreatePublishingDestinationResponse Prelude.Int
createPublishingDestinationResponse_httpStatus :: Lens' CreatePublishingDestinationResponse Int
createPublishingDestinationResponse_httpStatus = 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 :: Lens' CreatePublishingDestinationResponse Text
createPublishingDestinationResponse_destinationId = 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
where
rnf :: CreatePublishingDestinationResponse -> ()
rnf CreatePublishingDestinationResponse' {Int
Text
destinationId :: Text
httpStatus :: Int
$sel:destinationId:CreatePublishingDestinationResponse' :: CreatePublishingDestinationResponse -> Text
$sel:httpStatus:CreatePublishingDestinationResponse' :: CreatePublishingDestinationResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationId