module Network.Google.PubSub.Types.Product where
import Network.Google.Prelude
import Network.Google.PubSub.Types.Sum
data PushConfig = PushConfig
{ _pcAttributes :: !(Maybe PushConfigAttributes)
, _pcPushEndpoint :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
pushConfig
:: PushConfig
pushConfig =
PushConfig
{ _pcAttributes = Nothing
, _pcPushEndpoint = Nothing
}
pcAttributes :: Lens' PushConfig (Maybe PushConfigAttributes)
pcAttributes
= lens _pcAttributes (\ s a -> s{_pcAttributes = a})
pcPushEndpoint :: Lens' PushConfig (Maybe Text)
pcPushEndpoint
= lens _pcPushEndpoint
(\ s a -> s{_pcPushEndpoint = a})
instance FromJSON PushConfig where
parseJSON
= withObject "PushConfig"
(\ o ->
PushConfig <$>
(o .:? "attributes") <*> (o .:? "pushEndpoint"))
instance ToJSON PushConfig where
toJSON PushConfig{..}
= object
(catMaybes
[("attributes" .=) <$> _pcAttributes,
("pushEndpoint" .=) <$> _pcPushEndpoint])
data ReceivedMessage = ReceivedMessage
{ _rmAckId :: !(Maybe Text)
, _rmMessage :: !(Maybe PubsubMessage)
} deriving (Eq,Show,Data,Typeable,Generic)
receivedMessage
:: ReceivedMessage
receivedMessage =
ReceivedMessage
{ _rmAckId = Nothing
, _rmMessage = Nothing
}
rmAckId :: Lens' ReceivedMessage (Maybe Text)
rmAckId = lens _rmAckId (\ s a -> s{_rmAckId = a})
rmMessage :: Lens' ReceivedMessage (Maybe PubsubMessage)
rmMessage
= lens _rmMessage (\ s a -> s{_rmMessage = a})
instance FromJSON ReceivedMessage where
parseJSON
= withObject "ReceivedMessage"
(\ o ->
ReceivedMessage <$>
(o .:? "ackId") <*> (o .:? "message"))
instance ToJSON ReceivedMessage where
toJSON ReceivedMessage{..}
= object
(catMaybes
[("ackId" .=) <$> _rmAckId,
("message" .=) <$> _rmMessage])
data ModifyAckDeadlineRequest = ModifyAckDeadlineRequest
{ _madrAckIds :: !(Maybe [Text])
, _madrAckDeadlineSeconds :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
modifyAckDeadlineRequest
:: ModifyAckDeadlineRequest
modifyAckDeadlineRequest =
ModifyAckDeadlineRequest
{ _madrAckIds = Nothing
, _madrAckDeadlineSeconds = Nothing
}
madrAckIds :: Lens' ModifyAckDeadlineRequest [Text]
madrAckIds
= lens _madrAckIds (\ s a -> s{_madrAckIds = a}) .
_Default
. _Coerce
madrAckDeadlineSeconds :: Lens' ModifyAckDeadlineRequest (Maybe Int32)
madrAckDeadlineSeconds
= lens _madrAckDeadlineSeconds
(\ s a -> s{_madrAckDeadlineSeconds = a})
. mapping _Coerce
instance FromJSON ModifyAckDeadlineRequest where
parseJSON
= withObject "ModifyAckDeadlineRequest"
(\ o ->
ModifyAckDeadlineRequest <$>
(o .:? "ackIds" .!= mempty) <*>
(o .:? "ackDeadlineSeconds"))
instance ToJSON ModifyAckDeadlineRequest where
toJSON ModifyAckDeadlineRequest{..}
= object
(catMaybes
[("ackIds" .=) <$> _madrAckIds,
("ackDeadlineSeconds" .=) <$>
_madrAckDeadlineSeconds])
newtype ModifyPushConfigRequest = ModifyPushConfigRequest
{ _mpcrPushConfig :: Maybe PushConfig
} deriving (Eq,Show,Data,Typeable,Generic)
modifyPushConfigRequest
:: ModifyPushConfigRequest
modifyPushConfigRequest =
ModifyPushConfigRequest
{ _mpcrPushConfig = Nothing
}
mpcrPushConfig :: Lens' ModifyPushConfigRequest (Maybe PushConfig)
mpcrPushConfig
= lens _mpcrPushConfig
(\ s a -> s{_mpcrPushConfig = a})
instance FromJSON ModifyPushConfigRequest where
parseJSON
= withObject "ModifyPushConfigRequest"
(\ o ->
ModifyPushConfigRequest <$> (o .:? "pushConfig"))
instance ToJSON ModifyPushConfigRequest where
toJSON ModifyPushConfigRequest{..}
= object
(catMaybes [("pushConfig" .=) <$> _mpcrPushConfig])
data Empty =
Empty
deriving (Eq,Show,Data,Typeable,Generic)
empty
:: Empty
empty = Empty
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty)
instance ToJSON Empty where
toJSON = const emptyObject
data PubsubMessage = PubsubMessage
{ _pmData :: !(Maybe (Textual Word8))
, _pmAttributes :: !(Maybe PubsubMessageAttributes)
, _pmMessageId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
pubsubMessage
:: PubsubMessage
pubsubMessage =
PubsubMessage
{ _pmData = Nothing
, _pmAttributes = Nothing
, _pmMessageId = Nothing
}
pmData :: Lens' PubsubMessage (Maybe Word8)
pmData
= lens _pmData (\ s a -> s{_pmData = a}) .
mapping _Coerce
pmAttributes :: Lens' PubsubMessage (Maybe PubsubMessageAttributes)
pmAttributes
= lens _pmAttributes (\ s a -> s{_pmAttributes = a})
pmMessageId :: Lens' PubsubMessage (Maybe Text)
pmMessageId
= lens _pmMessageId (\ s a -> s{_pmMessageId = a})
instance FromJSON PubsubMessage where
parseJSON
= withObject "PubsubMessage"
(\ o ->
PubsubMessage <$>
(o .:? "data") <*> (o .:? "attributes") <*>
(o .:? "messageId"))
instance ToJSON PubsubMessage where
toJSON PubsubMessage{..}
= object
(catMaybes
[("data" .=) <$> _pmData,
("attributes" .=) <$> _pmAttributes,
("messageId" .=) <$> _pmMessageId])
data ListTopicSubscriptionsResponse = ListTopicSubscriptionsResponse
{ _ltsrNextPageToken :: !(Maybe Text)
, _ltsrSubscriptions :: !(Maybe [Text])
} deriving (Eq,Show,Data,Typeable,Generic)
listTopicSubscriptionsResponse
:: ListTopicSubscriptionsResponse
listTopicSubscriptionsResponse =
ListTopicSubscriptionsResponse
{ _ltsrNextPageToken = Nothing
, _ltsrSubscriptions = Nothing
}
ltsrNextPageToken :: Lens' ListTopicSubscriptionsResponse (Maybe Text)
ltsrNextPageToken
= lens _ltsrNextPageToken
(\ s a -> s{_ltsrNextPageToken = a})
ltsrSubscriptions :: Lens' ListTopicSubscriptionsResponse [Text]
ltsrSubscriptions
= lens _ltsrSubscriptions
(\ s a -> s{_ltsrSubscriptions = a})
. _Default
. _Coerce
instance FromJSON ListTopicSubscriptionsResponse
where
parseJSON
= withObject "ListTopicSubscriptionsResponse"
(\ o ->
ListTopicSubscriptionsResponse <$>
(o .:? "nextPageToken") <*>
(o .:? "subscriptions" .!= mempty))
instance ToJSON ListTopicSubscriptionsResponse where
toJSON ListTopicSubscriptionsResponse{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ltsrNextPageToken,
("subscriptions" .=) <$> _ltsrSubscriptions])
data ListTopicsResponse = ListTopicsResponse
{ _ltrNextPageToken :: !(Maybe Text)
, _ltrTopics :: !(Maybe [Topic])
} deriving (Eq,Show,Data,Typeable,Generic)
listTopicsResponse
:: ListTopicsResponse
listTopicsResponse =
ListTopicsResponse
{ _ltrNextPageToken = Nothing
, _ltrTopics = Nothing
}
ltrNextPageToken :: Lens' ListTopicsResponse (Maybe Text)
ltrNextPageToken
= lens _ltrNextPageToken
(\ s a -> s{_ltrNextPageToken = a})
ltrTopics :: Lens' ListTopicsResponse [Topic]
ltrTopics
= lens _ltrTopics (\ s a -> s{_ltrTopics = a}) .
_Default
. _Coerce
instance FromJSON ListTopicsResponse where
parseJSON
= withObject "ListTopicsResponse"
(\ o ->
ListTopicsResponse <$>
(o .:? "nextPageToken") <*>
(o .:? "topics" .!= mempty))
instance ToJSON ListTopicsResponse where
toJSON ListTopicsResponse{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ltrNextPageToken,
("topics" .=) <$> _ltrTopics])
newtype PullResponse = PullResponse
{ _prReceivedMessages :: Maybe [ReceivedMessage]
} deriving (Eq,Show,Data,Typeable,Generic)
pullResponse
:: PullResponse
pullResponse =
PullResponse
{ _prReceivedMessages = Nothing
}
prReceivedMessages :: Lens' PullResponse [ReceivedMessage]
prReceivedMessages
= lens _prReceivedMessages
(\ s a -> s{_prReceivedMessages = a})
. _Default
. _Coerce
instance FromJSON PullResponse where
parseJSON
= withObject "PullResponse"
(\ o ->
PullResponse <$>
(o .:? "receivedMessages" .!= mempty))
instance ToJSON PullResponse where
toJSON PullResponse{..}
= object
(catMaybes
[("receivedMessages" .=) <$> _prReceivedMessages])
newtype SetIAMPolicyRequest = SetIAMPolicyRequest
{ _siprPolicy :: Maybe Policy
} deriving (Eq,Show,Data,Typeable,Generic)
setIAMPolicyRequest
:: SetIAMPolicyRequest
setIAMPolicyRequest =
SetIAMPolicyRequest
{ _siprPolicy = Nothing
}
siprPolicy :: Lens' SetIAMPolicyRequest (Maybe Policy)
siprPolicy
= lens _siprPolicy (\ s a -> s{_siprPolicy = a})
instance FromJSON SetIAMPolicyRequest where
parseJSON
= withObject "SetIAMPolicyRequest"
(\ o -> SetIAMPolicyRequest <$> (o .:? "policy"))
instance ToJSON SetIAMPolicyRequest where
toJSON SetIAMPolicyRequest{..}
= object (catMaybes [("policy" .=) <$> _siprPolicy])
newtype Topic = Topic
{ _tName :: Maybe Text
} deriving (Eq,Show,Data,Typeable,Generic)
topic
:: Topic
topic =
Topic
{ _tName = Nothing
}
tName :: Lens' Topic (Maybe Text)
tName = lens _tName (\ s a -> s{_tName = a})
instance FromJSON Topic where
parseJSON
= withObject "Topic"
(\ o -> Topic <$> (o .:? "name"))
instance ToJSON Topic where
toJSON Topic{..}
= object (catMaybes [("name" .=) <$> _tName])
data PullRequest = PullRequest
{ _prMaxMessages :: !(Maybe (Textual Int32))
, _prReturnImmediately :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
pullRequest
:: PullRequest
pullRequest =
PullRequest
{ _prMaxMessages = Nothing
, _prReturnImmediately = Nothing
}
prMaxMessages :: Lens' PullRequest (Maybe Int32)
prMaxMessages
= lens _prMaxMessages
(\ s a -> s{_prMaxMessages = a})
. mapping _Coerce
prReturnImmediately :: Lens' PullRequest (Maybe Bool)
prReturnImmediately
= lens _prReturnImmediately
(\ s a -> s{_prReturnImmediately = a})
instance FromJSON PullRequest where
parseJSON
= withObject "PullRequest"
(\ o ->
PullRequest <$>
(o .:? "maxMessages") <*>
(o .:? "returnImmediately"))
instance ToJSON PullRequest where
toJSON PullRequest{..}
= object
(catMaybes
[("maxMessages" .=) <$> _prMaxMessages,
("returnImmediately" .=) <$> _prReturnImmediately])
newtype PubsubMessageAttributes = PubsubMessageAttributes
{ _pmaAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
pubsubMessageAttributes
:: HashMap Text Text
-> PubsubMessageAttributes
pubsubMessageAttributes pPmaAddtional_ =
PubsubMessageAttributes
{ _pmaAddtional = _Coerce # pPmaAddtional_
}
pmaAddtional :: Lens' PubsubMessageAttributes (HashMap Text Text)
pmaAddtional
= lens _pmaAddtional (\ s a -> s{_pmaAddtional = a})
. _Coerce
instance FromJSON PubsubMessageAttributes where
parseJSON
= withObject "PubsubMessageAttributes"
(\ o ->
PubsubMessageAttributes <$> (parseJSONObject o))
instance ToJSON PubsubMessageAttributes where
toJSON = toJSON . _pmaAddtional
newtype TestIAMPermissionsRequest = TestIAMPermissionsRequest
{ _tiprPermissions :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
testIAMPermissionsRequest
:: TestIAMPermissionsRequest
testIAMPermissionsRequest =
TestIAMPermissionsRequest
{ _tiprPermissions = Nothing
}
tiprPermissions :: Lens' TestIAMPermissionsRequest [Text]
tiprPermissions
= lens _tiprPermissions
(\ s a -> s{_tiprPermissions = a})
. _Default
. _Coerce
instance FromJSON TestIAMPermissionsRequest where
parseJSON
= withObject "TestIAMPermissionsRequest"
(\ o ->
TestIAMPermissionsRequest <$>
(o .:? "permissions" .!= mempty))
instance ToJSON TestIAMPermissionsRequest where
toJSON TestIAMPermissionsRequest{..}
= object
(catMaybes [("permissions" .=) <$> _tiprPermissions])
newtype PublishResponse = PublishResponse
{ _prMessageIds :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
publishResponse
:: PublishResponse
publishResponse =
PublishResponse
{ _prMessageIds = Nothing
}
prMessageIds :: Lens' PublishResponse [Text]
prMessageIds
= lens _prMessageIds (\ s a -> s{_prMessageIds = a})
. _Default
. _Coerce
instance FromJSON PublishResponse where
parseJSON
= withObject "PublishResponse"
(\ o ->
PublishResponse <$> (o .:? "messageIds" .!= mempty))
instance ToJSON PublishResponse where
toJSON PublishResponse{..}
= object
(catMaybes [("messageIds" .=) <$> _prMessageIds])
newtype PublishRequest = PublishRequest
{ _prMessages :: Maybe [PubsubMessage]
} deriving (Eq,Show,Data,Typeable,Generic)
publishRequest
:: PublishRequest
publishRequest =
PublishRequest
{ _prMessages = Nothing
}
prMessages :: Lens' PublishRequest [PubsubMessage]
prMessages
= lens _prMessages (\ s a -> s{_prMessages = a}) .
_Default
. _Coerce
instance FromJSON PublishRequest where
parseJSON
= withObject "PublishRequest"
(\ o ->
PublishRequest <$> (o .:? "messages" .!= mempty))
instance ToJSON PublishRequest where
toJSON PublishRequest{..}
= object
(catMaybes [("messages" .=) <$> _prMessages])
newtype TestIAMPermissionsResponse = TestIAMPermissionsResponse
{ _tiamprPermissions :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
testIAMPermissionsResponse
:: TestIAMPermissionsResponse
testIAMPermissionsResponse =
TestIAMPermissionsResponse
{ _tiamprPermissions = Nothing
}
tiamprPermissions :: Lens' TestIAMPermissionsResponse [Text]
tiamprPermissions
= lens _tiamprPermissions
(\ s a -> s{_tiamprPermissions = a})
. _Default
. _Coerce
instance FromJSON TestIAMPermissionsResponse where
parseJSON
= withObject "TestIAMPermissionsResponse"
(\ o ->
TestIAMPermissionsResponse <$>
(o .:? "permissions" .!= mempty))
instance ToJSON TestIAMPermissionsResponse where
toJSON TestIAMPermissionsResponse{..}
= object
(catMaybes
[("permissions" .=) <$> _tiamprPermissions])
data Policy = Policy
{ _pEtag :: !(Maybe (Textual Word8))
, _pVersion :: !(Maybe (Textual Int32))
, _pBindings :: !(Maybe [Binding])
} deriving (Eq,Show,Data,Typeable,Generic)
policy
:: Policy
policy =
Policy
{ _pEtag = Nothing
, _pVersion = Nothing
, _pBindings = Nothing
}
pEtag :: Lens' Policy (Maybe Word8)
pEtag
= lens _pEtag (\ s a -> s{_pEtag = a}) .
mapping _Coerce
pVersion :: Lens' Policy (Maybe Int32)
pVersion
= lens _pVersion (\ s a -> s{_pVersion = a}) .
mapping _Coerce
pBindings :: Lens' Policy [Binding]
pBindings
= lens _pBindings (\ s a -> s{_pBindings = a}) .
_Default
. _Coerce
instance FromJSON Policy where
parseJSON
= withObject "Policy"
(\ o ->
Policy <$>
(o .:? "etag") <*> (o .:? "version") <*>
(o .:? "bindings" .!= mempty))
instance ToJSON Policy where
toJSON Policy{..}
= object
(catMaybes
[("etag" .=) <$> _pEtag,
("version" .=) <$> _pVersion,
("bindings" .=) <$> _pBindings])
newtype PushConfigAttributes = PushConfigAttributes
{ _pcaAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
pushConfigAttributes
:: HashMap Text Text
-> PushConfigAttributes
pushConfigAttributes pPcaAddtional_ =
PushConfigAttributes
{ _pcaAddtional = _Coerce # pPcaAddtional_
}
pcaAddtional :: Lens' PushConfigAttributes (HashMap Text Text)
pcaAddtional
= lens _pcaAddtional (\ s a -> s{_pcaAddtional = a})
. _Coerce
instance FromJSON PushConfigAttributes where
parseJSON
= withObject "PushConfigAttributes"
(\ o -> PushConfigAttributes <$> (parseJSONObject o))
instance ToJSON PushConfigAttributes where
toJSON = toJSON . _pcaAddtional
data Subscription = Subscription
{ _sPushConfig :: !(Maybe PushConfig)
, _sTopic :: !(Maybe Text)
, _sName :: !(Maybe Text)
, _sAckDeadlineSeconds :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
subscription
:: Subscription
subscription =
Subscription
{ _sPushConfig = Nothing
, _sTopic = Nothing
, _sName = Nothing
, _sAckDeadlineSeconds = Nothing
}
sPushConfig :: Lens' Subscription (Maybe PushConfig)
sPushConfig
= lens _sPushConfig (\ s a -> s{_sPushConfig = a})
sTopic :: Lens' Subscription (Maybe Text)
sTopic = lens _sTopic (\ s a -> s{_sTopic = a})
sName :: Lens' Subscription (Maybe Text)
sName = lens _sName (\ s a -> s{_sName = a})
sAckDeadlineSeconds :: Lens' Subscription (Maybe Int32)
sAckDeadlineSeconds
= lens _sAckDeadlineSeconds
(\ s a -> s{_sAckDeadlineSeconds = a})
. mapping _Coerce
instance FromJSON Subscription where
parseJSON
= withObject "Subscription"
(\ o ->
Subscription <$>
(o .:? "pushConfig") <*> (o .:? "topic") <*>
(o .:? "name")
<*> (o .:? "ackDeadlineSeconds"))
instance ToJSON Subscription where
toJSON Subscription{..}
= object
(catMaybes
[("pushConfig" .=) <$> _sPushConfig,
("topic" .=) <$> _sTopic, ("name" .=) <$> _sName,
("ackDeadlineSeconds" .=) <$> _sAckDeadlineSeconds])
data ListSubscriptionsResponse = ListSubscriptionsResponse
{ _lsrNextPageToken :: !(Maybe Text)
, _lsrSubscriptions :: !(Maybe [Subscription])
} deriving (Eq,Show,Data,Typeable,Generic)
listSubscriptionsResponse
:: ListSubscriptionsResponse
listSubscriptionsResponse =
ListSubscriptionsResponse
{ _lsrNextPageToken = Nothing
, _lsrSubscriptions = Nothing
}
lsrNextPageToken :: Lens' ListSubscriptionsResponse (Maybe Text)
lsrNextPageToken
= lens _lsrNextPageToken
(\ s a -> s{_lsrNextPageToken = a})
lsrSubscriptions :: Lens' ListSubscriptionsResponse [Subscription]
lsrSubscriptions
= lens _lsrSubscriptions
(\ s a -> s{_lsrSubscriptions = a})
. _Default
. _Coerce
instance FromJSON ListSubscriptionsResponse where
parseJSON
= withObject "ListSubscriptionsResponse"
(\ o ->
ListSubscriptionsResponse <$>
(o .:? "nextPageToken") <*>
(o .:? "subscriptions" .!= mempty))
instance ToJSON ListSubscriptionsResponse where
toJSON ListSubscriptionsResponse{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lsrNextPageToken,
("subscriptions" .=) <$> _lsrSubscriptions])
data Binding = Binding
{ _bMembers :: !(Maybe [Text])
, _bRole :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
binding
:: Binding
binding =
Binding
{ _bMembers = Nothing
, _bRole = Nothing
}
bMembers :: Lens' Binding [Text]
bMembers
= lens _bMembers (\ s a -> s{_bMembers = a}) .
_Default
. _Coerce
bRole :: Lens' Binding (Maybe Text)
bRole = lens _bRole (\ s a -> s{_bRole = a})
instance FromJSON Binding where
parseJSON
= withObject "Binding"
(\ o ->
Binding <$>
(o .:? "members" .!= mempty) <*> (o .:? "role"))
instance ToJSON Binding where
toJSON Binding{..}
= object
(catMaybes
[("members" .=) <$> _bMembers,
("role" .=) <$> _bRole])
newtype AcknowledgeRequest = AcknowledgeRequest
{ _arAckIds :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
acknowledgeRequest
:: AcknowledgeRequest
acknowledgeRequest =
AcknowledgeRequest
{ _arAckIds = Nothing
}
arAckIds :: Lens' AcknowledgeRequest [Text]
arAckIds
= lens _arAckIds (\ s a -> s{_arAckIds = a}) .
_Default
. _Coerce
instance FromJSON AcknowledgeRequest where
parseJSON
= withObject "AcknowledgeRequest"
(\ o ->
AcknowledgeRequest <$> (o .:? "ackIds" .!= mempty))
instance ToJSON AcknowledgeRequest where
toJSON AcknowledgeRequest{..}
= object (catMaybes [("ackIds" .=) <$> _arAckIds])