{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Detective.Types
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
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]
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
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. 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' {$sel:tags:CreateGraph' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing}
createGraph_tags :: Lens.Lens' CreateGraph (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createGraph_tags :: Lens' CreateGraph (Maybe (HashMap Text Text))
createGraph_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: (Service -> Service) -> CreateGraph -> Request CreateGraph
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 CreateGraph
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGraph)))
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 Text -> Int -> CreateGraphResponse
CreateGraphResponse'
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
"GraphArn")
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 CreateGraph where
hashWithSalt :: Int -> CreateGraph -> Int
hashWithSalt Int
_salt CreateGraph' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGraph' :: CreateGraph -> Maybe (HashMap Text Text)
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
instance Prelude.NFData CreateGraph where
rnf :: CreateGraph -> ()
rnf CreateGraph' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGraph' :: CreateGraph -> Maybe (HashMap Text Text)
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
instance Data.ToHeaders CreateGraph where
toHeaders :: CreateGraph -> 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 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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"Tags" 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 (HashMap Text Text)
tags]
)
instance Data.ToPath CreateGraph where
toPath :: CreateGraph -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/graph"
instance Data.ToQuery CreateGraph where
toQuery :: CreateGraph -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:graphArn:CreateGraphResponse' :: Maybe Text
graphArn = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateGraphResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createGraphResponse_graphArn :: Lens.Lens' CreateGraphResponse (Prelude.Maybe Prelude.Text)
createGraphResponse_graphArn :: Lens' CreateGraphResponse (Maybe Text)
createGraphResponse_graphArn = 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 :: Lens' CreateGraphResponse Int
createGraphResponse_httpStatus = 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 where
rnf :: CreateGraphResponse -> ()
rnf CreateGraphResponse' {Int
Maybe Text
httpStatus :: Int
graphArn :: Maybe Text
$sel:httpStatus:CreateGraphResponse' :: CreateGraphResponse -> Int
$sel:graphArn:CreateGraphResponse' :: CreateGraphResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
graphArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus