Skip to content

Commit a2366b6

Browse files
committed
Download tools from a signed url instead of parsing the package-index
1 parent 9ab8e95 commit a2366b6

File tree

12 files changed

+356
-336
lines changed

12 files changed

+356
-336
lines changed

app/contexts.go

Lines changed: 1 addition & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controllers.go

Lines changed: 23 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/test/tools_v1_testing.go

Lines changed: 33 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/user_types.go

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

design/tools.go

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,8 @@ var _ = Resource("tools_v1", func() {
4343
})
4444
Action("download", func() {
4545
Description("Downloads a tool in the system")
46-
Routing(POST("/:packager/:name/:version"))
47-
Params(func() {
48-
Param("packager", String, "The packager of the tool", func() {
49-
Example("arduino")
50-
})
51-
Param("name", String, "The name of the tool", func() {
52-
Example("avrdude")
53-
})
54-
Param("version", String, "The version of the tool", func() {
55-
Example("latest")
56-
})
57-
})
46+
Routing(POST("/"))
47+
Payload(ToolDownloadV1)
5848
Response(OK, ToolV1)
5949
})
6050
})
@@ -84,3 +74,26 @@ var ToolV1 = MediaType("application/vnd.arduino.agent.tools.tool+json", func() {
8474
Attribute("version")
8575
})
8676
})
77+
78+
var ToolDownloadV1 = Type("tool.download", func() {
79+
Attribute("name", String, "Name of the tool", func() {
80+
Example("avrdude")
81+
})
82+
Attribute("packager", String, "Packager of the tool", func() {
83+
Example("arduino")
84+
})
85+
Attribute("version", String, "Version of the tool", func() {
86+
Example("6.0.1-arduino2")
87+
})
88+
Attribute("url", String, "Url of the tool to download", func() {
89+
Example("http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-x86_64-pc-linux-gnu.tar.bz2")
90+
})
91+
Attribute("checksum", String, "The checksum of the tool to download", func() {
92+
Example("SHA-256:71117cce0096dad6c091e2c34eb0b9a3386d3aec7d863d2da733d9e5eac3a6b1")
93+
})
94+
Attribute("signature", String, "The signature of the url of the tool", func() {
95+
Example("2d701b4efbc8cec62dc299cde01730c5eebcf23d7e4393db8cf7744a9bf1d3de")
96+
})
97+
98+
Required("packager", "name", "version", "url", "checksum", "signature")
99+
})

0 commit comments

Comments
 (0)