{-# 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.AppMesh.CreateMesh
(
CreateMesh (..),
newCreateMesh,
createMesh_clientToken,
createMesh_spec,
createMesh_tags,
createMesh_meshName,
CreateMeshResponse (..),
newCreateMeshResponse,
createMeshResponse_httpStatus,
createMeshResponse_mesh,
)
where
import Amazonka.AppMesh.Types
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
data CreateMesh = CreateMesh'
{
CreateMesh -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateMesh -> Maybe MeshSpec
spec :: Prelude.Maybe MeshSpec,
CreateMesh -> Maybe [TagRef]
tags :: Prelude.Maybe [TagRef],
CreateMesh -> Text
meshName :: Prelude.Text
}
deriving (CreateMesh -> CreateMesh -> Bool
(CreateMesh -> CreateMesh -> Bool)
-> (CreateMesh -> CreateMesh -> Bool) -> Eq CreateMesh
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMesh -> CreateMesh -> Bool
$c/= :: CreateMesh -> CreateMesh -> Bool
== :: CreateMesh -> CreateMesh -> Bool
$c== :: CreateMesh -> CreateMesh -> Bool
Prelude.Eq, ReadPrec [CreateMesh]
ReadPrec CreateMesh
Int -> ReadS CreateMesh
ReadS [CreateMesh]
(Int -> ReadS CreateMesh)
-> ReadS [CreateMesh]
-> ReadPrec CreateMesh
-> ReadPrec [CreateMesh]
-> Read CreateMesh
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMesh]
$creadListPrec :: ReadPrec [CreateMesh]
readPrec :: ReadPrec CreateMesh
$creadPrec :: ReadPrec CreateMesh
readList :: ReadS [CreateMesh]
$creadList :: ReadS [CreateMesh]
readsPrec :: Int -> ReadS CreateMesh
$creadsPrec :: Int -> ReadS CreateMesh
Prelude.Read, Int -> CreateMesh -> ShowS
[CreateMesh] -> ShowS
CreateMesh -> String
(Int -> CreateMesh -> ShowS)
-> (CreateMesh -> String)
-> ([CreateMesh] -> ShowS)
-> Show CreateMesh
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMesh] -> ShowS
$cshowList :: [CreateMesh] -> ShowS
show :: CreateMesh -> String
$cshow :: CreateMesh -> String
showsPrec :: Int -> CreateMesh -> ShowS
$cshowsPrec :: Int -> CreateMesh -> ShowS
Prelude.Show, (forall x. CreateMesh -> Rep CreateMesh x)
-> (forall x. Rep CreateMesh x -> CreateMesh) -> Generic CreateMesh
forall x. Rep CreateMesh x -> CreateMesh
forall x. CreateMesh -> Rep CreateMesh x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMesh x -> CreateMesh
$cfrom :: forall x. CreateMesh -> Rep CreateMesh x
Prelude.Generic)
newCreateMesh ::
Prelude.Text ->
CreateMesh
newCreateMesh :: Text -> CreateMesh
newCreateMesh Text
pMeshName_ =
CreateMesh' :: Maybe Text
-> Maybe MeshSpec -> Maybe [TagRef] -> Text -> CreateMesh
CreateMesh'
{ $sel:clientToken:CreateMesh' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:spec:CreateMesh' :: Maybe MeshSpec
spec = Maybe MeshSpec
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateMesh' :: Maybe [TagRef]
tags = Maybe [TagRef]
forall a. Maybe a
Prelude.Nothing,
$sel:meshName:CreateMesh' :: Text
meshName = Text
pMeshName_
}
createMesh_clientToken :: Lens.Lens' CreateMesh (Prelude.Maybe Prelude.Text)
createMesh_clientToken :: (Maybe Text -> f (Maybe Text)) -> CreateMesh -> f CreateMesh
createMesh_clientToken = (CreateMesh -> Maybe Text)
-> (CreateMesh -> Maybe Text -> CreateMesh)
-> Lens CreateMesh CreateMesh (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMesh' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateMesh' :: CreateMesh -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateMesh
s@CreateMesh' {} Maybe Text
a -> CreateMesh
s {$sel:clientToken:CreateMesh' :: Maybe Text
clientToken = Maybe Text
a} :: CreateMesh)
createMesh_spec :: Lens.Lens' CreateMesh (Prelude.Maybe MeshSpec)
createMesh_spec :: (Maybe MeshSpec -> f (Maybe MeshSpec))
-> CreateMesh -> f CreateMesh
createMesh_spec = (CreateMesh -> Maybe MeshSpec)
-> (CreateMesh -> Maybe MeshSpec -> CreateMesh)
-> Lens CreateMesh CreateMesh (Maybe MeshSpec) (Maybe MeshSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMesh' {Maybe MeshSpec
spec :: Maybe MeshSpec
$sel:spec:CreateMesh' :: CreateMesh -> Maybe MeshSpec
spec} -> Maybe MeshSpec
spec) (\s :: CreateMesh
s@CreateMesh' {} Maybe MeshSpec
a -> CreateMesh
s {$sel:spec:CreateMesh' :: Maybe MeshSpec
spec = Maybe MeshSpec
a} :: CreateMesh)
createMesh_tags :: Lens.Lens' CreateMesh (Prelude.Maybe [TagRef])
createMesh_tags :: (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateMesh -> f CreateMesh
createMesh_tags = (CreateMesh -> Maybe [TagRef])
-> (CreateMesh -> Maybe [TagRef] -> CreateMesh)
-> Lens CreateMesh CreateMesh (Maybe [TagRef]) (Maybe [TagRef])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMesh' {Maybe [TagRef]
tags :: Maybe [TagRef]
$sel:tags:CreateMesh' :: CreateMesh -> Maybe [TagRef]
tags} -> Maybe [TagRef]
tags) (\s :: CreateMesh
s@CreateMesh' {} Maybe [TagRef]
a -> CreateMesh
s {$sel:tags:CreateMesh' :: Maybe [TagRef]
tags = Maybe [TagRef]
a} :: CreateMesh) ((Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateMesh -> f CreateMesh)
-> ((Maybe [TagRef] -> f (Maybe [TagRef]))
-> Maybe [TagRef] -> f (Maybe [TagRef]))
-> (Maybe [TagRef] -> f (Maybe [TagRef]))
-> CreateMesh
-> f CreateMesh
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagRef] [TagRef] [TagRef] [TagRef]
-> Iso
(Maybe [TagRef]) (Maybe [TagRef]) (Maybe [TagRef]) (Maybe [TagRef])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [TagRef] [TagRef] [TagRef] [TagRef]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createMesh_meshName :: Lens.Lens' CreateMesh Prelude.Text
createMesh_meshName :: (Text -> f Text) -> CreateMesh -> f CreateMesh
createMesh_meshName = (CreateMesh -> Text)
-> (CreateMesh -> Text -> CreateMesh)
-> Lens CreateMesh CreateMesh Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMesh' {Text
meshName :: Text
$sel:meshName:CreateMesh' :: CreateMesh -> Text
meshName} -> Text
meshName) (\s :: CreateMesh
s@CreateMesh' {} Text
a -> CreateMesh
s {$sel:meshName:CreateMesh' :: Text
meshName = Text
a} :: CreateMesh)
instance Core.AWSRequest CreateMesh where
type AWSResponse CreateMesh = CreateMeshResponse
request :: CreateMesh -> Request CreateMesh
request = Service -> CreateMesh -> Request CreateMesh
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateMesh
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMesh)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateMesh))
-> Logger
-> Service
-> Proxy CreateMesh
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMesh)))
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 -> MeshData -> CreateMeshResponse
CreateMeshResponse'
(Int -> MeshData -> CreateMeshResponse)
-> Either String Int
-> Either String (MeshData -> CreateMeshResponse)
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 (MeshData -> CreateMeshResponse)
-> Either String MeshData -> Either String CreateMeshResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String MeshData
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable CreateMesh
instance Prelude.NFData CreateMesh
instance Core.ToHeaders CreateMesh where
toHeaders :: CreateMesh -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateMesh -> 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 CreateMesh where
toJSON :: CreateMesh -> Value
toJSON CreateMesh' {Maybe [TagRef]
Maybe Text
Maybe MeshSpec
Text
meshName :: Text
tags :: Maybe [TagRef]
spec :: Maybe MeshSpec
clientToken :: Maybe Text
$sel:meshName:CreateMesh' :: CreateMesh -> Text
$sel:tags:CreateMesh' :: CreateMesh -> Maybe [TagRef]
$sel:spec:CreateMesh' :: CreateMesh -> Maybe MeshSpec
$sel:clientToken:CreateMesh' :: CreateMesh -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" 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
clientToken,
(Text
"spec" Text -> MeshSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MeshSpec -> Pair) -> Maybe MeshSpec -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MeshSpec
spec,
(Text
"tags" Text -> [TagRef] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagRef] -> Pair) -> Maybe [TagRef] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagRef]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"meshName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
meshName)
]
)
instance Core.ToPath CreateMesh where
toPath :: CreateMesh -> ByteString
toPath = ByteString -> CreateMesh -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v20190125/meshes"
instance Core.ToQuery CreateMesh where
toQuery :: CreateMesh -> QueryString
toQuery = QueryString -> CreateMesh -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateMeshResponse = CreateMeshResponse'
{
CreateMeshResponse -> Int
httpStatus :: Prelude.Int,
CreateMeshResponse -> MeshData
mesh :: MeshData
}
deriving (CreateMeshResponse -> CreateMeshResponse -> Bool
(CreateMeshResponse -> CreateMeshResponse -> Bool)
-> (CreateMeshResponse -> CreateMeshResponse -> Bool)
-> Eq CreateMeshResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMeshResponse -> CreateMeshResponse -> Bool
$c/= :: CreateMeshResponse -> CreateMeshResponse -> Bool
== :: CreateMeshResponse -> CreateMeshResponse -> Bool
$c== :: CreateMeshResponse -> CreateMeshResponse -> Bool
Prelude.Eq, ReadPrec [CreateMeshResponse]
ReadPrec CreateMeshResponse
Int -> ReadS CreateMeshResponse
ReadS [CreateMeshResponse]
(Int -> ReadS CreateMeshResponse)
-> ReadS [CreateMeshResponse]
-> ReadPrec CreateMeshResponse
-> ReadPrec [CreateMeshResponse]
-> Read CreateMeshResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMeshResponse]
$creadListPrec :: ReadPrec [CreateMeshResponse]
readPrec :: ReadPrec CreateMeshResponse
$creadPrec :: ReadPrec CreateMeshResponse
readList :: ReadS [CreateMeshResponse]
$creadList :: ReadS [CreateMeshResponse]
readsPrec :: Int -> ReadS CreateMeshResponse
$creadsPrec :: Int -> ReadS CreateMeshResponse
Prelude.Read, Int -> CreateMeshResponse -> ShowS
[CreateMeshResponse] -> ShowS
CreateMeshResponse -> String
(Int -> CreateMeshResponse -> ShowS)
-> (CreateMeshResponse -> String)
-> ([CreateMeshResponse] -> ShowS)
-> Show CreateMeshResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMeshResponse] -> ShowS
$cshowList :: [CreateMeshResponse] -> ShowS
show :: CreateMeshResponse -> String
$cshow :: CreateMeshResponse -> String
showsPrec :: Int -> CreateMeshResponse -> ShowS
$cshowsPrec :: Int -> CreateMeshResponse -> ShowS
Prelude.Show, (forall x. CreateMeshResponse -> Rep CreateMeshResponse x)
-> (forall x. Rep CreateMeshResponse x -> CreateMeshResponse)
-> Generic CreateMeshResponse
forall x. Rep CreateMeshResponse x -> CreateMeshResponse
forall x. CreateMeshResponse -> Rep CreateMeshResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMeshResponse x -> CreateMeshResponse
$cfrom :: forall x. CreateMeshResponse -> Rep CreateMeshResponse x
Prelude.Generic)
newCreateMeshResponse ::
Prelude.Int ->
MeshData ->
CreateMeshResponse
newCreateMeshResponse :: Int -> MeshData -> CreateMeshResponse
newCreateMeshResponse Int
pHttpStatus_ MeshData
pMesh_ =
CreateMeshResponse' :: Int -> MeshData -> CreateMeshResponse
CreateMeshResponse'
{ $sel:httpStatus:CreateMeshResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:mesh:CreateMeshResponse' :: MeshData
mesh = MeshData
pMesh_
}
createMeshResponse_httpStatus :: Lens.Lens' CreateMeshResponse Prelude.Int
createMeshResponse_httpStatus :: (Int -> f Int) -> CreateMeshResponse -> f CreateMeshResponse
createMeshResponse_httpStatus = (CreateMeshResponse -> Int)
-> (CreateMeshResponse -> Int -> CreateMeshResponse)
-> Lens CreateMeshResponse CreateMeshResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMeshResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMeshResponse' :: CreateMeshResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMeshResponse
s@CreateMeshResponse' {} Int
a -> CreateMeshResponse
s {$sel:httpStatus:CreateMeshResponse' :: Int
httpStatus = Int
a} :: CreateMeshResponse)
createMeshResponse_mesh :: Lens.Lens' CreateMeshResponse MeshData
createMeshResponse_mesh :: (MeshData -> f MeshData)
-> CreateMeshResponse -> f CreateMeshResponse
createMeshResponse_mesh = (CreateMeshResponse -> MeshData)
-> (CreateMeshResponse -> MeshData -> CreateMeshResponse)
-> Lens CreateMeshResponse CreateMeshResponse MeshData MeshData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMeshResponse' {MeshData
mesh :: MeshData
$sel:mesh:CreateMeshResponse' :: CreateMeshResponse -> MeshData
mesh} -> MeshData
mesh) (\s :: CreateMeshResponse
s@CreateMeshResponse' {} MeshData
a -> CreateMeshResponse
s {$sel:mesh:CreateMeshResponse' :: MeshData
mesh = MeshData
a} :: CreateMeshResponse)
instance Prelude.NFData CreateMeshResponse