{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.AWS.AppSync.Types.Product where
import Network.AWS.AppSync.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
data APIKey = APIKey'
{ _akExpires :: !(Maybe Integer)
, _akId :: !(Maybe Text)
, _akDescription :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
apiKey
:: APIKey
apiKey =
APIKey' {_akExpires = Nothing, _akId = Nothing, _akDescription = Nothing}
akExpires :: Lens' APIKey (Maybe Integer)
akExpires = lens _akExpires (\ s a -> s{_akExpires = a})
akId :: Lens' APIKey (Maybe Text)
akId = lens _akId (\ s a -> s{_akId = a})
akDescription :: Lens' APIKey (Maybe Text)
akDescription = lens _akDescription (\ s a -> s{_akDescription = a})
instance FromJSON APIKey where
parseJSON
= withObject "APIKey"
(\ x ->
APIKey' <$>
(x .:? "expires") <*> (x .:? "id") <*>
(x .:? "description"))
instance Hashable APIKey where
instance NFData APIKey where
data DataSource = DataSource'
{ _dsServiceRoleARN :: !(Maybe Text)
, _dsDataSourceARN :: !(Maybe Text)
, _dsDynamodbConfig :: !(Maybe DynamodbDataSourceConfig)
, _dsName :: !(Maybe Text)
, _dsLambdaConfig :: !(Maybe LambdaDataSourceConfig)
, _dsType :: !(Maybe DataSourceType)
, _dsDescription :: !(Maybe Text)
, _dsElasticsearchConfig :: !(Maybe ElasticsearchDataSourceConfig)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
dataSource
:: DataSource
dataSource =
DataSource'
{ _dsServiceRoleARN = Nothing
, _dsDataSourceARN = Nothing
, _dsDynamodbConfig = Nothing
, _dsName = Nothing
, _dsLambdaConfig = Nothing
, _dsType = Nothing
, _dsDescription = Nothing
, _dsElasticsearchConfig = Nothing
}
dsServiceRoleARN :: Lens' DataSource (Maybe Text)
dsServiceRoleARN = lens _dsServiceRoleARN (\ s a -> s{_dsServiceRoleARN = a})
dsDataSourceARN :: Lens' DataSource (Maybe Text)
dsDataSourceARN = lens _dsDataSourceARN (\ s a -> s{_dsDataSourceARN = a})
dsDynamodbConfig :: Lens' DataSource (Maybe DynamodbDataSourceConfig)
dsDynamodbConfig = lens _dsDynamodbConfig (\ s a -> s{_dsDynamodbConfig = a})
dsName :: Lens' DataSource (Maybe Text)
dsName = lens _dsName (\ s a -> s{_dsName = a})
dsLambdaConfig :: Lens' DataSource (Maybe LambdaDataSourceConfig)
dsLambdaConfig = lens _dsLambdaConfig (\ s a -> s{_dsLambdaConfig = a})
dsType :: Lens' DataSource (Maybe DataSourceType)
dsType = lens _dsType (\ s a -> s{_dsType = a})
dsDescription :: Lens' DataSource (Maybe Text)
dsDescription = lens _dsDescription (\ s a -> s{_dsDescription = a})
dsElasticsearchConfig :: Lens' DataSource (Maybe ElasticsearchDataSourceConfig)
dsElasticsearchConfig = lens _dsElasticsearchConfig (\ s a -> s{_dsElasticsearchConfig = a})
instance FromJSON DataSource where
parseJSON
= withObject "DataSource"
(\ x ->
DataSource' <$>
(x .:? "serviceRoleArn") <*> (x .:? "dataSourceArn")
<*> (x .:? "dynamodbConfig")
<*> (x .:? "name")
<*> (x .:? "lambdaConfig")
<*> (x .:? "type")
<*> (x .:? "description")
<*> (x .:? "elasticsearchConfig"))
instance Hashable DataSource where
instance NFData DataSource where
data DynamodbDataSourceConfig = DynamodbDataSourceConfig'
{ _ddscUseCallerCredentials :: !(Maybe Bool)
, _ddscTableName :: !Text
, _ddscAwsRegion :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
dynamodbDataSourceConfig
:: Text
-> Text
-> DynamodbDataSourceConfig
dynamodbDataSourceConfig pTableName_ pAwsRegion_ =
DynamodbDataSourceConfig'
{ _ddscUseCallerCredentials = Nothing
, _ddscTableName = pTableName_
, _ddscAwsRegion = pAwsRegion_
}
ddscUseCallerCredentials :: Lens' DynamodbDataSourceConfig (Maybe Bool)
ddscUseCallerCredentials = lens _ddscUseCallerCredentials (\ s a -> s{_ddscUseCallerCredentials = a})
ddscTableName :: Lens' DynamodbDataSourceConfig Text
ddscTableName = lens _ddscTableName (\ s a -> s{_ddscTableName = a})
ddscAwsRegion :: Lens' DynamodbDataSourceConfig Text
ddscAwsRegion = lens _ddscAwsRegion (\ s a -> s{_ddscAwsRegion = a})
instance FromJSON DynamodbDataSourceConfig where
parseJSON
= withObject "DynamodbDataSourceConfig"
(\ x ->
DynamodbDataSourceConfig' <$>
(x .:? "useCallerCredentials") <*> (x .: "tableName")
<*> (x .: "awsRegion"))
instance Hashable DynamodbDataSourceConfig where
instance NFData DynamodbDataSourceConfig where
instance ToJSON DynamodbDataSourceConfig where
toJSON DynamodbDataSourceConfig'{..}
= object
(catMaybes
[("useCallerCredentials" .=) <$>
_ddscUseCallerCredentials,
Just ("tableName" .= _ddscTableName),
Just ("awsRegion" .= _ddscAwsRegion)])
data ElasticsearchDataSourceConfig = ElasticsearchDataSourceConfig'
{ _edscEndpoint :: !Text
, _edscAwsRegion :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
elasticsearchDataSourceConfig
:: Text
-> Text
-> ElasticsearchDataSourceConfig
elasticsearchDataSourceConfig pEndpoint_ pAwsRegion_ =
ElasticsearchDataSourceConfig'
{_edscEndpoint = pEndpoint_, _edscAwsRegion = pAwsRegion_}
edscEndpoint :: Lens' ElasticsearchDataSourceConfig Text
edscEndpoint = lens _edscEndpoint (\ s a -> s{_edscEndpoint = a})
edscAwsRegion :: Lens' ElasticsearchDataSourceConfig Text
edscAwsRegion = lens _edscAwsRegion (\ s a -> s{_edscAwsRegion = a})
instance FromJSON ElasticsearchDataSourceConfig where
parseJSON
= withObject "ElasticsearchDataSourceConfig"
(\ x ->
ElasticsearchDataSourceConfig' <$>
(x .: "endpoint") <*> (x .: "awsRegion"))
instance Hashable ElasticsearchDataSourceConfig where
instance NFData ElasticsearchDataSourceConfig where
instance ToJSON ElasticsearchDataSourceConfig where
toJSON ElasticsearchDataSourceConfig'{..}
= object
(catMaybes
[Just ("endpoint" .= _edscEndpoint),
Just ("awsRegion" .= _edscAwsRegion)])
data GraphqlAPI = GraphqlAPI'
{ _gaArn :: !(Maybe Text)
, _gaApiId :: !(Maybe Text)
, _gaUris :: !(Maybe (Map Text Text))
, _gaOpenIdConnectConfig :: !(Maybe OpenIdConnectConfig)
, _gaName :: !(Maybe Text)
, _gaUserPoolConfig :: !(Maybe UserPoolConfig)
, _gaAuthenticationType :: !(Maybe AuthenticationType)
, _gaLogConfig :: !(Maybe LogConfig)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
graphqlAPI
:: GraphqlAPI
graphqlAPI =
GraphqlAPI'
{ _gaArn = Nothing
, _gaApiId = Nothing
, _gaUris = Nothing
, _gaOpenIdConnectConfig = Nothing
, _gaName = Nothing
, _gaUserPoolConfig = Nothing
, _gaAuthenticationType = Nothing
, _gaLogConfig = Nothing
}
gaArn :: Lens' GraphqlAPI (Maybe Text)
gaArn = lens _gaArn (\ s a -> s{_gaArn = a})
gaApiId :: Lens' GraphqlAPI (Maybe Text)
gaApiId = lens _gaApiId (\ s a -> s{_gaApiId = a})
gaUris :: Lens' GraphqlAPI (HashMap Text Text)
gaUris = lens _gaUris (\ s a -> s{_gaUris = a}) . _Default . _Map
gaOpenIdConnectConfig :: Lens' GraphqlAPI (Maybe OpenIdConnectConfig)
gaOpenIdConnectConfig = lens _gaOpenIdConnectConfig (\ s a -> s{_gaOpenIdConnectConfig = a})
gaName :: Lens' GraphqlAPI (Maybe Text)
gaName = lens _gaName (\ s a -> s{_gaName = a})
gaUserPoolConfig :: Lens' GraphqlAPI (Maybe UserPoolConfig)
gaUserPoolConfig = lens _gaUserPoolConfig (\ s a -> s{_gaUserPoolConfig = a})
gaAuthenticationType :: Lens' GraphqlAPI (Maybe AuthenticationType)
gaAuthenticationType = lens _gaAuthenticationType (\ s a -> s{_gaAuthenticationType = a})
gaLogConfig :: Lens' GraphqlAPI (Maybe LogConfig)
gaLogConfig = lens _gaLogConfig (\ s a -> s{_gaLogConfig = a})
instance FromJSON GraphqlAPI where
parseJSON
= withObject "GraphqlAPI"
(\ x ->
GraphqlAPI' <$>
(x .:? "arn") <*> (x .:? "apiId") <*>
(x .:? "uris" .!= mempty)
<*> (x .:? "openIDConnectConfig")
<*> (x .:? "name")
<*> (x .:? "userPoolConfig")
<*> (x .:? "authenticationType")
<*> (x .:? "logConfig"))
instance Hashable GraphqlAPI where
instance NFData GraphqlAPI where
newtype LambdaDataSourceConfig = LambdaDataSourceConfig'
{ _ldscLambdaFunctionARN :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
lambdaDataSourceConfig
:: Text
-> LambdaDataSourceConfig
lambdaDataSourceConfig pLambdaFunctionARN_ =
LambdaDataSourceConfig' {_ldscLambdaFunctionARN = pLambdaFunctionARN_}
ldscLambdaFunctionARN :: Lens' LambdaDataSourceConfig Text
ldscLambdaFunctionARN = lens _ldscLambdaFunctionARN (\ s a -> s{_ldscLambdaFunctionARN = a})
instance FromJSON LambdaDataSourceConfig where
parseJSON
= withObject "LambdaDataSourceConfig"
(\ x ->
LambdaDataSourceConfig' <$>
(x .: "lambdaFunctionArn"))
instance Hashable LambdaDataSourceConfig where
instance NFData LambdaDataSourceConfig where
instance ToJSON LambdaDataSourceConfig where
toJSON LambdaDataSourceConfig'{..}
= object
(catMaybes
[Just
("lambdaFunctionArn" .= _ldscLambdaFunctionARN)])
data LogConfig = LogConfig'
{ _lcFieldLogLevel :: !FieldLogLevel
, _lcCloudWatchLogsRoleARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
logConfig
:: FieldLogLevel
-> Text
-> LogConfig
logConfig pFieldLogLevel_ pCloudWatchLogsRoleARN_ =
LogConfig'
{ _lcFieldLogLevel = pFieldLogLevel_
, _lcCloudWatchLogsRoleARN = pCloudWatchLogsRoleARN_
}
lcFieldLogLevel :: Lens' LogConfig FieldLogLevel
lcFieldLogLevel = lens _lcFieldLogLevel (\ s a -> s{_lcFieldLogLevel = a})
lcCloudWatchLogsRoleARN :: Lens' LogConfig Text
lcCloudWatchLogsRoleARN = lens _lcCloudWatchLogsRoleARN (\ s a -> s{_lcCloudWatchLogsRoleARN = a})
instance FromJSON LogConfig where
parseJSON
= withObject "LogConfig"
(\ x ->
LogConfig' <$>
(x .: "fieldLogLevel") <*>
(x .: "cloudWatchLogsRoleArn"))
instance Hashable LogConfig where
instance NFData LogConfig where
instance ToJSON LogConfig where
toJSON LogConfig'{..}
= object
(catMaybes
[Just ("fieldLogLevel" .= _lcFieldLogLevel),
Just
("cloudWatchLogsRoleArn" .=
_lcCloudWatchLogsRoleARN)])
data OpenIdConnectConfig = OpenIdConnectConfig'
{ _oiccAuthTTL :: !(Maybe Integer)
, _oiccClientId :: !(Maybe Text)
, _oiccIatTTL :: !(Maybe Integer)
, _oiccIssuer :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
openIdConnectConfig
:: Text
-> OpenIdConnectConfig
openIdConnectConfig pIssuer_ =
OpenIdConnectConfig'
{ _oiccAuthTTL = Nothing
, _oiccClientId = Nothing
, _oiccIatTTL = Nothing
, _oiccIssuer = pIssuer_
}
oiccAuthTTL :: Lens' OpenIdConnectConfig (Maybe Integer)
oiccAuthTTL = lens _oiccAuthTTL (\ s a -> s{_oiccAuthTTL = a})
oiccClientId :: Lens' OpenIdConnectConfig (Maybe Text)
oiccClientId = lens _oiccClientId (\ s a -> s{_oiccClientId = a})
oiccIatTTL :: Lens' OpenIdConnectConfig (Maybe Integer)
oiccIatTTL = lens _oiccIatTTL (\ s a -> s{_oiccIatTTL = a})
oiccIssuer :: Lens' OpenIdConnectConfig Text
oiccIssuer = lens _oiccIssuer (\ s a -> s{_oiccIssuer = a})
instance FromJSON OpenIdConnectConfig where
parseJSON
= withObject "OpenIdConnectConfig"
(\ x ->
OpenIdConnectConfig' <$>
(x .:? "authTTL") <*> (x .:? "clientId") <*>
(x .:? "iatTTL")
<*> (x .: "issuer"))
instance Hashable OpenIdConnectConfig where
instance NFData OpenIdConnectConfig where
instance ToJSON OpenIdConnectConfig where
toJSON OpenIdConnectConfig'{..}
= object
(catMaybes
[("authTTL" .=) <$> _oiccAuthTTL,
("clientId" .=) <$> _oiccClientId,
("iatTTL" .=) <$> _oiccIatTTL,
Just ("issuer" .= _oiccIssuer)])
data Resolver = Resolver'
{ _rTypeName :: !(Maybe Text)
, _rDataSourceName :: !(Maybe Text)
, _rRequestMappingTemplate :: !(Maybe Text)
, _rResolverARN :: !(Maybe Text)
, _rResponseMappingTemplate :: !(Maybe Text)
, _rFieldName :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
resolver
:: Resolver
resolver =
Resolver'
{ _rTypeName = Nothing
, _rDataSourceName = Nothing
, _rRequestMappingTemplate = Nothing
, _rResolverARN = Nothing
, _rResponseMappingTemplate = Nothing
, _rFieldName = Nothing
}
rTypeName :: Lens' Resolver (Maybe Text)
rTypeName = lens _rTypeName (\ s a -> s{_rTypeName = a})
rDataSourceName :: Lens' Resolver (Maybe Text)
rDataSourceName = lens _rDataSourceName (\ s a -> s{_rDataSourceName = a})
rRequestMappingTemplate :: Lens' Resolver (Maybe Text)
rRequestMappingTemplate = lens _rRequestMappingTemplate (\ s a -> s{_rRequestMappingTemplate = a})
rResolverARN :: Lens' Resolver (Maybe Text)
rResolverARN = lens _rResolverARN (\ s a -> s{_rResolverARN = a})
rResponseMappingTemplate :: Lens' Resolver (Maybe Text)
rResponseMappingTemplate = lens _rResponseMappingTemplate (\ s a -> s{_rResponseMappingTemplate = a})
rFieldName :: Lens' Resolver (Maybe Text)
rFieldName = lens _rFieldName (\ s a -> s{_rFieldName = a})
instance FromJSON Resolver where
parseJSON
= withObject "Resolver"
(\ x ->
Resolver' <$>
(x .:? "typeName") <*> (x .:? "dataSourceName") <*>
(x .:? "requestMappingTemplate")
<*> (x .:? "resolverArn")
<*> (x .:? "responseMappingTemplate")
<*> (x .:? "fieldName"))
instance Hashable Resolver where
instance NFData Resolver where
data Type = Type'
{ _tArn :: !(Maybe Text)
, _tDefinition :: !(Maybe Text)
, _tFormat :: !(Maybe TypeDefinitionFormat)
, _tName :: !(Maybe Text)
, _tDescription :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
type'
:: Type
type' =
Type'
{ _tArn = Nothing
, _tDefinition = Nothing
, _tFormat = Nothing
, _tName = Nothing
, _tDescription = Nothing
}
tArn :: Lens' Type (Maybe Text)
tArn = lens _tArn (\ s a -> s{_tArn = a})
tDefinition :: Lens' Type (Maybe Text)
tDefinition = lens _tDefinition (\ s a -> s{_tDefinition = a})
tFormat :: Lens' Type (Maybe TypeDefinitionFormat)
tFormat = lens _tFormat (\ s a -> s{_tFormat = a})
tName :: Lens' Type (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a})
tDescription :: Lens' Type (Maybe Text)
tDescription = lens _tDescription (\ s a -> s{_tDescription = a})
instance FromJSON Type where
parseJSON
= withObject "Type"
(\ x ->
Type' <$>
(x .:? "arn") <*> (x .:? "definition") <*>
(x .:? "format")
<*> (x .:? "name")
<*> (x .:? "description"))
instance Hashable Type where
instance NFData Type where
data UserPoolConfig = UserPoolConfig'
{ _upcAppIdClientRegex :: !(Maybe Text)
, _upcUserPoolId :: !Text
, _upcAwsRegion :: !Text
, _upcDefaultAction :: !DefaultAction
} deriving (Eq, Read, Show, Data, Typeable, Generic)
userPoolConfig
:: Text
-> Text
-> DefaultAction
-> UserPoolConfig
userPoolConfig pUserPoolId_ pAwsRegion_ pDefaultAction_ =
UserPoolConfig'
{ _upcAppIdClientRegex = Nothing
, _upcUserPoolId = pUserPoolId_
, _upcAwsRegion = pAwsRegion_
, _upcDefaultAction = pDefaultAction_
}
upcAppIdClientRegex :: Lens' UserPoolConfig (Maybe Text)
upcAppIdClientRegex = lens _upcAppIdClientRegex (\ s a -> s{_upcAppIdClientRegex = a})
upcUserPoolId :: Lens' UserPoolConfig Text
upcUserPoolId = lens _upcUserPoolId (\ s a -> s{_upcUserPoolId = a})
upcAwsRegion :: Lens' UserPoolConfig Text
upcAwsRegion = lens _upcAwsRegion (\ s a -> s{_upcAwsRegion = a})
upcDefaultAction :: Lens' UserPoolConfig DefaultAction
upcDefaultAction = lens _upcDefaultAction (\ s a -> s{_upcDefaultAction = a})
instance FromJSON UserPoolConfig where
parseJSON
= withObject "UserPoolConfig"
(\ x ->
UserPoolConfig' <$>
(x .:? "appIdClientRegex") <*> (x .: "userPoolId")
<*> (x .: "awsRegion")
<*> (x .: "defaultAction"))
instance Hashable UserPoolConfig where
instance NFData UserPoolConfig where
instance ToJSON UserPoolConfig where
toJSON UserPoolConfig'{..}
= object
(catMaybes
[("appIdClientRegex" .=) <$> _upcAppIdClientRegex,
Just ("userPoolId" .= _upcUserPoolId),
Just ("awsRegion" .= _upcAwsRegion),
Just ("defaultAction" .= _upcDefaultAction)])