{-# 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.WellArchitected.CreateMilestone
(
CreateMilestone (..),
newCreateMilestone,
createMilestone_workloadId,
createMilestone_milestoneName,
createMilestone_clientRequestToken,
CreateMilestoneResponse (..),
newCreateMilestoneResponse,
createMilestoneResponse_milestoneNumber,
createMilestoneResponse_workloadId,
createMilestoneResponse_httpStatus,
)
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.WellArchitected.Types
data CreateMilestone = CreateMilestone'
{ CreateMilestone -> Text
workloadId :: Prelude.Text,
CreateMilestone -> Text
milestoneName :: Prelude.Text,
CreateMilestone -> Text
clientRequestToken :: Prelude.Text
}
deriving (CreateMilestone -> CreateMilestone -> Bool
(CreateMilestone -> CreateMilestone -> Bool)
-> (CreateMilestone -> CreateMilestone -> Bool)
-> Eq CreateMilestone
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMilestone -> CreateMilestone -> Bool
$c/= :: CreateMilestone -> CreateMilestone -> Bool
== :: CreateMilestone -> CreateMilestone -> Bool
$c== :: CreateMilestone -> CreateMilestone -> Bool
Prelude.Eq, ReadPrec [CreateMilestone]
ReadPrec CreateMilestone
Int -> ReadS CreateMilestone
ReadS [CreateMilestone]
(Int -> ReadS CreateMilestone)
-> ReadS [CreateMilestone]
-> ReadPrec CreateMilestone
-> ReadPrec [CreateMilestone]
-> Read CreateMilestone
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMilestone]
$creadListPrec :: ReadPrec [CreateMilestone]
readPrec :: ReadPrec CreateMilestone
$creadPrec :: ReadPrec CreateMilestone
readList :: ReadS [CreateMilestone]
$creadList :: ReadS [CreateMilestone]
readsPrec :: Int -> ReadS CreateMilestone
$creadsPrec :: Int -> ReadS CreateMilestone
Prelude.Read, Int -> CreateMilestone -> ShowS
[CreateMilestone] -> ShowS
CreateMilestone -> String
(Int -> CreateMilestone -> ShowS)
-> (CreateMilestone -> String)
-> ([CreateMilestone] -> ShowS)
-> Show CreateMilestone
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMilestone] -> ShowS
$cshowList :: [CreateMilestone] -> ShowS
show :: CreateMilestone -> String
$cshow :: CreateMilestone -> String
showsPrec :: Int -> CreateMilestone -> ShowS
$cshowsPrec :: Int -> CreateMilestone -> ShowS
Prelude.Show, (forall x. CreateMilestone -> Rep CreateMilestone x)
-> (forall x. Rep CreateMilestone x -> CreateMilestone)
-> Generic CreateMilestone
forall x. Rep CreateMilestone x -> CreateMilestone
forall x. CreateMilestone -> Rep CreateMilestone x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMilestone x -> CreateMilestone
$cfrom :: forall x. CreateMilestone -> Rep CreateMilestone x
Prelude.Generic)
newCreateMilestone ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateMilestone
newCreateMilestone :: Text -> Text -> Text -> CreateMilestone
newCreateMilestone
Text
pWorkloadId_
Text
pMilestoneName_
Text
pClientRequestToken_ =
CreateMilestone' :: Text -> Text -> Text -> CreateMilestone
CreateMilestone'
{ $sel:workloadId:CreateMilestone' :: Text
workloadId = Text
pWorkloadId_,
$sel:milestoneName:CreateMilestone' :: Text
milestoneName = Text
pMilestoneName_,
$sel:clientRequestToken:CreateMilestone' :: Text
clientRequestToken = Text
pClientRequestToken_
}
createMilestone_workloadId :: Lens.Lens' CreateMilestone Prelude.Text
createMilestone_workloadId :: (Text -> f Text) -> CreateMilestone -> f CreateMilestone
createMilestone_workloadId = (CreateMilestone -> Text)
-> (CreateMilestone -> Text -> CreateMilestone)
-> Lens CreateMilestone CreateMilestone Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestone' {Text
workloadId :: Text
$sel:workloadId:CreateMilestone' :: CreateMilestone -> Text
workloadId} -> Text
workloadId) (\s :: CreateMilestone
s@CreateMilestone' {} Text
a -> CreateMilestone
s {$sel:workloadId:CreateMilestone' :: Text
workloadId = Text
a} :: CreateMilestone)
createMilestone_milestoneName :: Lens.Lens' CreateMilestone Prelude.Text
createMilestone_milestoneName :: (Text -> f Text) -> CreateMilestone -> f CreateMilestone
createMilestone_milestoneName = (CreateMilestone -> Text)
-> (CreateMilestone -> Text -> CreateMilestone)
-> Lens CreateMilestone CreateMilestone Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestone' {Text
milestoneName :: Text
$sel:milestoneName:CreateMilestone' :: CreateMilestone -> Text
milestoneName} -> Text
milestoneName) (\s :: CreateMilestone
s@CreateMilestone' {} Text
a -> CreateMilestone
s {$sel:milestoneName:CreateMilestone' :: Text
milestoneName = Text
a} :: CreateMilestone)
createMilestone_clientRequestToken :: Lens.Lens' CreateMilestone Prelude.Text
createMilestone_clientRequestToken :: (Text -> f Text) -> CreateMilestone -> f CreateMilestone
createMilestone_clientRequestToken = (CreateMilestone -> Text)
-> (CreateMilestone -> Text -> CreateMilestone)
-> Lens CreateMilestone CreateMilestone Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestone' {Text
clientRequestToken :: Text
$sel:clientRequestToken:CreateMilestone' :: CreateMilestone -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: CreateMilestone
s@CreateMilestone' {} Text
a -> CreateMilestone
s {$sel:clientRequestToken:CreateMilestone' :: Text
clientRequestToken = Text
a} :: CreateMilestone)
instance Core.AWSRequest CreateMilestone where
type
AWSResponse CreateMilestone =
CreateMilestoneResponse
request :: CreateMilestone -> Request CreateMilestone
request = Service -> CreateMilestone -> Request CreateMilestone
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateMilestone
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMilestone)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateMilestone))
-> Logger
-> Service
-> Proxy CreateMilestone
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMilestone)))
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 ->
Maybe Natural -> Maybe Text -> Int -> CreateMilestoneResponse
CreateMilestoneResponse'
(Maybe Natural -> Maybe Text -> Int -> CreateMilestoneResponse)
-> Either String (Maybe Natural)
-> Either String (Maybe Text -> Int -> CreateMilestoneResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MilestoneNumber")
Either String (Maybe Text -> Int -> CreateMilestoneResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateMilestoneResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WorkloadId")
Either String (Int -> CreateMilestoneResponse)
-> Either String Int -> Either String CreateMilestoneResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable CreateMilestone
instance Prelude.NFData CreateMilestone
instance Core.ToHeaders CreateMilestone where
toHeaders :: CreateMilestone -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateMilestone -> 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 CreateMilestone where
toJSON :: CreateMilestone -> Value
toJSON CreateMilestone' {Text
clientRequestToken :: Text
milestoneName :: Text
workloadId :: Text
$sel:clientRequestToken:CreateMilestone' :: CreateMilestone -> Text
$sel:milestoneName:CreateMilestone' :: CreateMilestone -> Text
$sel:workloadId:CreateMilestone' :: CreateMilestone -> 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
"MilestoneName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
milestoneName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ClientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken)
]
)
instance Core.ToPath CreateMilestone where
toPath :: CreateMilestone -> ByteString
toPath CreateMilestone' {Text
clientRequestToken :: Text
milestoneName :: Text
workloadId :: Text
$sel:clientRequestToken:CreateMilestone' :: CreateMilestone -> Text
$sel:milestoneName:CreateMilestone' :: CreateMilestone -> Text
$sel:workloadId:CreateMilestone' :: CreateMilestone -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/workloads/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workloadId, ByteString
"/milestones"]
instance Core.ToQuery CreateMilestone where
toQuery :: CreateMilestone -> QueryString
toQuery = QueryString -> CreateMilestone -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateMilestoneResponse = CreateMilestoneResponse'
{ CreateMilestoneResponse -> Maybe Natural
milestoneNumber :: Prelude.Maybe Prelude.Natural,
CreateMilestoneResponse -> Maybe Text
workloadId :: Prelude.Maybe Prelude.Text,
CreateMilestoneResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateMilestoneResponse -> CreateMilestoneResponse -> Bool
(CreateMilestoneResponse -> CreateMilestoneResponse -> Bool)
-> (CreateMilestoneResponse -> CreateMilestoneResponse -> Bool)
-> Eq CreateMilestoneResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMilestoneResponse -> CreateMilestoneResponse -> Bool
$c/= :: CreateMilestoneResponse -> CreateMilestoneResponse -> Bool
== :: CreateMilestoneResponse -> CreateMilestoneResponse -> Bool
$c== :: CreateMilestoneResponse -> CreateMilestoneResponse -> Bool
Prelude.Eq, ReadPrec [CreateMilestoneResponse]
ReadPrec CreateMilestoneResponse
Int -> ReadS CreateMilestoneResponse
ReadS [CreateMilestoneResponse]
(Int -> ReadS CreateMilestoneResponse)
-> ReadS [CreateMilestoneResponse]
-> ReadPrec CreateMilestoneResponse
-> ReadPrec [CreateMilestoneResponse]
-> Read CreateMilestoneResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMilestoneResponse]
$creadListPrec :: ReadPrec [CreateMilestoneResponse]
readPrec :: ReadPrec CreateMilestoneResponse
$creadPrec :: ReadPrec CreateMilestoneResponse
readList :: ReadS [CreateMilestoneResponse]
$creadList :: ReadS [CreateMilestoneResponse]
readsPrec :: Int -> ReadS CreateMilestoneResponse
$creadsPrec :: Int -> ReadS CreateMilestoneResponse
Prelude.Read, Int -> CreateMilestoneResponse -> ShowS
[CreateMilestoneResponse] -> ShowS
CreateMilestoneResponse -> String
(Int -> CreateMilestoneResponse -> ShowS)
-> (CreateMilestoneResponse -> String)
-> ([CreateMilestoneResponse] -> ShowS)
-> Show CreateMilestoneResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMilestoneResponse] -> ShowS
$cshowList :: [CreateMilestoneResponse] -> ShowS
show :: CreateMilestoneResponse -> String
$cshow :: CreateMilestoneResponse -> String
showsPrec :: Int -> CreateMilestoneResponse -> ShowS
$cshowsPrec :: Int -> CreateMilestoneResponse -> ShowS
Prelude.Show, (forall x.
CreateMilestoneResponse -> Rep CreateMilestoneResponse x)
-> (forall x.
Rep CreateMilestoneResponse x -> CreateMilestoneResponse)
-> Generic CreateMilestoneResponse
forall x. Rep CreateMilestoneResponse x -> CreateMilestoneResponse
forall x. CreateMilestoneResponse -> Rep CreateMilestoneResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMilestoneResponse x -> CreateMilestoneResponse
$cfrom :: forall x. CreateMilestoneResponse -> Rep CreateMilestoneResponse x
Prelude.Generic)
newCreateMilestoneResponse ::
Prelude.Int ->
CreateMilestoneResponse
newCreateMilestoneResponse :: Int -> CreateMilestoneResponse
newCreateMilestoneResponse Int
pHttpStatus_ =
CreateMilestoneResponse' :: Maybe Natural -> Maybe Text -> Int -> CreateMilestoneResponse
CreateMilestoneResponse'
{ $sel:milestoneNumber:CreateMilestoneResponse' :: Maybe Natural
milestoneNumber =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:workloadId:CreateMilestoneResponse' :: Maybe Text
workloadId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateMilestoneResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createMilestoneResponse_milestoneNumber :: Lens.Lens' CreateMilestoneResponse (Prelude.Maybe Prelude.Natural)
createMilestoneResponse_milestoneNumber :: (Maybe Natural -> f (Maybe Natural))
-> CreateMilestoneResponse -> f CreateMilestoneResponse
createMilestoneResponse_milestoneNumber = (CreateMilestoneResponse -> Maybe Natural)
-> (CreateMilestoneResponse
-> Maybe Natural -> CreateMilestoneResponse)
-> Lens
CreateMilestoneResponse
CreateMilestoneResponse
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestoneResponse' {Maybe Natural
milestoneNumber :: Maybe Natural
$sel:milestoneNumber:CreateMilestoneResponse' :: CreateMilestoneResponse -> Maybe Natural
milestoneNumber} -> Maybe Natural
milestoneNumber) (\s :: CreateMilestoneResponse
s@CreateMilestoneResponse' {} Maybe Natural
a -> CreateMilestoneResponse
s {$sel:milestoneNumber:CreateMilestoneResponse' :: Maybe Natural
milestoneNumber = Maybe Natural
a} :: CreateMilestoneResponse)
createMilestoneResponse_workloadId :: Lens.Lens' CreateMilestoneResponse (Prelude.Maybe Prelude.Text)
createMilestoneResponse_workloadId :: (Maybe Text -> f (Maybe Text))
-> CreateMilestoneResponse -> f CreateMilestoneResponse
createMilestoneResponse_workloadId = (CreateMilestoneResponse -> Maybe Text)
-> (CreateMilestoneResponse
-> Maybe Text -> CreateMilestoneResponse)
-> Lens
CreateMilestoneResponse
CreateMilestoneResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestoneResponse' {Maybe Text
workloadId :: Maybe Text
$sel:workloadId:CreateMilestoneResponse' :: CreateMilestoneResponse -> Maybe Text
workloadId} -> Maybe Text
workloadId) (\s :: CreateMilestoneResponse
s@CreateMilestoneResponse' {} Maybe Text
a -> CreateMilestoneResponse
s {$sel:workloadId:CreateMilestoneResponse' :: Maybe Text
workloadId = Maybe Text
a} :: CreateMilestoneResponse)
createMilestoneResponse_httpStatus :: Lens.Lens' CreateMilestoneResponse Prelude.Int
createMilestoneResponse_httpStatus :: (Int -> f Int)
-> CreateMilestoneResponse -> f CreateMilestoneResponse
createMilestoneResponse_httpStatus = (CreateMilestoneResponse -> Int)
-> (CreateMilestoneResponse -> Int -> CreateMilestoneResponse)
-> Lens CreateMilestoneResponse CreateMilestoneResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMilestoneResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMilestoneResponse' :: CreateMilestoneResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMilestoneResponse
s@CreateMilestoneResponse' {} Int
a -> CreateMilestoneResponse
s {$sel:httpStatus:CreateMilestoneResponse' :: Int
httpStatus = Int
a} :: CreateMilestoneResponse)
instance Prelude.NFData CreateMilestoneResponse