| 17 | type httpSchema struct{} |
| 18 | |
| 19 | func (s *httpSchema) Install(srv *dagql.Server) { |
| 20 | dagql.Fields[*core.Query]{ |
| 21 | dagql.NodeFunc("http", s.http). |
| 22 | WithInput(dagql.PerSessionInput). |
| 23 | Doc(`Returns a file containing an http remote url content.`). |
| 24 | Args( |
| 25 | dagql.Arg("url").Doc(`HTTP url to get the content from (e.g., "https://docs.dagger.io").`), |
| 26 | dagql.Arg("name").Doc(`File name to use for the file. Defaults to the last part of the URL.`), |
| 27 | dagql.Arg("permissions").Doc(`Permissions to set on the file.`), |
| 28 | dagql.Arg("checksum").Doc(`Expected digest of the downloaded content (e.g., "sha256:...").`), |
| 29 | dagql.Arg("authHeader").Doc(`Secret used to populate the Authorization HTTP header`), |
| 30 | dagql.Arg("experimentalServiceHost").Doc(`A service which must be started before the URL is fetched.`), |
| 31 | ), |
| 32 | dagql.NodeFunc("_httpState", s.httpState). |
| 33 | IsPersistable(). |
| 34 | Doc(`(Internal-only) Returns a persistent HTTP state object.`). |
| 35 | Args( |
| 36 | dagql.Arg("url").Doc(`HTTP url to get the content from.`), |
| 37 | ), |
| 38 | }.Install(srv) |
| 39 | |
| 40 | dagql.Fields[*core.HTTPState]{ |
| 41 | dagql.NodeFunc("_resolve", s.httpStateResolve). |
| 42 | IsPersistable(). |
| 43 | WithInput(dagql.PerSessionInput). |
| 44 | Doc(`(Internal-only) Resolve the HTTP state once per session and return the resulting file.`). |
| 45 | Args( |
| 46 | dagql.Arg("checksum").Doc(`Expected digest of the downloaded content.`), |
| 47 | dagql.Arg("permissions").Doc(`Permissions to set on the file.`), |
| 48 | dagql.Arg("name").Doc(`Resolved file name to use for the file.`), |
| 49 | ), |
| 50 | }.Install(srv) |
| 51 | } |
| 52 | |
| 53 | type httpArgs struct { |
| 54 | URL string |