-
Notifications
You must be signed in to change notification settings - Fork 294
/
pkg.go
110 lines (105 loc) · 2.13 KB
/
pkg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Code generated by cuelang.org/go/pkg/gen. DO NOT EDIT.
// Package http provides tasks related to the HTTP protocol.
//
// These are the supported tasks:
//
// Get: Do & {method: "GET"}
// Post: Do & {method: "POST"}
// Put: Do & {method: "PUT"}
// Delete: Do & {method: "DELETE"}
//
// Do: {
// $id: *"tool/http.Do" | "http" // http for backwards compatibility
//
// method: string
// url: string // TODO: make url.URL type
//
// tls: {
// // Whether the server certificate must be validated.
// verify: *true | bool
// // PEM encoded certificate(s) to validate the server certificate.
// // If not set the CA bundle of the system is used.
// caCert?: bytes | string
// }
//
// request: {
// body?: bytes | string
// header: [string]: string | [...string]
// trailer: [string]: string | [...string]
// }
// response: {
// status: string
// statusCode: int
//
// body: *bytes | string
// header: [string]: string | [...string]
// trailer: [string]: string | [...string]
// }
// }
//
// // TODO: support serving once we have the cue serve command.
// // Serve: {
// // port: int
// //
// // cert: string
// // key: string
// //
// // handle: [Pattern=string]: Message & {
// // pattern: Pattern
// // }
// // }
package http
import (
"cuelang.org/go/internal/core/adt"
"cuelang.org/go/pkg/internal"
)
func init() {
internal.Register("tool/http", pkg)
}
var _ = adt.TopKind // in case the adt package isn't used
var pkg = &internal.Package{
Native: []*internal.Builtin{},
CUE: `{
Get: Do & {
method: "GET"
}
Post: Do & {
method: "POST"
}
Put: Do & {
method: "PUT"
}
Delete: Do & {
method: "DELETE"
}
Do: {
$id: *"tool/http.Do" | "http"
method: string
url: string
tls: {
verify: *true | bool
caCert?: bytes | string
}
request: {
body?: bytes | string
header: {
[string]: string | [...string]
}
trailer: {
[string]: string | [...string]
}
}
response: {
status: string
statusCode: int
body: *bytes | string
header: {
[string]: string | [...string]
}
trailer: {
[string]: string | [...string]
}
}
}
}`,
}