{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.AppSync.StartSchemaCreation
(
startSchemaCreation
, StartSchemaCreation
, sscApiId
, sscDefinition
, startSchemaCreationResponse
, StartSchemaCreationResponse
, sscrsStatus
, sscrsResponseStatus
) where
import Network.AWS.AppSync.Types
import Network.AWS.AppSync.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data StartSchemaCreation = StartSchemaCreation'
{ _sscApiId :: !Text
, _sscDefinition :: !Base64
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startSchemaCreation
:: Text
-> ByteString
-> StartSchemaCreation
startSchemaCreation pApiId_ pDefinition_ =
StartSchemaCreation'
{_sscApiId = pApiId_, _sscDefinition = _Base64 # pDefinition_}
sscApiId :: Lens' StartSchemaCreation Text
sscApiId = lens _sscApiId (\ s a -> s{_sscApiId = a})
sscDefinition :: Lens' StartSchemaCreation ByteString
sscDefinition = lens _sscDefinition (\ s a -> s{_sscDefinition = a}) . _Base64
instance AWSRequest StartSchemaCreation where
type Rs StartSchemaCreation =
StartSchemaCreationResponse
request = postJSON appSync
response
= receiveJSON
(\ s h x ->
StartSchemaCreationResponse' <$>
(x .?> "status") <*> (pure (fromEnum s)))
instance Hashable StartSchemaCreation where
instance NFData StartSchemaCreation where
instance ToHeaders StartSchemaCreation where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON StartSchemaCreation where
toJSON StartSchemaCreation'{..}
= object
(catMaybes [Just ("definition" .= _sscDefinition)])
instance ToPath StartSchemaCreation where
toPath StartSchemaCreation'{..}
= mconcat
["/v1/apis/", toBS _sscApiId, "/schemacreation"]
instance ToQuery StartSchemaCreation where
toQuery = const mempty
data StartSchemaCreationResponse = StartSchemaCreationResponse'
{ _sscrsStatus :: !(Maybe SchemaStatus)
, _sscrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
startSchemaCreationResponse
:: Int
-> StartSchemaCreationResponse
startSchemaCreationResponse pResponseStatus_ =
StartSchemaCreationResponse'
{_sscrsStatus = Nothing, _sscrsResponseStatus = pResponseStatus_}
sscrsStatus :: Lens' StartSchemaCreationResponse (Maybe SchemaStatus)
sscrsStatus = lens _sscrsStatus (\ s a -> s{_sscrsStatus = a})
sscrsResponseStatus :: Lens' StartSchemaCreationResponse Int
sscrsResponseStatus = lens _sscrsResponseStatus (\ s a -> s{_sscrsResponseStatus = a})
instance NFData StartSchemaCreationResponse where