{-# 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.Inspector.CreateAssessmentTarget
(
CreateAssessmentTarget (..),
newCreateAssessmentTarget,
createAssessmentTarget_resourceGroupArn,
createAssessmentTarget_assessmentTargetName,
CreateAssessmentTargetResponse (..),
newCreateAssessmentTargetResponse,
createAssessmentTargetResponse_httpStatus,
createAssessmentTargetResponse_assessmentTargetArn,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.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 CreateAssessmentTarget = CreateAssessmentTarget'
{
CreateAssessmentTarget -> Maybe Text
resourceGroupArn :: Prelude.Maybe Prelude.Text,
CreateAssessmentTarget -> Text
assessmentTargetName :: Prelude.Text
}
deriving (CreateAssessmentTarget -> CreateAssessmentTarget -> Bool
(CreateAssessmentTarget -> CreateAssessmentTarget -> Bool)
-> (CreateAssessmentTarget -> CreateAssessmentTarget -> Bool)
-> Eq CreateAssessmentTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssessmentTarget -> CreateAssessmentTarget -> Bool
$c/= :: CreateAssessmentTarget -> CreateAssessmentTarget -> Bool
== :: CreateAssessmentTarget -> CreateAssessmentTarget -> Bool
$c== :: CreateAssessmentTarget -> CreateAssessmentTarget -> Bool
Prelude.Eq, ReadPrec [CreateAssessmentTarget]
ReadPrec CreateAssessmentTarget
Int -> ReadS CreateAssessmentTarget
ReadS [CreateAssessmentTarget]
(Int -> ReadS CreateAssessmentTarget)
-> ReadS [CreateAssessmentTarget]
-> ReadPrec CreateAssessmentTarget
-> ReadPrec [CreateAssessmentTarget]
-> Read CreateAssessmentTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssessmentTarget]
$creadListPrec :: ReadPrec [CreateAssessmentTarget]
readPrec :: ReadPrec CreateAssessmentTarget
$creadPrec :: ReadPrec CreateAssessmentTarget
readList :: ReadS [CreateAssessmentTarget]
$creadList :: ReadS [CreateAssessmentTarget]
readsPrec :: Int -> ReadS CreateAssessmentTarget
$creadsPrec :: Int -> ReadS CreateAssessmentTarget
Prelude.Read, Int -> CreateAssessmentTarget -> ShowS
[CreateAssessmentTarget] -> ShowS
CreateAssessmentTarget -> String
(Int -> CreateAssessmentTarget -> ShowS)
-> (CreateAssessmentTarget -> String)
-> ([CreateAssessmentTarget] -> ShowS)
-> Show CreateAssessmentTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssessmentTarget] -> ShowS
$cshowList :: [CreateAssessmentTarget] -> ShowS
show :: CreateAssessmentTarget -> String
$cshow :: CreateAssessmentTarget -> String
showsPrec :: Int -> CreateAssessmentTarget -> ShowS
$cshowsPrec :: Int -> CreateAssessmentTarget -> ShowS
Prelude.Show, (forall x. CreateAssessmentTarget -> Rep CreateAssessmentTarget x)
-> (forall x.
Rep CreateAssessmentTarget x -> CreateAssessmentTarget)
-> Generic CreateAssessmentTarget
forall x. Rep CreateAssessmentTarget x -> CreateAssessmentTarget
forall x. CreateAssessmentTarget -> Rep CreateAssessmentTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAssessmentTarget x -> CreateAssessmentTarget
$cfrom :: forall x. CreateAssessmentTarget -> Rep CreateAssessmentTarget x
Prelude.Generic)
newCreateAssessmentTarget ::
Prelude.Text ->
CreateAssessmentTarget
newCreateAssessmentTarget :: Text -> CreateAssessmentTarget
newCreateAssessmentTarget Text
pAssessmentTargetName_ =
CreateAssessmentTarget' :: Maybe Text -> Text -> CreateAssessmentTarget
CreateAssessmentTarget'
{ $sel:resourceGroupArn:CreateAssessmentTarget' :: Maybe Text
resourceGroupArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assessmentTargetName:CreateAssessmentTarget' :: Text
assessmentTargetName = Text
pAssessmentTargetName_
}
createAssessmentTarget_resourceGroupArn :: Lens.Lens' CreateAssessmentTarget (Prelude.Maybe Prelude.Text)
createAssessmentTarget_resourceGroupArn :: (Maybe Text -> f (Maybe Text))
-> CreateAssessmentTarget -> f CreateAssessmentTarget
createAssessmentTarget_resourceGroupArn = (CreateAssessmentTarget -> Maybe Text)
-> (CreateAssessmentTarget -> Maybe Text -> CreateAssessmentTarget)
-> Lens
CreateAssessmentTarget
CreateAssessmentTarget
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentTarget' {Maybe Text
resourceGroupArn :: Maybe Text
$sel:resourceGroupArn:CreateAssessmentTarget' :: CreateAssessmentTarget -> Maybe Text
resourceGroupArn} -> Maybe Text
resourceGroupArn) (\s :: CreateAssessmentTarget
s@CreateAssessmentTarget' {} Maybe Text
a -> CreateAssessmentTarget
s {$sel:resourceGroupArn:CreateAssessmentTarget' :: Maybe Text
resourceGroupArn = Maybe Text
a} :: CreateAssessmentTarget)
createAssessmentTarget_assessmentTargetName :: Lens.Lens' CreateAssessmentTarget Prelude.Text
createAssessmentTarget_assessmentTargetName :: (Text -> f Text)
-> CreateAssessmentTarget -> f CreateAssessmentTarget
createAssessmentTarget_assessmentTargetName = (CreateAssessmentTarget -> Text)
-> (CreateAssessmentTarget -> Text -> CreateAssessmentTarget)
-> Lens CreateAssessmentTarget CreateAssessmentTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentTarget' {Text
assessmentTargetName :: Text
$sel:assessmentTargetName:CreateAssessmentTarget' :: CreateAssessmentTarget -> Text
assessmentTargetName} -> Text
assessmentTargetName) (\s :: CreateAssessmentTarget
s@CreateAssessmentTarget' {} Text
a -> CreateAssessmentTarget
s {$sel:assessmentTargetName:CreateAssessmentTarget' :: Text
assessmentTargetName = Text
a} :: CreateAssessmentTarget)
instance Core.AWSRequest CreateAssessmentTarget where
type
AWSResponse CreateAssessmentTarget =
CreateAssessmentTargetResponse
request :: CreateAssessmentTarget -> Request CreateAssessmentTarget
request = Service -> CreateAssessmentTarget -> Request CreateAssessmentTarget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAssessmentTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAssessmentTarget)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAssessmentTarget))
-> Logger
-> Service
-> Proxy CreateAssessmentTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAssessmentTarget)))
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 -> CreateAssessmentTargetResponse
CreateAssessmentTargetResponse'
(Int -> Text -> CreateAssessmentTargetResponse)
-> Either String Int
-> Either String (Text -> CreateAssessmentTargetResponse)
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 -> CreateAssessmentTargetResponse)
-> Either String Text
-> Either String CreateAssessmentTargetResponse
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
"assessmentTargetArn")
)
instance Prelude.Hashable CreateAssessmentTarget
instance Prelude.NFData CreateAssessmentTarget
instance Core.ToHeaders CreateAssessmentTarget where
toHeaders :: CreateAssessmentTarget -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAssessmentTarget -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"InspectorService.CreateAssessmentTarget" ::
Prelude.ByteString
),
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 CreateAssessmentTarget where
toJSON :: CreateAssessmentTarget -> Value
toJSON CreateAssessmentTarget' {Maybe Text
Text
assessmentTargetName :: Text
resourceGroupArn :: Maybe Text
$sel:assessmentTargetName:CreateAssessmentTarget' :: CreateAssessmentTarget -> Text
$sel:resourceGroupArn:CreateAssessmentTarget' :: CreateAssessmentTarget -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"resourceGroupArn" 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
resourceGroupArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"assessmentTargetName"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assessmentTargetName
)
]
)
instance Core.ToPath CreateAssessmentTarget where
toPath :: CreateAssessmentTarget -> ByteString
toPath = ByteString -> CreateAssessmentTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateAssessmentTarget where
toQuery :: CreateAssessmentTarget -> QueryString
toQuery = QueryString -> CreateAssessmentTarget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAssessmentTargetResponse = CreateAssessmentTargetResponse'
{
CreateAssessmentTargetResponse -> Int
httpStatus :: Prelude.Int,
CreateAssessmentTargetResponse -> Text
assessmentTargetArn :: Prelude.Text
}
deriving (CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool
(CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool)
-> (CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool)
-> Eq CreateAssessmentTargetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool
$c/= :: CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool
== :: CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool
$c== :: CreateAssessmentTargetResponse
-> CreateAssessmentTargetResponse -> Bool
Prelude.Eq, ReadPrec [CreateAssessmentTargetResponse]
ReadPrec CreateAssessmentTargetResponse
Int -> ReadS CreateAssessmentTargetResponse
ReadS [CreateAssessmentTargetResponse]
(Int -> ReadS CreateAssessmentTargetResponse)
-> ReadS [CreateAssessmentTargetResponse]
-> ReadPrec CreateAssessmentTargetResponse
-> ReadPrec [CreateAssessmentTargetResponse]
-> Read CreateAssessmentTargetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssessmentTargetResponse]
$creadListPrec :: ReadPrec [CreateAssessmentTargetResponse]
readPrec :: ReadPrec CreateAssessmentTargetResponse
$creadPrec :: ReadPrec CreateAssessmentTargetResponse
readList :: ReadS [CreateAssessmentTargetResponse]
$creadList :: ReadS [CreateAssessmentTargetResponse]
readsPrec :: Int -> ReadS CreateAssessmentTargetResponse
$creadsPrec :: Int -> ReadS CreateAssessmentTargetResponse
Prelude.Read, Int -> CreateAssessmentTargetResponse -> ShowS
[CreateAssessmentTargetResponse] -> ShowS
CreateAssessmentTargetResponse -> String
(Int -> CreateAssessmentTargetResponse -> ShowS)
-> (CreateAssessmentTargetResponse -> String)
-> ([CreateAssessmentTargetResponse] -> ShowS)
-> Show CreateAssessmentTargetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssessmentTargetResponse] -> ShowS
$cshowList :: [CreateAssessmentTargetResponse] -> ShowS
show :: CreateAssessmentTargetResponse -> String
$cshow :: CreateAssessmentTargetResponse -> String
showsPrec :: Int -> CreateAssessmentTargetResponse -> ShowS
$cshowsPrec :: Int -> CreateAssessmentTargetResponse -> ShowS
Prelude.Show, (forall x.
CreateAssessmentTargetResponse
-> Rep CreateAssessmentTargetResponse x)
-> (forall x.
Rep CreateAssessmentTargetResponse x
-> CreateAssessmentTargetResponse)
-> Generic CreateAssessmentTargetResponse
forall x.
Rep CreateAssessmentTargetResponse x
-> CreateAssessmentTargetResponse
forall x.
CreateAssessmentTargetResponse
-> Rep CreateAssessmentTargetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAssessmentTargetResponse x
-> CreateAssessmentTargetResponse
$cfrom :: forall x.
CreateAssessmentTargetResponse
-> Rep CreateAssessmentTargetResponse x
Prelude.Generic)
newCreateAssessmentTargetResponse ::
Prelude.Int ->
Prelude.Text ->
CreateAssessmentTargetResponse
newCreateAssessmentTargetResponse :: Int -> Text -> CreateAssessmentTargetResponse
newCreateAssessmentTargetResponse
Int
pHttpStatus_
Text
pAssessmentTargetArn_ =
CreateAssessmentTargetResponse' :: Int -> Text -> CreateAssessmentTargetResponse
CreateAssessmentTargetResponse'
{ $sel:httpStatus:CreateAssessmentTargetResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:assessmentTargetArn:CreateAssessmentTargetResponse' :: Text
assessmentTargetArn = Text
pAssessmentTargetArn_
}
createAssessmentTargetResponse_httpStatus :: Lens.Lens' CreateAssessmentTargetResponse Prelude.Int
createAssessmentTargetResponse_httpStatus :: (Int -> f Int)
-> CreateAssessmentTargetResponse
-> f CreateAssessmentTargetResponse
createAssessmentTargetResponse_httpStatus = (CreateAssessmentTargetResponse -> Int)
-> (CreateAssessmentTargetResponse
-> Int -> CreateAssessmentTargetResponse)
-> Lens
CreateAssessmentTargetResponse
CreateAssessmentTargetResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentTargetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAssessmentTargetResponse' :: CreateAssessmentTargetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAssessmentTargetResponse
s@CreateAssessmentTargetResponse' {} Int
a -> CreateAssessmentTargetResponse
s {$sel:httpStatus:CreateAssessmentTargetResponse' :: Int
httpStatus = Int
a} :: CreateAssessmentTargetResponse)
createAssessmentTargetResponse_assessmentTargetArn :: Lens.Lens' CreateAssessmentTargetResponse Prelude.Text
createAssessmentTargetResponse_assessmentTargetArn :: (Text -> f Text)
-> CreateAssessmentTargetResponse
-> f CreateAssessmentTargetResponse
createAssessmentTargetResponse_assessmentTargetArn = (CreateAssessmentTargetResponse -> Text)
-> (CreateAssessmentTargetResponse
-> Text -> CreateAssessmentTargetResponse)
-> Lens
CreateAssessmentTargetResponse
CreateAssessmentTargetResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentTargetResponse' {Text
assessmentTargetArn :: Text
$sel:assessmentTargetArn:CreateAssessmentTargetResponse' :: CreateAssessmentTargetResponse -> Text
assessmentTargetArn} -> Text
assessmentTargetArn) (\s :: CreateAssessmentTargetResponse
s@CreateAssessmentTargetResponse' {} Text
a -> CreateAssessmentTargetResponse
s {$sel:assessmentTargetArn:CreateAssessmentTargetResponse' :: Text
assessmentTargetArn = Text
a} :: CreateAssessmentTargetResponse)
instance
Prelude.NFData
CreateAssessmentTargetResponse