{-# 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.SecurityHub.CreateActionTarget
(
CreateActionTarget (..),
newCreateActionTarget,
createActionTarget_name,
createActionTarget_description,
createActionTarget_id,
CreateActionTargetResponse (..),
newCreateActionTargetResponse,
createActionTargetResponse_httpStatus,
createActionTargetResponse_actionTargetArn,
)
where
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
import Amazonka.SecurityHub.Types
data CreateActionTarget = CreateActionTarget'
{
CreateActionTarget -> Text
name :: Prelude.Text,
CreateActionTarget -> Text
description :: Prelude.Text,
CreateActionTarget -> Text
id :: Prelude.Text
}
deriving (CreateActionTarget -> CreateActionTarget -> Bool
(CreateActionTarget -> CreateActionTarget -> Bool)
-> (CreateActionTarget -> CreateActionTarget -> Bool)
-> Eq CreateActionTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActionTarget -> CreateActionTarget -> Bool
$c/= :: CreateActionTarget -> CreateActionTarget -> Bool
== :: CreateActionTarget -> CreateActionTarget -> Bool
$c== :: CreateActionTarget -> CreateActionTarget -> Bool
Prelude.Eq, ReadPrec [CreateActionTarget]
ReadPrec CreateActionTarget
Int -> ReadS CreateActionTarget
ReadS [CreateActionTarget]
(Int -> ReadS CreateActionTarget)
-> ReadS [CreateActionTarget]
-> ReadPrec CreateActionTarget
-> ReadPrec [CreateActionTarget]
-> Read CreateActionTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActionTarget]
$creadListPrec :: ReadPrec [CreateActionTarget]
readPrec :: ReadPrec CreateActionTarget
$creadPrec :: ReadPrec CreateActionTarget
readList :: ReadS [CreateActionTarget]
$creadList :: ReadS [CreateActionTarget]
readsPrec :: Int -> ReadS CreateActionTarget
$creadsPrec :: Int -> ReadS CreateActionTarget
Prelude.Read, Int -> CreateActionTarget -> ShowS
[CreateActionTarget] -> ShowS
CreateActionTarget -> String
(Int -> CreateActionTarget -> ShowS)
-> (CreateActionTarget -> String)
-> ([CreateActionTarget] -> ShowS)
-> Show CreateActionTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActionTarget] -> ShowS
$cshowList :: [CreateActionTarget] -> ShowS
show :: CreateActionTarget -> String
$cshow :: CreateActionTarget -> String
showsPrec :: Int -> CreateActionTarget -> ShowS
$cshowsPrec :: Int -> CreateActionTarget -> ShowS
Prelude.Show, (forall x. CreateActionTarget -> Rep CreateActionTarget x)
-> (forall x. Rep CreateActionTarget x -> CreateActionTarget)
-> Generic CreateActionTarget
forall x. Rep CreateActionTarget x -> CreateActionTarget
forall x. CreateActionTarget -> Rep CreateActionTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateActionTarget x -> CreateActionTarget
$cfrom :: forall x. CreateActionTarget -> Rep CreateActionTarget x
Prelude.Generic)
newCreateActionTarget ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateActionTarget
newCreateActionTarget :: Text -> Text -> Text -> CreateActionTarget
newCreateActionTarget Text
pName_ Text
pDescription_ Text
pId_ =
CreateActionTarget' :: Text -> Text -> Text -> CreateActionTarget
CreateActionTarget'
{ $sel:name:CreateActionTarget' :: Text
name = Text
pName_,
$sel:description:CreateActionTarget' :: Text
description = Text
pDescription_,
$sel:id:CreateActionTarget' :: Text
id = Text
pId_
}
createActionTarget_name :: Lens.Lens' CreateActionTarget Prelude.Text
createActionTarget_name :: (Text -> f Text) -> CreateActionTarget -> f CreateActionTarget
createActionTarget_name = (CreateActionTarget -> Text)
-> (CreateActionTarget -> Text -> CreateActionTarget)
-> Lens CreateActionTarget CreateActionTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActionTarget' {Text
name :: Text
$sel:name:CreateActionTarget' :: CreateActionTarget -> Text
name} -> Text
name) (\s :: CreateActionTarget
s@CreateActionTarget' {} Text
a -> CreateActionTarget
s {$sel:name:CreateActionTarget' :: Text
name = Text
a} :: CreateActionTarget)
createActionTarget_description :: Lens.Lens' CreateActionTarget Prelude.Text
createActionTarget_description :: (Text -> f Text) -> CreateActionTarget -> f CreateActionTarget
createActionTarget_description = (CreateActionTarget -> Text)
-> (CreateActionTarget -> Text -> CreateActionTarget)
-> Lens CreateActionTarget CreateActionTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActionTarget' {Text
description :: Text
$sel:description:CreateActionTarget' :: CreateActionTarget -> Text
description} -> Text
description) (\s :: CreateActionTarget
s@CreateActionTarget' {} Text
a -> CreateActionTarget
s {$sel:description:CreateActionTarget' :: Text
description = Text
a} :: CreateActionTarget)
createActionTarget_id :: Lens.Lens' CreateActionTarget Prelude.Text
createActionTarget_id :: (Text -> f Text) -> CreateActionTarget -> f CreateActionTarget
createActionTarget_id = (CreateActionTarget -> Text)
-> (CreateActionTarget -> Text -> CreateActionTarget)
-> Lens CreateActionTarget CreateActionTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActionTarget' {Text
id :: Text
$sel:id:CreateActionTarget' :: CreateActionTarget -> Text
id} -> Text
id) (\s :: CreateActionTarget
s@CreateActionTarget' {} Text
a -> CreateActionTarget
s {$sel:id:CreateActionTarget' :: Text
id = Text
a} :: CreateActionTarget)
instance Core.AWSRequest CreateActionTarget where
type
AWSResponse CreateActionTarget =
CreateActionTargetResponse
request :: CreateActionTarget -> Request CreateActionTarget
request = Service -> CreateActionTarget -> Request CreateActionTarget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateActionTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateActionTarget)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateActionTarget))
-> Logger
-> Service
-> Proxy CreateActionTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateActionTarget)))
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 -> CreateActionTargetResponse
CreateActionTargetResponse'
(Int -> Text -> CreateActionTargetResponse)
-> Either String Int
-> Either String (Text -> CreateActionTargetResponse)
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 -> CreateActionTargetResponse)
-> Either String Text -> Either String CreateActionTargetResponse
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
"ActionTargetArn")
)
instance Prelude.Hashable CreateActionTarget
instance Prelude.NFData CreateActionTarget
instance Core.ToHeaders CreateActionTarget where
toHeaders :: CreateActionTarget -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateActionTarget -> 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 CreateActionTarget where
toJSON :: CreateActionTarget -> Value
toJSON CreateActionTarget' {Text
id :: Text
description :: Text
name :: Text
$sel:id:CreateActionTarget' :: CreateActionTarget -> Text
$sel:description:CreateActionTarget' :: CreateActionTarget -> Text
$sel:name:CreateActionTarget' :: CreateActionTarget -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)
instance Core.ToPath CreateActionTarget where
toPath :: CreateActionTarget -> ByteString
toPath = ByteString -> CreateActionTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/actionTargets"
instance Core.ToQuery CreateActionTarget where
toQuery :: CreateActionTarget -> QueryString
toQuery = QueryString -> CreateActionTarget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateActionTargetResponse = CreateActionTargetResponse'
{
CreateActionTargetResponse -> Int
httpStatus :: Prelude.Int,
CreateActionTargetResponse -> Text
actionTargetArn :: Prelude.Text
}
deriving (CreateActionTargetResponse -> CreateActionTargetResponse -> Bool
(CreateActionTargetResponse -> CreateActionTargetResponse -> Bool)
-> (CreateActionTargetResponse
-> CreateActionTargetResponse -> Bool)
-> Eq CreateActionTargetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActionTargetResponse -> CreateActionTargetResponse -> Bool
$c/= :: CreateActionTargetResponse -> CreateActionTargetResponse -> Bool
== :: CreateActionTargetResponse -> CreateActionTargetResponse -> Bool
$c== :: CreateActionTargetResponse -> CreateActionTargetResponse -> Bool
Prelude.Eq, ReadPrec [CreateActionTargetResponse]
ReadPrec CreateActionTargetResponse
Int -> ReadS CreateActionTargetResponse
ReadS [CreateActionTargetResponse]
(Int -> ReadS CreateActionTargetResponse)
-> ReadS [CreateActionTargetResponse]
-> ReadPrec CreateActionTargetResponse
-> ReadPrec [CreateActionTargetResponse]
-> Read CreateActionTargetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActionTargetResponse]
$creadListPrec :: ReadPrec [CreateActionTargetResponse]
readPrec :: ReadPrec CreateActionTargetResponse
$creadPrec :: ReadPrec CreateActionTargetResponse
readList :: ReadS [CreateActionTargetResponse]
$creadList :: ReadS [CreateActionTargetResponse]
readsPrec :: Int -> ReadS CreateActionTargetResponse
$creadsPrec :: Int -> ReadS CreateActionTargetResponse
Prelude.Read, Int -> CreateActionTargetResponse -> ShowS
[CreateActionTargetResponse] -> ShowS
CreateActionTargetResponse -> String
(Int -> CreateActionTargetResponse -> ShowS)
-> (CreateActionTargetResponse -> String)
-> ([CreateActionTargetResponse] -> ShowS)
-> Show CreateActionTargetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActionTargetResponse] -> ShowS
$cshowList :: [CreateActionTargetResponse] -> ShowS
show :: CreateActionTargetResponse -> String
$cshow :: CreateActionTargetResponse -> String
showsPrec :: Int -> CreateActionTargetResponse -> ShowS
$cshowsPrec :: Int -> CreateActionTargetResponse -> ShowS
Prelude.Show, (forall x.
CreateActionTargetResponse -> Rep CreateActionTargetResponse x)
-> (forall x.
Rep CreateActionTargetResponse x -> CreateActionTargetResponse)
-> Generic CreateActionTargetResponse
forall x.
Rep CreateActionTargetResponse x -> CreateActionTargetResponse
forall x.
CreateActionTargetResponse -> Rep CreateActionTargetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateActionTargetResponse x -> CreateActionTargetResponse
$cfrom :: forall x.
CreateActionTargetResponse -> Rep CreateActionTargetResponse x
Prelude.Generic)
newCreateActionTargetResponse ::
Prelude.Int ->
Prelude.Text ->
CreateActionTargetResponse
newCreateActionTargetResponse :: Int -> Text -> CreateActionTargetResponse
newCreateActionTargetResponse
Int
pHttpStatus_
Text
pActionTargetArn_ =
CreateActionTargetResponse' :: Int -> Text -> CreateActionTargetResponse
CreateActionTargetResponse'
{ $sel:httpStatus:CreateActionTargetResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:actionTargetArn:CreateActionTargetResponse' :: Text
actionTargetArn = Text
pActionTargetArn_
}
createActionTargetResponse_httpStatus :: Lens.Lens' CreateActionTargetResponse Prelude.Int
createActionTargetResponse_httpStatus :: (Int -> f Int)
-> CreateActionTargetResponse -> f CreateActionTargetResponse
createActionTargetResponse_httpStatus = (CreateActionTargetResponse -> Int)
-> (CreateActionTargetResponse
-> Int -> CreateActionTargetResponse)
-> Lens
CreateActionTargetResponse CreateActionTargetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActionTargetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateActionTargetResponse' :: CreateActionTargetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateActionTargetResponse
s@CreateActionTargetResponse' {} Int
a -> CreateActionTargetResponse
s {$sel:httpStatus:CreateActionTargetResponse' :: Int
httpStatus = Int
a} :: CreateActionTargetResponse)
createActionTargetResponse_actionTargetArn :: Lens.Lens' CreateActionTargetResponse Prelude.Text
createActionTargetResponse_actionTargetArn :: (Text -> f Text)
-> CreateActionTargetResponse -> f CreateActionTargetResponse
createActionTargetResponse_actionTargetArn = (CreateActionTargetResponse -> Text)
-> (CreateActionTargetResponse
-> Text -> CreateActionTargetResponse)
-> Lens
CreateActionTargetResponse CreateActionTargetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActionTargetResponse' {Text
actionTargetArn :: Text
$sel:actionTargetArn:CreateActionTargetResponse' :: CreateActionTargetResponse -> Text
actionTargetArn} -> Text
actionTargetArn) (\s :: CreateActionTargetResponse
s@CreateActionTargetResponse' {} Text
a -> CreateActionTargetResponse
s {$sel:actionTargetArn:CreateActionTargetResponse' :: Text
actionTargetArn = Text
a} :: CreateActionTargetResponse)
instance Prelude.NFData CreateActionTargetResponse