Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d036b6

Browse files
committed
feat(all-apis): build all apis, were possible
Now there is a blacklist feature, allowing to list apis we can't yet handle for whichever reason.
1 parent 2531011 commit 2d036b6

7 files changed

Lines changed: 375 additions & 158 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.timestamp
22
.pyenv
3+
gen/
34
*.go
45
*.pyc
56
**target/

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ help:
2323
$(info using template engine: '$(TPL)')
2424
$(info )
2525
$(info Targets)
26+
$(info apis - make all APIs)
2627
$(info cargo - run cargo on all APIs, use ARGS="args ..." to specify cargo arguments)
2728
$(info regen-apis - clear out all generated apis, and regenerate them)
2829
$(info clean-apis - delete all generated APIs)

etc/api/shared.yaml

Lines changed: 166 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,173 @@ directories:
99
# all mako source files
1010
mako_src: src/mako
1111
api:
12+
blacklist:
13+
- groupsmigration
14+
- licensing
15+
- groupssettings
16+
- translate
17+
- pagespeedonline # no oauth2
18+
- gan # no oauth2
19+
- sqladmin # ERROR
20+
- dataflow # ERROR
21+
- civicinfo # no oauth2
22+
- webmasters # no oauth2
23+
- doubleclickbidmanager # no oauth2
24+
- freebase # ERROR
25+
- spectrum # no oauth2
26+
- analytics # ERROR
27+
- qpxexpress # no oauth2
28+
- discovery # no oauth2
29+
- identitytoolkit # no oauth2
30+
- audit # no oauth2
31+
- admin # ERROR
32+
- webfonts # no oauth2
33+
- customsearch # no oauth2
1234
list:
13-
- name: youtube
14-
version: v3
15-
- name: drive
16-
version: v2
17-
- name: gmail
18-
version: v1
35+
# use etc/bin/api_version_to_yaml.py to update with latest available versions
36+
# It's a semi-automated process ... for now
37+
adexchangebuyer:
38+
- v1.2
39+
adexchangeseller:
40+
- v1
41+
admin:
42+
- directory_v1
43+
adsense:
44+
- v1.2
45+
adsensehost:
46+
- v4.1
47+
analytics:
48+
- v2.4
49+
androidpublisher:
50+
- v1
51+
appsactivity:
52+
- v1
53+
appstate:
54+
- v1
55+
audit:
56+
- v1
57+
autoscaler:
58+
- v1beta2
59+
bigquery:
60+
- v2
61+
blogger:
62+
- v2
63+
books:
64+
- v1
65+
calendar:
66+
- v3
67+
civicinfo:
68+
- us_v1
69+
cloudlatencytest:
70+
- v2
71+
cloudmonitoring:
72+
- v2beta2
73+
compute:
74+
- v1
75+
container:
76+
- v1beta1
77+
content:
78+
- v2
79+
coordinate:
80+
- v1
81+
customsearch:
82+
- v1
83+
dataflow:
84+
- v1b4
85+
datastore:
86+
- v1beta1
87+
deploymentmanager:
88+
- v2beta1
89+
dfareporting:
90+
- v1
91+
discovery:
92+
- v1
93+
dns:
94+
- v1beta1
95+
doubleclickbidmanager:
96+
- v1
97+
doubleclicksearch:
98+
- v2
99+
drive:
100+
- v1
101+
fitness:
102+
- v1
103+
freebase:
104+
- v1
105+
games:
106+
- v1
107+
gamesconfiguration:
108+
- v1configuration
109+
gamesmanagement:
110+
- v1management
111+
gan:
112+
- v1beta1
113+
genomics:
114+
- v1beta
115+
gmail:
116+
- v1
117+
groupsmigration:
118+
- v1
119+
groupssettings:
120+
- v1
121+
identitytoolkit:
122+
- v3
123+
licensing:
124+
- v1
125+
manager:
126+
- v1beta2
127+
mapsengine:
128+
- exp2
129+
mirror:
130+
- v1
131+
oauth2:
132+
- v1
133+
pagespeedonline:
134+
- v1
135+
plus:
136+
- v1
137+
plusdomains:
138+
- v1
139+
prediction:
140+
- v1.2
141+
pubsub:
142+
- v1beta1
143+
qpxexpress:
144+
- v1
145+
replicapool:
146+
- v1beta1
147+
replicapoolupdater:
148+
- v1beta1
149+
reseller:
150+
- v1
151+
resourceviews:
152+
- v1beta1
153+
siteverification:
154+
- v1
155+
spectrum:
156+
- v1explorer
157+
sqladmin:
158+
- v1beta1
159+
storage:
160+
- v1
161+
tagmanager:
162+
- v1
163+
taskqueue:
164+
- v1beta1
165+
tasks:
166+
- v1
167+
translate:
168+
- v2
169+
urlshortener:
170+
- v1
171+
webfonts:
172+
- v1
173+
webmasters:
174+
- v3
175+
youtube:
176+
- v3
177+
youtubeanalytics:
178+
- v1
19179
base_path: "etc/api"
20180
terms:
21181
# how to actually do something with the API

etc/bin/api_version_to_yaml.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
3+
# Generate yaml output suitable for use in shared.yaml
4+
#
5+
6+
import sys
7+
import os
8+
import yaml
9+
10+
isfile = os.path.isfile
11+
isdir = os.path.isdir
12+
join = os.path.join
13+
14+
if __name__ != '__main__':
15+
raise AssertionError("Not for import")
16+
17+
if len(sys.argv) != 2:
18+
sys.stderr.write("USAGE: <program> <api_path>, i.e. <program> etc/api\n")
19+
sys.exit(1)
20+
21+
api_base = sys.argv[1]
22+
if not isdir(api_base):
23+
raise ValueError("Directory '%s' not accessible" % api_base)
24+
25+
yaml_path = join(api_base, 'shared.yaml')
26+
if not isfile(yaml_path):
27+
raise AssertionError("Didn't find yaml data at '%s'" % yaml_path)
28+
29+
api_data = list(yaml.load_all(open(yaml_path, 'r')))[0]['api']['list']
30+
for api_name in sorted(os.listdir(api_base)):
31+
api_path = join(api_base, api_name)
32+
if not isdir(api_path):
33+
continue
34+
last_version = list(sorted(v for v in os.listdir(api_path) if isdir(join(api_path, v))))
35+
if not last_version:
36+
continue
37+
38+
versions = api_data.get('api_name', list())
39+
if last_version not in versions:
40+
versions.append(last_version[0])
41+
api_data[api_name] = list(sorted(versions))
42+
# end for each item in api-base
43+
44+
yaml.dump(dict(api=dict(list=api_data)), sys.stdout, default_flow_style=False)
45+
46+

0 commit comments

Comments
 (0)