{-# 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.StartAssessmentRun
(
StartAssessmentRun (..),
newStartAssessmentRun,
startAssessmentRun_assessmentRunName,
startAssessmentRun_assessmentTemplateArn,
StartAssessmentRunResponse (..),
newStartAssessmentRunResponse,
startAssessmentRunResponse_httpStatus,
startAssessmentRunResponse_assessmentRunArn,
)
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 StartAssessmentRun = StartAssessmentRun'
{
StartAssessmentRun -> Maybe Text
assessmentRunName :: Prelude.Maybe Prelude.Text,
StartAssessmentRun -> Text
assessmentTemplateArn :: Prelude.Text
}
deriving (StartAssessmentRun -> StartAssessmentRun -> Bool
(StartAssessmentRun -> StartAssessmentRun -> Bool)
-> (StartAssessmentRun -> StartAssessmentRun -> Bool)
-> Eq StartAssessmentRun
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartAssessmentRun -> StartAssessmentRun -> Bool
$c/= :: StartAssessmentRun -> StartAssessmentRun -> Bool
== :: StartAssessmentRun -> StartAssessmentRun -> Bool
$c== :: StartAssessmentRun -> StartAssessmentRun -> Bool
Prelude.Eq, ReadPrec [StartAssessmentRun]
ReadPrec StartAssessmentRun
Int -> ReadS StartAssessmentRun
ReadS [StartAssessmentRun]
(Int -> ReadS StartAssessmentRun)
-> ReadS [StartAssessmentRun]
-> ReadPrec StartAssessmentRun
-> ReadPrec [StartAssessmentRun]
-> Read StartAssessmentRun
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartAssessmentRun]
$creadListPrec :: ReadPrec [StartAssessmentRun]
readPrec :: ReadPrec StartAssessmentRun
$creadPrec :: ReadPrec StartAssessmentRun
readList :: ReadS [StartAssessmentRun]
$creadList :: ReadS [StartAssessmentRun]
readsPrec :: Int -> ReadS StartAssessmentRun
$creadsPrec :: Int -> ReadS StartAssessmentRun
Prelude.Read, Int -> StartAssessmentRun -> ShowS
[StartAssessmentRun] -> ShowS
StartAssessmentRun -> String
(Int -> StartAssessmentRun -> ShowS)
-> (StartAssessmentRun -> String)
-> ([StartAssessmentRun] -> ShowS)
-> Show StartAssessmentRun
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartAssessmentRun] -> ShowS
$cshowList :: [StartAssessmentRun] -> ShowS
show :: StartAssessmentRun -> String
$cshow :: StartAssessmentRun -> String
showsPrec :: Int -> StartAssessmentRun -> ShowS
$cshowsPrec :: Int -> StartAssessmentRun -> ShowS
Prelude.Show, (forall x. StartAssessmentRun -> Rep StartAssessmentRun x)
-> (forall x. Rep StartAssessmentRun x -> StartAssessmentRun)
-> Generic StartAssessmentRun
forall x. Rep StartAssessmentRun x -> StartAssessmentRun
forall x. StartAssessmentRun -> Rep StartAssessmentRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartAssessmentRun x -> StartAssessmentRun
$cfrom :: forall x. StartAssessmentRun -> Rep StartAssessmentRun x
Prelude.Generic)
newStartAssessmentRun ::
Prelude.Text ->
StartAssessmentRun
newStartAssessmentRun :: Text -> StartAssessmentRun
newStartAssessmentRun Text
pAssessmentTemplateArn_ =
StartAssessmentRun' :: Maybe Text -> Text -> StartAssessmentRun
StartAssessmentRun'
{ $sel:assessmentRunName:StartAssessmentRun' :: Maybe Text
assessmentRunName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assessmentTemplateArn:StartAssessmentRun' :: Text
assessmentTemplateArn = Text
pAssessmentTemplateArn_
}
startAssessmentRun_assessmentRunName :: Lens.Lens' StartAssessmentRun (Prelude.Maybe Prelude.Text)
startAssessmentRun_assessmentRunName :: (Maybe Text -> f (Maybe Text))
-> StartAssessmentRun -> f StartAssessmentRun
startAssessmentRun_assessmentRunName = (StartAssessmentRun -> Maybe Text)
-> (StartAssessmentRun -> Maybe Text -> StartAssessmentRun)
-> Lens
StartAssessmentRun StartAssessmentRun (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAssessmentRun' {Maybe Text
assessmentRunName :: Maybe Text
$sel:assessmentRunName:StartAssessmentRun' :: StartAssessmentRun -> Maybe Text
assessmentRunName} -> Maybe Text
assessmentRunName) (\s :: StartAssessmentRun
s@StartAssessmentRun' {} Maybe Text
a -> StartAssessmentRun
s {$sel:assessmentRunName:StartAssessmentRun' :: Maybe Text
assessmentRunName = Maybe Text
a} :: StartAssessmentRun)
startAssessmentRun_assessmentTemplateArn :: Lens.Lens' StartAssessmentRun Prelude.Text
startAssessmentRun_assessmentTemplateArn :: (Text -> f Text) -> StartAssessmentRun -> f StartAssessmentRun
startAssessmentRun_assessmentTemplateArn = (StartAssessmentRun -> Text)
-> (StartAssessmentRun -> Text -> StartAssessmentRun)
-> Lens StartAssessmentRun StartAssessmentRun Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAssessmentRun' {Text
assessmentTemplateArn :: Text
$sel:assessmentTemplateArn:StartAssessmentRun' :: StartAssessmentRun -> Text
assessmentTemplateArn} -> Text
assessmentTemplateArn) (\s :: StartAssessmentRun
s@StartAssessmentRun' {} Text
a -> StartAssessmentRun
s {$sel:assessmentTemplateArn:StartAssessmentRun' :: Text
assessmentTemplateArn = Text
a} :: StartAssessmentRun)
instance Core.AWSRequest StartAssessmentRun where
type
AWSResponse StartAssessmentRun =
StartAssessmentRunResponse
request :: StartAssessmentRun -> Request StartAssessmentRun
request = Service -> StartAssessmentRun -> Request StartAssessmentRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartAssessmentRun
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartAssessmentRun)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartAssessmentRun))
-> Logger
-> Service
-> Proxy StartAssessmentRun
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartAssessmentRun)))
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 -> StartAssessmentRunResponse
StartAssessmentRunResponse'
(Int -> Text -> StartAssessmentRunResponse)
-> Either String Int
-> Either String (Text -> StartAssessmentRunResponse)
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 -> StartAssessmentRunResponse)
-> Either String Text -> Either String StartAssessmentRunResponse
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
"assessmentRunArn")
)
instance Prelude.Hashable StartAssessmentRun
instance Prelude.NFData StartAssessmentRun
instance Core.ToHeaders StartAssessmentRun where
toHeaders :: StartAssessmentRun -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartAssessmentRun -> 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.StartAssessmentRun" ::
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 StartAssessmentRun where
toJSON :: StartAssessmentRun -> Value
toJSON StartAssessmentRun' {Maybe Text
Text
assessmentTemplateArn :: Text
assessmentRunName :: Maybe Text
$sel:assessmentTemplateArn:StartAssessmentRun' :: StartAssessmentRun -> Text
$sel:assessmentRunName:StartAssessmentRun' :: StartAssessmentRun -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"assessmentRunName" 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
assessmentRunName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"assessmentTemplateArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assessmentTemplateArn
)
]
)
instance Core.ToPath StartAssessmentRun where
toPath :: StartAssessmentRun -> ByteString
toPath = ByteString -> StartAssessmentRun -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartAssessmentRun where
toQuery :: StartAssessmentRun -> QueryString
toQuery = QueryString -> StartAssessmentRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartAssessmentRunResponse = StartAssessmentRunResponse'
{
StartAssessmentRunResponse -> Int
httpStatus :: Prelude.Int,
StartAssessmentRunResponse -> Text
assessmentRunArn :: Prelude.Text
}
deriving (StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool
(StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool)
-> (StartAssessmentRunResponse
-> StartAssessmentRunResponse -> Bool)
-> Eq StartAssessmentRunResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool
$c/= :: StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool
== :: StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool
$c== :: StartAssessmentRunResponse -> StartAssessmentRunResponse -> Bool
Prelude.Eq, ReadPrec [StartAssessmentRunResponse]
ReadPrec StartAssessmentRunResponse
Int -> ReadS StartAssessmentRunResponse
ReadS [StartAssessmentRunResponse]
(Int -> ReadS StartAssessmentRunResponse)
-> ReadS [StartAssessmentRunResponse]
-> ReadPrec StartAssessmentRunResponse
-> ReadPrec [StartAssessmentRunResponse]
-> Read StartAssessmentRunResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartAssessmentRunResponse]
$creadListPrec :: ReadPrec [StartAssessmentRunResponse]
readPrec :: ReadPrec StartAssessmentRunResponse
$creadPrec :: ReadPrec StartAssessmentRunResponse
readList :: ReadS [StartAssessmentRunResponse]
$creadList :: ReadS [StartAssessmentRunResponse]
readsPrec :: Int -> ReadS StartAssessmentRunResponse
$creadsPrec :: Int -> ReadS StartAssessmentRunResponse
Prelude.Read, Int -> StartAssessmentRunResponse -> ShowS
[StartAssessmentRunResponse] -> ShowS
StartAssessmentRunResponse -> String
(Int -> StartAssessmentRunResponse -> ShowS)
-> (StartAssessmentRunResponse -> String)
-> ([StartAssessmentRunResponse] -> ShowS)
-> Show StartAssessmentRunResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartAssessmentRunResponse] -> ShowS
$cshowList :: [StartAssessmentRunResponse] -> ShowS
show :: StartAssessmentRunResponse -> String
$cshow :: StartAssessmentRunResponse -> String
showsPrec :: Int -> StartAssessmentRunResponse -> ShowS
$cshowsPrec :: Int -> StartAssessmentRunResponse -> ShowS
Prelude.Show, (forall x.
StartAssessmentRunResponse -> Rep StartAssessmentRunResponse x)
-> (forall x.
Rep StartAssessmentRunResponse x -> StartAssessmentRunResponse)
-> Generic StartAssessmentRunResponse
forall x.
Rep StartAssessmentRunResponse x -> StartAssessmentRunResponse
forall x.
StartAssessmentRunResponse -> Rep StartAssessmentRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartAssessmentRunResponse x -> StartAssessmentRunResponse
$cfrom :: forall x.
StartAssessmentRunResponse -> Rep StartAssessmentRunResponse x
Prelude.Generic)
newStartAssessmentRunResponse ::
Prelude.Int ->
Prelude.Text ->
StartAssessmentRunResponse
newStartAssessmentRunResponse :: Int -> Text -> StartAssessmentRunResponse
newStartAssessmentRunResponse
Int
pHttpStatus_
Text
pAssessmentRunArn_ =
StartAssessmentRunResponse' :: Int -> Text -> StartAssessmentRunResponse
StartAssessmentRunResponse'
{ $sel:httpStatus:StartAssessmentRunResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:assessmentRunArn:StartAssessmentRunResponse' :: Text
assessmentRunArn = Text
pAssessmentRunArn_
}
startAssessmentRunResponse_httpStatus :: Lens.Lens' StartAssessmentRunResponse Prelude.Int
startAssessmentRunResponse_httpStatus :: (Int -> f Int)
-> StartAssessmentRunResponse -> f StartAssessmentRunResponse
startAssessmentRunResponse_httpStatus = (StartAssessmentRunResponse -> Int)
-> (StartAssessmentRunResponse
-> Int -> StartAssessmentRunResponse)
-> Lens
StartAssessmentRunResponse StartAssessmentRunResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAssessmentRunResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartAssessmentRunResponse' :: StartAssessmentRunResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartAssessmentRunResponse
s@StartAssessmentRunResponse' {} Int
a -> StartAssessmentRunResponse
s {$sel:httpStatus:StartAssessmentRunResponse' :: Int
httpStatus = Int
a} :: StartAssessmentRunResponse)
startAssessmentRunResponse_assessmentRunArn :: Lens.Lens' StartAssessmentRunResponse Prelude.Text
startAssessmentRunResponse_assessmentRunArn :: (Text -> f Text)
-> StartAssessmentRunResponse -> f StartAssessmentRunResponse
startAssessmentRunResponse_assessmentRunArn = (StartAssessmentRunResponse -> Text)
-> (StartAssessmentRunResponse
-> Text -> StartAssessmentRunResponse)
-> Lens
StartAssessmentRunResponse StartAssessmentRunResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAssessmentRunResponse' {Text
assessmentRunArn :: Text
$sel:assessmentRunArn:StartAssessmentRunResponse' :: StartAssessmentRunResponse -> Text
assessmentRunArn} -> Text
assessmentRunArn) (\s :: StartAssessmentRunResponse
s@StartAssessmentRunResponse' {} Text
a -> StartAssessmentRunResponse
s {$sel:assessmentRunArn:StartAssessmentRunResponse' :: Text
assessmentRunArn = Text
a} :: StartAssessmentRunResponse)
instance Prelude.NFData StartAssessmentRunResponse