Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dl): add oci.download-file-sha256 API #162

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions dl/design/design.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,45 @@ var _ = Service("oci", func() {
})
})
})

Method("download-file-sha256", func() {
Payload(func() {
Field(1, "repository", String, "OCI artifact repository")
Field(2, "tag", String, "OCI artifact tag")
Field(3, "file", String, "file name in OCI artifact")
Required("repository", "tag", "file")
})

Result(func() {
Attribute("length", Int64, "Length is the downloaded content length in bytes.", func() {
Example(4 * 1024 * 1024)
})
Attribute("contentDisposition", String, "Content-Disposition header for downloading", func() {
Example("attachment; filename*=UTF-8''tidb-v7.5.0-darwin-arm64.tar.gz.sha256")
})
Required("length", "contentDisposition")
})

Error("invalid_file_path", ErrorResult, "Could not locate file for download")
Error("internal_error", ErrorResult, "Fault while processing download.")

HTTP(func() {
GET("/oci-file-sha256/{*repository}")
Param("file:file", String, "file name in OCI artifact")
Param("tag:tag", String, "OCI artifact tag")

// Bypass response body encoder code generation to alleviate need for
// loading the entire response body in memory.
SkipResponseBodyEncodeDecode()

Response(func() {
// Set the content type for binary data
ContentType("application/plain-text")
Header("length:Content-Length")
Header("contentDisposition:Content-Disposition")
})
})
})
})

var _ = Service("ks3", func() {
Expand Down
2 changes: 1 addition & 1 deletion dl/gen/health/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/health/endpoints.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion dl/gen/health/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 32 additions & 6 deletions dl/gen/http/cli/server/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/client/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/client/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/client/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/server/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/server/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/health/server/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/client/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/client/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/client/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/server/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/server/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dl/gen/http/ks3/server/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion dl/gen/http/oci/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading