@@ -0,0 +1,582 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE NoImplicitPrelude #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE RecordWildCards #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
8+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
9+
10+-- |
11+-- Module : Network.Google.FirebaseRules.Types.Product
12+-- Copyright : (c) 2015-2016 Brendan Hay
13+-- License : Mozilla Public License, v. 2.0.
14+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
15+-- Stability : auto-generated
16+-- Portability : non-portable (GHC extensions)
17+--
18+module Network.Google.FirebaseRules.Types.Product where
19+
20+import Network.Google.FirebaseRules.Types.Sum
21+import Network.Google.Prelude
22+
23+-- | Position in the \`Source\` content including its line, column number,
24+-- and an index of the \`File\` in the \`Source\` message. Used for debug
25+-- purposes.
26+--
27+-- /See:/ 'sourcePosition' smart constructor.
28+data SourcePosition = SourcePosition'
29+ { _spLine :: !(Maybe (Textual Int32))
30+ , _spColumn :: !(Maybe (Textual Int32))
31+ , _spFileName :: !(Maybe Text)
32+ } deriving (Eq,Show,Data,Typeable,Generic)
33+
34+-- | Creates a value of 'SourcePosition' with the minimum fields required to make a request.
35+--
36+-- Use one of the following lenses to modify other fields as desired:
37+--
38+-- * 'spLine'
39+--
40+-- * 'spColumn'
41+--
42+-- * 'spFileName'
43+sourcePosition
44+ :: SourcePosition
45+sourcePosition =
46+ SourcePosition'
47+ { _spLine = Nothing
48+ , _spColumn = Nothing
49+ , _spFileName = Nothing
50+ }
51+
52+-- | Line number of the source fragment. 1-based.
53+spLine :: Lens' SourcePosition (Maybe Int32)
54+spLine
55+ = lens _spLine (\ s a -> s{_spLine = a}) .
56+ mapping _Coerce
57+
58+-- | First column on the source line associated with the source fragment.
59+spColumn :: Lens' SourcePosition (Maybe Int32)
60+spColumn
61+ = lens _spColumn (\ s a -> s{_spColumn = a}) .
62+ mapping _Coerce
63+
64+-- | Name of the \`File\`.
65+spFileName :: Lens' SourcePosition (Maybe Text)
66+spFileName
67+ = lens _spFileName (\ s a -> s{_spFileName = a})
68+
69+instance FromJSON SourcePosition where
70+ parseJSON
71+ = withObject "SourcePosition"
72+ (\ o ->
73+ SourcePosition' <$>
74+ (o .:? "line") <*> (o .:? "column") <*>
75+ (o .:? "fileName"))
76+
77+instance ToJSON SourcePosition where
78+ toJSON SourcePosition'{..}
79+ = object
80+ (catMaybes
81+ [("line" .=) <$> _spLine,
82+ ("column" .=) <$> _spColumn,
83+ ("fileName" .=) <$> _spFileName])
84+
85+-- | A generic empty message that you can re-use to avoid defining duplicated
86+-- empty messages in your APIs. A typical example is to use it as the
87+-- request or the response type of an API method. For instance: service Foo
88+-- { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The
89+-- JSON representation for \`Empty\` is empty JSON object \`{}\`.
90+--
91+-- /See:/ 'empty' smart constructor.
92+data Empty =
93+ Empty'
94+ deriving (Eq,Show,Data,Typeable,Generic)
95+
96+-- | Creates a value of 'Empty' with the minimum fields required to make a request.
97+--
98+empty
99+ :: Empty
100+empty = Empty'
101+
102+instance FromJSON Empty where
103+ parseJSON = withObject "Empty" (\ o -> pure Empty')
104+
105+instance ToJSON Empty where
106+ toJSON = const emptyObject
107+
108+-- | The response for FirebaseRulesService.ListReleases.
109+--
110+-- /See:/ 'listReleasesResponse' smart constructor.
111+data ListReleasesResponse = ListReleasesResponse'
112+ { _lrrNextPageToken :: !(Maybe Text)
113+ , _lrrReleases :: !(Maybe [Release])
114+ } deriving (Eq,Show,Data,Typeable,Generic)
115+
116+-- | Creates a value of 'ListReleasesResponse' with the minimum fields required to make a request.
117+--
118+-- Use one of the following lenses to modify other fields as desired:
119+--
120+-- * 'lrrNextPageToken'
121+--
122+-- * 'lrrReleases'
123+listReleasesResponse
124+ :: ListReleasesResponse
125+listReleasesResponse =
126+ ListReleasesResponse'
127+ { _lrrNextPageToken = Nothing
128+ , _lrrReleases = Nothing
129+ }
130+
131+-- | The pagination token to retrieve the next page of results. If the value
132+-- is empty, no further results remain.
133+lrrNextPageToken :: Lens' ListReleasesResponse (Maybe Text)
134+lrrNextPageToken
135+ = lens _lrrNextPageToken
136+ (\ s a -> s{_lrrNextPageToken = a})
137+
138+-- | List of \`Release\` instances.
139+lrrReleases :: Lens' ListReleasesResponse [Release]
140+lrrReleases
141+ = lens _lrrReleases (\ s a -> s{_lrrReleases = a}) .
142+ _Default
143+ . _Coerce
144+
145+instance FromJSON ListReleasesResponse where
146+ parseJSON
147+ = withObject "ListReleasesResponse"
148+ (\ o ->
149+ ListReleasesResponse' <$>
150+ (o .:? "nextPageToken") <*>
151+ (o .:? "releases" .!= mempty))
152+
153+instance ToJSON ListReleasesResponse where
154+ toJSON ListReleasesResponse'{..}
155+ = object
156+ (catMaybes
157+ [("nextPageToken" .=) <$> _lrrNextPageToken,
158+ ("releases" .=) <$> _lrrReleases])
159+
160+-- | The response for FirebaseRulesService.TestRuleset.
161+--
162+-- /See:/ 'testRulesetResponse' smart constructor.
163+newtype TestRulesetResponse = TestRulesetResponse'
164+ { _trrIssues :: Maybe [Issue]
165+ } deriving (Eq,Show,Data,Typeable,Generic)
166+
167+-- | Creates a value of 'TestRulesetResponse' with the minimum fields required to make a request.
168+--
169+-- Use one of the following lenses to modify other fields as desired:
170+--
171+-- * 'trrIssues'
172+testRulesetResponse
173+ :: TestRulesetResponse
174+testRulesetResponse =
175+ TestRulesetResponse'
176+ { _trrIssues = Nothing
177+ }
178+
179+-- | Syntactic and semantic \`Source\` issues of varying severity. Issues of
180+-- \`ERROR\` severity will prevent tests from executing.
181+trrIssues :: Lens' TestRulesetResponse [Issue]
182+trrIssues
183+ = lens _trrIssues (\ s a -> s{_trrIssues = a}) .
184+ _Default
185+ . _Coerce
186+
187+instance FromJSON TestRulesetResponse where
188+ parseJSON
189+ = withObject "TestRulesetResponse"
190+ (\ o ->
191+ TestRulesetResponse' <$> (o .:? "issues" .!= mempty))
192+
193+instance ToJSON TestRulesetResponse where
194+ toJSON TestRulesetResponse'{..}
195+ = object (catMaybes [("issues" .=) <$> _trrIssues])
196+
197+-- | \`Release\` is a named reference to a \`Ruleset\`. Once a \`Release\`
198+-- refers to a \`Ruleset\`, rules-enabled services will be able to enforce
199+-- the \`Ruleset\`.
200+--
201+-- /See:/ 'release' smart constructor.
202+data Release = Release'
203+ { _rRulesetName :: !(Maybe Text)
204+ , _rUpdateTime :: !(Maybe DateTime')
205+ , _rName :: !(Maybe Text)
206+ , _rCreateTime :: !(Maybe DateTime')
207+ } deriving (Eq,Show,Data,Typeable,Generic)
208+
209+-- | Creates a value of 'Release' with the minimum fields required to make a request.
210+--
211+-- Use one of the following lenses to modify other fields as desired:
212+--
213+-- * 'rRulesetName'
214+--
215+-- * 'rUpdateTime'
216+--
217+-- * 'rName'
218+--
219+-- * 'rCreateTime'
220+release
221+ :: Release
222+release =
223+ Release'
224+ { _rRulesetName = Nothing
225+ , _rUpdateTime = Nothing
226+ , _rName = Nothing
227+ , _rCreateTime = Nothing
228+ }
229+
230+-- | Name of the \`Ruleset\` referred to by this \`Release\`. The \`Ruleset\`
231+-- must exist the \`Release\` to be created.
232+rRulesetName :: Lens' Release (Maybe Text)
233+rRulesetName
234+ = lens _rRulesetName (\ s a -> s{_rRulesetName = a})
235+
236+-- | Time the release was updated. \'OutputOnly
237+rUpdateTime :: Lens' Release (Maybe UTCTime)
238+rUpdateTime
239+ = lens _rUpdateTime (\ s a -> s{_rUpdateTime = a}) .
240+ mapping _DateTime
241+
242+-- | Resource name for the \`Release\`. \`Release\` names may be structured
243+-- \`app1\/prod\/v2\` or flat \`app1_prod_v2\` which affords developers a
244+-- great deal of flexibility in mapping the name to the style that best
245+-- fits their existing development practices. For example, a name could
246+-- refer to an environment, an app, a version, or some combination of
247+-- three. In the table below, for the project name \`projects\/foo\`, the
248+-- following relative release paths show how flat and structured names
249+-- might be chosen to match a desired development \/ deployment strategy.
250+-- Use Case | Flat Name | Structured Name
251+-- -------------|---------------------|---------------- Environments |
252+-- releases\/qa | releases\/qa Apps | releases\/app1_qa |
253+-- releases\/app1\/qa Versions | releases\/app1_v2_qa |
254+-- releases\/app1\/v2\/qa The delimiter between the release name path
255+-- elements can be almost anything and it should work equally well with the
256+-- release name list filter, but in many ways the structured paths provide
257+-- a clearer picture of the relationship between \`Release\` instances.
258+-- Format: \`projects\/{project_id}\/releases\/{release_id}\`
259+rName :: Lens' Release (Maybe Text)
260+rName = lens _rName (\ s a -> s{_rName = a})
261+
262+-- | Time the release was created. \'OutputOnly
263+rCreateTime :: Lens' Release (Maybe UTCTime)
264+rCreateTime
265+ = lens _rCreateTime (\ s a -> s{_rCreateTime = a}) .
266+ mapping _DateTime
267+
268+instance FromJSON Release where
269+ parseJSON
270+ = withObject "Release"
271+ (\ o ->
272+ Release' <$>
273+ (o .:? "rulesetName") <*> (o .:? "updateTime") <*>
274+ (o .:? "name")
275+ <*> (o .:? "createTime"))
276+
277+instance ToJSON Release where
278+ toJSON Release'{..}
279+ = object
280+ (catMaybes
281+ [("rulesetName" .=) <$> _rRulesetName,
282+ ("updateTime" .=) <$> _rUpdateTime,
283+ ("name" .=) <$> _rName,
284+ ("createTime" .=) <$> _rCreateTime])
285+
286+-- | \`Ruleset\` is an immutable copy of \`Source\` with a globally unique
287+-- identifier and a creation time.
288+--
289+-- /See:/ 'ruleset' smart constructor.
290+data Ruleset = Ruleset'
291+ { _rulName :: !(Maybe Text)
292+ , _rulSource :: !(Maybe Source)
293+ , _rulCreateTime :: !(Maybe DateTime')
294+ } deriving (Eq,Show,Data,Typeable,Generic)
295+
296+-- | Creates a value of 'Ruleset' with the minimum fields required to make a request.
297+--
298+-- Use one of the following lenses to modify other fields as desired:
299+--
300+-- * 'rulName'
301+--
302+-- * 'rulSource'
303+--
304+-- * 'rulCreateTime'
305+ruleset
306+ :: Ruleset
307+ruleset =
308+ Ruleset'
309+ { _rulName = Nothing
310+ , _rulSource = Nothing
311+ , _rulCreateTime = Nothing
312+ }
313+
314+-- | Name of the \`Ruleset\`. The ruleset_id is auto generated by the
315+-- service. Format: \`projects\/{project_id}\/rulesets\/{ruleset_id}\`
316+-- \'OutputOnly
317+rulName :: Lens' Ruleset (Maybe Text)
318+rulName = lens _rulName (\ s a -> s{_rulName = a})
319+
320+-- | \`Source\` for the \`Ruleset\`.
321+rulSource :: Lens' Ruleset (Maybe Source)
322+rulSource
323+ = lens _rulSource (\ s a -> s{_rulSource = a})
324+
325+-- | Time the \`Ruleset\` was created. \'OutputOnly
326+rulCreateTime :: Lens' Ruleset (Maybe UTCTime)
327+rulCreateTime
328+ = lens _rulCreateTime
329+ (\ s a -> s{_rulCreateTime = a})
330+ . mapping _DateTime
331+
332+instance FromJSON Ruleset where
333+ parseJSON
334+ = withObject "Ruleset"
335+ (\ o ->
336+ Ruleset' <$>
337+ (o .:? "name") <*> (o .:? "source") <*>
338+ (o .:? "createTime"))
339+
340+instance ToJSON Ruleset where
341+ toJSON Ruleset'{..}
342+ = object
343+ (catMaybes
344+ [("name" .=) <$> _rulName,
345+ ("source" .=) <$> _rulSource,
346+ ("createTime" .=) <$> _rulCreateTime])
347+
348+-- | \`Source\` is one or more \`File\` messages comprising a logical set of
349+-- rules.
350+--
351+-- /See:/ 'source' smart constructor.
352+newtype Source = Source'
353+ { _sFiles :: Maybe [File]
354+ } deriving (Eq,Show,Data,Typeable,Generic)
355+
356+-- | Creates a value of 'Source' with the minimum fields required to make a request.
357+--
358+-- Use one of the following lenses to modify other fields as desired:
359+--
360+-- * 'sFiles'
361+source
362+ :: Source
363+source =
364+ Source'
365+ { _sFiles = Nothing
366+ }
367+
368+-- | \`File\` set constituting the \`Source\` bundle.
369+sFiles :: Lens' Source [File]
370+sFiles
371+ = lens _sFiles (\ s a -> s{_sFiles = a}) . _Default .
372+ _Coerce
373+
374+instance FromJSON Source where
375+ parseJSON
376+ = withObject "Source"
377+ (\ o -> Source' <$> (o .:? "files" .!= mempty))
378+
379+instance ToJSON Source where
380+ toJSON Source'{..}
381+ = object (catMaybes [("files" .=) <$> _sFiles])
382+
383+-- | The request for FirebaseRulesService.TestRuleset.
384+--
385+-- /See:/ 'testRulesetRequest' smart constructor.
386+newtype TestRulesetRequest = TestRulesetRequest'
387+ { _trrSource :: Maybe Source
388+ } deriving (Eq,Show,Data,Typeable,Generic)
389+
390+-- | Creates a value of 'TestRulesetRequest' with the minimum fields required to make a request.
391+--
392+-- Use one of the following lenses to modify other fields as desired:
393+--
394+-- * 'trrSource'
395+testRulesetRequest
396+ :: TestRulesetRequest
397+testRulesetRequest =
398+ TestRulesetRequest'
399+ { _trrSource = Nothing
400+ }
401+
402+-- | \`Source\` to be checked for correctness.
403+trrSource :: Lens' TestRulesetRequest (Maybe Source)
404+trrSource
405+ = lens _trrSource (\ s a -> s{_trrSource = a})
406+
407+instance FromJSON TestRulesetRequest where
408+ parseJSON
409+ = withObject "TestRulesetRequest"
410+ (\ o -> TestRulesetRequest' <$> (o .:? "source"))
411+
412+instance ToJSON TestRulesetRequest where
413+ toJSON TestRulesetRequest'{..}
414+ = object (catMaybes [("source" .=) <$> _trrSource])
415+
416+-- | \`File\` containing source content.
417+--
418+-- /See:/ 'file' smart constructor.
419+data File = File'
420+ { _fFingerprint :: !(Maybe Base64)
421+ , _fContent :: !(Maybe Text)
422+ , _fName :: !(Maybe Text)
423+ } deriving (Eq,Show,Data,Typeable,Generic)
424+
425+-- | Creates a value of 'File' with the minimum fields required to make a request.
426+--
427+-- Use one of the following lenses to modify other fields as desired:
428+--
429+-- * 'fFingerprint'
430+--
431+-- * 'fContent'
432+--
433+-- * 'fName'
434+file
435+ :: File
436+file =
437+ File'
438+ { _fFingerprint = Nothing
439+ , _fContent = Nothing
440+ , _fName = Nothing
441+ }
442+
443+-- | Fingerprint (e.g. github sha) associated with the \`File\`.
444+fFingerprint :: Lens' File (Maybe ByteString)
445+fFingerprint
446+ = lens _fFingerprint (\ s a -> s{_fFingerprint = a})
447+ . mapping _Base64
448+
449+-- | Textual Content.
450+fContent :: Lens' File (Maybe Text)
451+fContent = lens _fContent (\ s a -> s{_fContent = a})
452+
453+-- | File name.
454+fName :: Lens' File (Maybe Text)
455+fName = lens _fName (\ s a -> s{_fName = a})
456+
457+instance FromJSON File where
458+ parseJSON
459+ = withObject "File"
460+ (\ o ->
461+ File' <$>
462+ (o .:? "fingerprint") <*> (o .:? "content") <*>
463+ (o .:? "name"))
464+
465+instance ToJSON File where
466+ toJSON File'{..}
467+ = object
468+ (catMaybes
469+ [("fingerprint" .=) <$> _fFingerprint,
470+ ("content" .=) <$> _fContent,
471+ ("name" .=) <$> _fName])
472+
473+-- | The response for FirebaseRulesService.ListRulesets
474+--
475+-- /See:/ 'listRulesetsResponse' smart constructor.
476+data ListRulesetsResponse = ListRulesetsResponse'
477+ { _lRulesets :: !(Maybe [Ruleset])
478+ , _lNextPageToken :: !(Maybe Text)
479+ } deriving (Eq,Show,Data,Typeable,Generic)
480+
481+-- | Creates a value of 'ListRulesetsResponse' with the minimum fields required to make a request.
482+--
483+-- Use one of the following lenses to modify other fields as desired:
484+--
485+-- * 'lRulesets'
486+--
487+-- * 'lNextPageToken'
488+listRulesetsResponse
489+ :: ListRulesetsResponse
490+listRulesetsResponse =
491+ ListRulesetsResponse'
492+ { _lRulesets = Nothing
493+ , _lNextPageToken = Nothing
494+ }
495+
496+-- | List of \`Ruleset\` instances.
497+lRulesets :: Lens' ListRulesetsResponse [Ruleset]
498+lRulesets
499+ = lens _lRulesets (\ s a -> s{_lRulesets = a}) .
500+ _Default
501+ . _Coerce
502+
503+-- | The pagination token to retrieve the next page of results. If the value
504+-- is empty, no further results remain.
505+lNextPageToken :: Lens' ListRulesetsResponse (Maybe Text)
506+lNextPageToken
507+ = lens _lNextPageToken
508+ (\ s a -> s{_lNextPageToken = a})
509+
510+instance FromJSON ListRulesetsResponse where
511+ parseJSON
512+ = withObject "ListRulesetsResponse"
513+ (\ o ->
514+ ListRulesetsResponse' <$>
515+ (o .:? "rulesets" .!= mempty) <*>
516+ (o .:? "nextPageToken"))
517+
518+instance ToJSON ListRulesetsResponse where
519+ toJSON ListRulesetsResponse'{..}
520+ = object
521+ (catMaybes
522+ [("rulesets" .=) <$> _lRulesets,
523+ ("nextPageToken" .=) <$> _lNextPageToken])
524+
525+-- | Issues include warnings, errors, and deprecation notices.
526+--
527+-- /See:/ 'issue' smart constructor.
528+data Issue = Issue'
529+ { _iSourcePosition :: !(Maybe SourcePosition)
530+ , _iSeverity :: !(Maybe IssueSeverity)
531+ , _iDescription :: !(Maybe Text)
532+ } deriving (Eq,Show,Data,Typeable,Generic)
533+
534+-- | Creates a value of 'Issue' with the minimum fields required to make a request.
535+--
536+-- Use one of the following lenses to modify other fields as desired:
537+--
538+-- * 'iSourcePosition'
539+--
540+-- * 'iSeverity'
541+--
542+-- * 'iDescription'
543+issue
544+ :: Issue
545+issue =
546+ Issue'
547+ { _iSourcePosition = Nothing
548+ , _iSeverity = Nothing
549+ , _iDescription = Nothing
550+ }
551+
552+-- | Position of the issue in the \`Source\`.
553+iSourcePosition :: Lens' Issue (Maybe SourcePosition)
554+iSourcePosition
555+ = lens _iSourcePosition
556+ (\ s a -> s{_iSourcePosition = a})
557+
558+-- | The severity of the issue.
559+iSeverity :: Lens' Issue (Maybe IssueSeverity)
560+iSeverity
561+ = lens _iSeverity (\ s a -> s{_iSeverity = a})
562+
563+-- | Short error description.
564+iDescription :: Lens' Issue (Maybe Text)
565+iDescription
566+ = lens _iDescription (\ s a -> s{_iDescription = a})
567+
568+instance FromJSON Issue where
569+ parseJSON
570+ = withObject "Issue"
571+ (\ o ->
572+ Issue' <$>
573+ (o .:? "sourcePosition") <*> (o .:? "severity") <*>
574+ (o .:? "description"))
575+
576+instance ToJSON Issue where
577+ toJSON Issue'{..}
578+ = object
579+ (catMaybes
580+ [("sourcePosition" .=) <$> _iSourcePosition,
581+ ("severity" .=) <$> _iSeverity,
582+ ("description" .=) <$> _iDescription])