{-# 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.CodeGuruReviewer.CreateCodeReview
(
CreateCodeReview (..),
newCreateCodeReview,
createCodeReview_clientRequestToken,
createCodeReview_name,
createCodeReview_repositoryAssociationArn,
createCodeReview_type,
CreateCodeReviewResponse (..),
newCreateCodeReviewResponse,
createCodeReviewResponse_codeReview,
createCodeReviewResponse_httpStatus,
)
where
import Amazonka.CodeGuruReviewer.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCodeReview = CreateCodeReview'
{
CreateCodeReview -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
CreateCodeReview -> Text
name :: Prelude.Text,
CreateCodeReview -> Text
repositoryAssociationArn :: Prelude.Text,
CreateCodeReview -> CodeReviewType
type' :: CodeReviewType
}
deriving (CreateCodeReview -> CreateCodeReview -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCodeReview -> CreateCodeReview -> Bool
$c/= :: CreateCodeReview -> CreateCodeReview -> Bool
== :: CreateCodeReview -> CreateCodeReview -> Bool
$c== :: CreateCodeReview -> CreateCodeReview -> Bool
Prelude.Eq, ReadPrec [CreateCodeReview]
ReadPrec CreateCodeReview
Int -> ReadS CreateCodeReview
ReadS [CreateCodeReview]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCodeReview]
$creadListPrec :: ReadPrec [CreateCodeReview]
readPrec :: ReadPrec CreateCodeReview
$creadPrec :: ReadPrec CreateCodeReview
readList :: ReadS [CreateCodeReview]
$creadList :: ReadS [CreateCodeReview]
readsPrec :: Int -> ReadS CreateCodeReview
$creadsPrec :: Int -> ReadS CreateCodeReview
Prelude.Read, Int -> CreateCodeReview -> ShowS
[CreateCodeReview] -> ShowS
CreateCodeReview -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCodeReview] -> ShowS
$cshowList :: [CreateCodeReview] -> ShowS
show :: CreateCodeReview -> String
$cshow :: CreateCodeReview -> String
showsPrec :: Int -> CreateCodeReview -> ShowS
$cshowsPrec :: Int -> CreateCodeReview -> ShowS
Prelude.Show, forall x. Rep CreateCodeReview x -> CreateCodeReview
forall x. CreateCodeReview -> Rep CreateCodeReview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCodeReview x -> CreateCodeReview
$cfrom :: forall x. CreateCodeReview -> Rep CreateCodeReview x
Prelude.Generic)
newCreateCodeReview ::
Prelude.Text ->
Prelude.Text ->
CodeReviewType ->
CreateCodeReview
newCreateCodeReview :: Text -> Text -> CodeReviewType -> CreateCodeReview
newCreateCodeReview
Text
pName_
Text
pRepositoryAssociationArn_
CodeReviewType
pType_ =
CreateCodeReview'
{ $sel:clientRequestToken:CreateCodeReview' :: Maybe Text
clientRequestToken =
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateCodeReview' :: Text
name = Text
pName_,
$sel:repositoryAssociationArn:CreateCodeReview' :: Text
repositoryAssociationArn =
Text
pRepositoryAssociationArn_,
$sel:type':CreateCodeReview' :: CodeReviewType
type' = CodeReviewType
pType_
}
createCodeReview_clientRequestToken :: Lens.Lens' CreateCodeReview (Prelude.Maybe Prelude.Text)
createCodeReview_clientRequestToken :: Lens' CreateCodeReview (Maybe Text)
createCodeReview_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReview' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateCodeReview' :: CreateCodeReview -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateCodeReview
s@CreateCodeReview' {} Maybe Text
a -> CreateCodeReview
s {$sel:clientRequestToken:CreateCodeReview' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateCodeReview)
createCodeReview_name :: Lens.Lens' CreateCodeReview Prelude.Text
createCodeReview_name :: Lens' CreateCodeReview Text
createCodeReview_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReview' {Text
name :: Text
$sel:name:CreateCodeReview' :: CreateCodeReview -> Text
name} -> Text
name) (\s :: CreateCodeReview
s@CreateCodeReview' {} Text
a -> CreateCodeReview
s {$sel:name:CreateCodeReview' :: Text
name = Text
a} :: CreateCodeReview)
createCodeReview_repositoryAssociationArn :: Lens.Lens' CreateCodeReview Prelude.Text
createCodeReview_repositoryAssociationArn :: Lens' CreateCodeReview Text
createCodeReview_repositoryAssociationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReview' {Text
repositoryAssociationArn :: Text
$sel:repositoryAssociationArn:CreateCodeReview' :: CreateCodeReview -> Text
repositoryAssociationArn} -> Text
repositoryAssociationArn) (\s :: CreateCodeReview
s@CreateCodeReview' {} Text
a -> CreateCodeReview
s {$sel:repositoryAssociationArn:CreateCodeReview' :: Text
repositoryAssociationArn = Text
a} :: CreateCodeReview)
createCodeReview_type :: Lens.Lens' CreateCodeReview CodeReviewType
createCodeReview_type :: Lens' CreateCodeReview CodeReviewType
createCodeReview_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReview' {CodeReviewType
type' :: CodeReviewType
$sel:type':CreateCodeReview' :: CreateCodeReview -> CodeReviewType
type'} -> CodeReviewType
type') (\s :: CreateCodeReview
s@CreateCodeReview' {} CodeReviewType
a -> CreateCodeReview
s {$sel:type':CreateCodeReview' :: CodeReviewType
type' = CodeReviewType
a} :: CreateCodeReview)
instance Core.AWSRequest CreateCodeReview where
type
AWSResponse CreateCodeReview =
CreateCodeReviewResponse
request :: (Service -> Service)
-> CreateCodeReview -> Request CreateCodeReview
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 CreateCodeReview
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCodeReview)))
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 ->
Maybe CodeReview -> Int -> CreateCodeReviewResponse
CreateCodeReviewResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CodeReview")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable CreateCodeReview where
hashWithSalt :: Int -> CreateCodeReview -> Int
hashWithSalt Int
_salt CreateCodeReview' {Maybe Text
Text
CodeReviewType
type' :: CodeReviewType
repositoryAssociationArn :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:type':CreateCodeReview' :: CreateCodeReview -> CodeReviewType
$sel:repositoryAssociationArn:CreateCodeReview' :: CreateCodeReview -> Text
$sel:name:CreateCodeReview' :: CreateCodeReview -> Text
$sel:clientRequestToken:CreateCodeReview' :: CreateCodeReview -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryAssociationArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CodeReviewType
type'
instance Prelude.NFData CreateCodeReview where
rnf :: CreateCodeReview -> ()
rnf CreateCodeReview' {Maybe Text
Text
CodeReviewType
type' :: CodeReviewType
repositoryAssociationArn :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:type':CreateCodeReview' :: CreateCodeReview -> CodeReviewType
$sel:repositoryAssociationArn:CreateCodeReview' :: CreateCodeReview -> Text
$sel:name:CreateCodeReview' :: CreateCodeReview -> Text
$sel:clientRequestToken:CreateCodeReview' :: CreateCodeReview -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repositoryAssociationArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CodeReviewType
type'
instance Data.ToHeaders CreateCodeReview where
toHeaders :: CreateCodeReview -> 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 CreateCodeReview where
toJSON :: CreateCodeReview -> Value
toJSON CreateCodeReview' {Maybe Text
Text
CodeReviewType
type' :: CodeReviewType
repositoryAssociationArn :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:type':CreateCodeReview' :: CreateCodeReview -> CodeReviewType
$sel:repositoryAssociationArn:CreateCodeReview' :: CreateCodeReview -> Text
$sel:name:CreateCodeReview' :: CreateCodeReview -> Text
$sel:clientRequestToken:CreateCodeReview' :: CreateCodeReview -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientRequestToken" 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
clientRequestToken,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just
( Key
"RepositoryAssociationArn"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
repositoryAssociationArn
),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CodeReviewType
type')
]
)
instance Data.ToPath CreateCodeReview where
toPath :: CreateCodeReview -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/codereviews"
instance Data.ToQuery CreateCodeReview where
toQuery :: CreateCodeReview -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateCodeReviewResponse = CreateCodeReviewResponse'
{ CreateCodeReviewResponse -> Maybe CodeReview
codeReview :: Prelude.Maybe CodeReview,
CreateCodeReviewResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCodeReviewResponse -> CreateCodeReviewResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCodeReviewResponse -> CreateCodeReviewResponse -> Bool
$c/= :: CreateCodeReviewResponse -> CreateCodeReviewResponse -> Bool
== :: CreateCodeReviewResponse -> CreateCodeReviewResponse -> Bool
$c== :: CreateCodeReviewResponse -> CreateCodeReviewResponse -> Bool
Prelude.Eq, ReadPrec [CreateCodeReviewResponse]
ReadPrec CreateCodeReviewResponse
Int -> ReadS CreateCodeReviewResponse
ReadS [CreateCodeReviewResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCodeReviewResponse]
$creadListPrec :: ReadPrec [CreateCodeReviewResponse]
readPrec :: ReadPrec CreateCodeReviewResponse
$creadPrec :: ReadPrec CreateCodeReviewResponse
readList :: ReadS [CreateCodeReviewResponse]
$creadList :: ReadS [CreateCodeReviewResponse]
readsPrec :: Int -> ReadS CreateCodeReviewResponse
$creadsPrec :: Int -> ReadS CreateCodeReviewResponse
Prelude.Read, Int -> CreateCodeReviewResponse -> ShowS
[CreateCodeReviewResponse] -> ShowS
CreateCodeReviewResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCodeReviewResponse] -> ShowS
$cshowList :: [CreateCodeReviewResponse] -> ShowS
show :: CreateCodeReviewResponse -> String
$cshow :: CreateCodeReviewResponse -> String
showsPrec :: Int -> CreateCodeReviewResponse -> ShowS
$cshowsPrec :: Int -> CreateCodeReviewResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCodeReviewResponse x -> CreateCodeReviewResponse
forall x.
CreateCodeReviewResponse -> Rep CreateCodeReviewResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCodeReviewResponse x -> CreateCodeReviewResponse
$cfrom :: forall x.
CreateCodeReviewResponse -> Rep CreateCodeReviewResponse x
Prelude.Generic)
newCreateCodeReviewResponse ::
Prelude.Int ->
CreateCodeReviewResponse
newCreateCodeReviewResponse :: Int -> CreateCodeReviewResponse
newCreateCodeReviewResponse Int
pHttpStatus_ =
CreateCodeReviewResponse'
{ $sel:codeReview:CreateCodeReviewResponse' :: Maybe CodeReview
codeReview =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCodeReviewResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCodeReviewResponse_codeReview :: Lens.Lens' CreateCodeReviewResponse (Prelude.Maybe CodeReview)
createCodeReviewResponse_codeReview :: Lens' CreateCodeReviewResponse (Maybe CodeReview)
createCodeReviewResponse_codeReview = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReviewResponse' {Maybe CodeReview
codeReview :: Maybe CodeReview
$sel:codeReview:CreateCodeReviewResponse' :: CreateCodeReviewResponse -> Maybe CodeReview
codeReview} -> Maybe CodeReview
codeReview) (\s :: CreateCodeReviewResponse
s@CreateCodeReviewResponse' {} Maybe CodeReview
a -> CreateCodeReviewResponse
s {$sel:codeReview:CreateCodeReviewResponse' :: Maybe CodeReview
codeReview = Maybe CodeReview
a} :: CreateCodeReviewResponse)
createCodeReviewResponse_httpStatus :: Lens.Lens' CreateCodeReviewResponse Prelude.Int
createCodeReviewResponse_httpStatus :: Lens' CreateCodeReviewResponse Int
createCodeReviewResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeReviewResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCodeReviewResponse' :: CreateCodeReviewResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCodeReviewResponse
s@CreateCodeReviewResponse' {} Int
a -> CreateCodeReviewResponse
s {$sel:httpStatus:CreateCodeReviewResponse' :: Int
httpStatus = Int
a} :: CreateCodeReviewResponse)
instance Prelude.NFData CreateCodeReviewResponse where
rnf :: CreateCodeReviewResponse -> ()
rnf CreateCodeReviewResponse' {Int
Maybe CodeReview
httpStatus :: Int
codeReview :: Maybe CodeReview
$sel:httpStatus:CreateCodeReviewResponse' :: CreateCodeReviewResponse -> Int
$sel:codeReview:CreateCodeReviewResponse' :: CreateCodeReviewResponse -> Maybe CodeReview
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CodeReview
codeReview
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus