{-# 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.Detective.CreateGraph
(
CreateGraph (..),
newCreateGraph,
createGraph_tags,
CreateGraphResponse (..),
newCreateGraphResponse,
createGraphResponse_graphArn,
createGraphResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Detective.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 CreateGraph = CreateGraph'
{
CreateGraph -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
}
deriving (CreateGraph -> CreateGraph -> Bool
(CreateGraph -> CreateGraph -> Bool)
-> (CreateGraph -> CreateGraph -> Bool) -> Eq CreateGraph
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGraph -> CreateGraph -> Bool
$c/= :: CreateGraph -> CreateGraph -> Bool
== :: CreateGraph -> CreateGraph -> Bool
$c== :: CreateGraph -> CreateGraph -> Bool
Prelude.Eq, ReadPrec [CreateGraph]
ReadPrec CreateGraph
Int -> ReadS CreateGraph
ReadS [CreateGraph]
(Int -> ReadS CreateGraph)
-> ReadS [CreateGraph]
-> ReadPrec CreateGraph
-> ReadPrec [CreateGraph]
-> Read CreateGraph
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGraph]
$creadListPrec :: ReadPrec [CreateGraph]
readPrec :: ReadPrec CreateGraph
$creadPrec :: ReadPrec CreateGraph
readList :: ReadS [CreateGraph]
$creadList :: ReadS [CreateGraph]
readsPrec :: Int -> ReadS CreateGraph
$creadsPrec :: Int -> ReadS CreateGraph
Prelude.Read, Int -> CreateGraph -> ShowS
[CreateGraph] -> ShowS
CreateGraph -> String
(Int -> CreateGraph -> ShowS)
-> (CreateGraph -> String)
-> ([CreateGraph] -> ShowS)
-> Show CreateGraph
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGraph] -> ShowS
$cshowList :: [CreateGraph] -> ShowS
show :: CreateGraph -> String
$cshow :: CreateGraph -> String
showsPrec :: Int -> CreateGraph -> ShowS
$cshowsPrec :: Int -> CreateGraph -> ShowS
Prelude.Show, (forall x. CreateGraph -> Rep CreateGraph x)
-> (forall x. Rep CreateGraph x -> CreateGraph)
-> Generic CreateGraph
forall x. Rep CreateGraph x -> CreateGraph
forall x. CreateGraph -> Rep CreateGraph x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGraph x -> CreateGraph
$cfrom :: forall x. CreateGraph -> Rep CreateGraph x
Prelude.Generic)
newCreateGraph ::
CreateGraph
newCreateGraph :: CreateGraph
newCreateGraph = CreateGraph' :: Maybe (HashMap Text Text) -> CreateGraph
CreateGraph' {$sel:tags:CreateGraph' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing}
createGraph_tags :: Lens.Lens' CreateGraph (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createGraph_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateGraph -> f CreateGraph
createGraph_tags = (CreateGraph -> Maybe (HashMap Text Text))
-> (CreateGraph -> Maybe (HashMap Text Text) -> CreateGraph)
-> Lens
CreateGraph
CreateGraph
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraph' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGraph' :: CreateGraph -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateGraph
s@CreateGraph' {} Maybe (HashMap Text Text)
a -> CreateGraph
s {$sel:tags:CreateGraph' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateGraph) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateGraph -> f CreateGraph)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateGraph
-> f CreateGraph
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateGraph where
type AWSResponse CreateGraph = CreateGraphResponse
request :: CreateGraph -> Request CreateGraph
request = Service -> CreateGraph -> Request CreateGraph
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateGraph
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGraph)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateGraph))
-> Logger
-> Service
-> Proxy CreateGraph
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGraph)))
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 Text -> Int -> CreateGraphResponse
CreateGraphResponse'
(Maybe Text -> Int -> CreateGraphResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateGraphResponse)
forall (f :: * -> *) a b. Functor 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
"GraphArn")
Either String (Int -> CreateGraphResponse)
-> Either String Int -> Either String CreateGraphResponse
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 CreateGraph
instance Prelude.NFData CreateGraph
instance Core.ToHeaders CreateGraph where
toHeaders :: CreateGraph -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateGraph -> 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 CreateGraph where
toJSON :: CreateGraph -> Value
toJSON CreateGraph' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGraph' :: CreateGraph -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags]
)
instance Core.ToPath CreateGraph where
toPath :: CreateGraph -> ByteString
toPath = ByteString -> CreateGraph -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/graph"
instance Core.ToQuery CreateGraph where
toQuery :: CreateGraph -> QueryString
toQuery = QueryString -> CreateGraph -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateGraphResponse = CreateGraphResponse'
{
CreateGraphResponse -> Maybe Text
graphArn :: Prelude.Maybe Prelude.Text,
CreateGraphResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateGraphResponse -> CreateGraphResponse -> Bool
(CreateGraphResponse -> CreateGraphResponse -> Bool)
-> (CreateGraphResponse -> CreateGraphResponse -> Bool)
-> Eq CreateGraphResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGraphResponse -> CreateGraphResponse -> Bool
$c/= :: CreateGraphResponse -> CreateGraphResponse -> Bool
== :: CreateGraphResponse -> CreateGraphResponse -> Bool
$c== :: CreateGraphResponse -> CreateGraphResponse -> Bool
Prelude.Eq, ReadPrec [CreateGraphResponse]
ReadPrec CreateGraphResponse
Int -> ReadS CreateGraphResponse
ReadS [CreateGraphResponse]
(Int -> ReadS CreateGraphResponse)
-> ReadS [CreateGraphResponse]
-> ReadPrec CreateGraphResponse
-> ReadPrec [CreateGraphResponse]
-> Read CreateGraphResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGraphResponse]
$creadListPrec :: ReadPrec [CreateGraphResponse]
readPrec :: ReadPrec CreateGraphResponse
$creadPrec :: ReadPrec CreateGraphResponse
readList :: ReadS [CreateGraphResponse]
$creadList :: ReadS [CreateGraphResponse]
readsPrec :: Int -> ReadS CreateGraphResponse
$creadsPrec :: Int -> ReadS CreateGraphResponse
Prelude.Read, Int -> CreateGraphResponse -> ShowS
[CreateGraphResponse] -> ShowS
CreateGraphResponse -> String
(Int -> CreateGraphResponse -> ShowS)
-> (CreateGraphResponse -> String)
-> ([CreateGraphResponse] -> ShowS)
-> Show CreateGraphResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGraphResponse] -> ShowS
$cshowList :: [CreateGraphResponse] -> ShowS
show :: CreateGraphResponse -> String
$cshow :: CreateGraphResponse -> String
showsPrec :: Int -> CreateGraphResponse -> ShowS
$cshowsPrec :: Int -> CreateGraphResponse -> ShowS
Prelude.Show, (forall x. CreateGraphResponse -> Rep CreateGraphResponse x)
-> (forall x. Rep CreateGraphResponse x -> CreateGraphResponse)
-> Generic CreateGraphResponse
forall x. Rep CreateGraphResponse x -> CreateGraphResponse
forall x. CreateGraphResponse -> Rep CreateGraphResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGraphResponse x -> CreateGraphResponse
$cfrom :: forall x. CreateGraphResponse -> Rep CreateGraphResponse x
Prelude.Generic)
newCreateGraphResponse ::
Prelude.Int ->
CreateGraphResponse
newCreateGraphResponse :: Int -> CreateGraphResponse
newCreateGraphResponse Int
pHttpStatus_ =
CreateGraphResponse' :: Maybe Text -> Int -> CreateGraphResponse
CreateGraphResponse'
{ $sel:graphArn:CreateGraphResponse' :: Maybe Text
graphArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateGraphResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createGraphResponse_graphArn :: Lens.Lens' CreateGraphResponse (Prelude.Maybe Prelude.Text)
createGraphResponse_graphArn :: (Maybe Text -> f (Maybe Text))
-> CreateGraphResponse -> f CreateGraphResponse
createGraphResponse_graphArn = (CreateGraphResponse -> Maybe Text)
-> (CreateGraphResponse -> Maybe Text -> CreateGraphResponse)
-> Lens
CreateGraphResponse CreateGraphResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphResponse' {Maybe Text
graphArn :: Maybe Text
$sel:graphArn:CreateGraphResponse' :: CreateGraphResponse -> Maybe Text
graphArn} -> Maybe Text
graphArn) (\s :: CreateGraphResponse
s@CreateGraphResponse' {} Maybe Text
a -> CreateGraphResponse
s {$sel:graphArn:CreateGraphResponse' :: Maybe Text
graphArn = Maybe Text
a} :: CreateGraphResponse)
createGraphResponse_httpStatus :: Lens.Lens' CreateGraphResponse Prelude.Int
createGraphResponse_httpStatus :: (Int -> f Int) -> CreateGraphResponse -> f CreateGraphResponse
createGraphResponse_httpStatus = (CreateGraphResponse -> Int)
-> (CreateGraphResponse -> Int -> CreateGraphResponse)
-> Lens CreateGraphResponse CreateGraphResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateGraphResponse' :: CreateGraphResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateGraphResponse
s@CreateGraphResponse' {} Int
a -> CreateGraphResponse
s {$sel:httpStatus:CreateGraphResponse' :: Int
httpStatus = Int
a} :: CreateGraphResponse)
instance Prelude.NFData CreateGraphResponse