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

story(issue-33): cmd griot implement upload command #39

Merged
merged 21 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d0d6cb9
feat(issue-33): rough out upload command
Zaba505 Oct 16, 2024
21691cd
feat(issue-33): rough out content client
Zaba505 Oct 16, 2024
0346e37
feat(issue-33): fully implement upload command
Zaba505 Oct 16, 2024
b7e1701
feat(issue-33): add some otel support
Zaba505 Oct 16, 2024
e9ac24b
refactor(issue-33): added resource specific command for content manag…
Zaba505 Oct 20, 2024
ff6767d
refactor(issue-33): flatten client request
Zaba505 Oct 20, 2024
435cc08
refactor(issue-33): use humus for cli
Zaba505 Oct 21, 2024
1c4ec2a
refactor(issue-33): updated after migrating to humus for command package
Zaba505 Oct 21, 2024
783cd4d
refactor(issue-33): make upload flag validation errors more specific
Zaba505 Oct 22, 2024
0e7c269
test(issue-33): added cases for flag validation
Zaba505 Oct 22, 2024
ffbb3af
build(issue-33): ran gazelle
Zaba505 Oct 22, 2024
d391d10
test(issue-33): added cases for upload command handler
Zaba505 Oct 22, 2024
f537438
refactor(issue-33): move media type proto to contentpb
Zaba505 Oct 26, 2024
925d58a
feat(issue-33): fully implement upload content client functionality
Zaba505 Oct 26, 2024
3526fed
refactor(issue-33): just go with a single top level internal package
Zaba505 Oct 26, 2024
9af3a6c
test(issue-33): added cases for upload content client
Zaba505 Oct 26, 2024
21ad6e6
feat(issue-33): add flag for setting content host address
Zaba505 Oct 26, 2024
d17f08a
build(issue-33): update module lock after rebasing main
Zaba505 Oct 26, 2024
d5e1292
fix(issue-33): make sure to close content source file
Zaba505 Oct 26, 2024
9260bcf
chore(issue-33): record errors on spans
Zaba505 Nov 1, 2024
37c62a5
build(issue-33): bazel tidy
Zaba505 Nov 1, 2024
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
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_go_viper_mapstructure_v2",
"com_github_spf13_cobra",
"com_github_spf13_pflag",
"com_github_stretchr_testify",
"com_github_z5labs_bedrock",
"com_github_z5labs_humus",
"io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp",
"io_opentelemetry_go_otel",
"io_opentelemetry_go_otel_metric",
"org_golang_google_protobuf",
"org_golang_x_sync",
)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
Expand Down
1,291 changes: 635 additions & 656 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions cmd/griot/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "griot_lib",
srcs = ["main.go"],
embedsrcs = ["config.yaml"],
importpath = "github.com/z5labs/griot/cmd/griot",
visibility = ["//visibility:private"],
deps = [
"//cmd/griot/app",
"//internal/command",
],
)

go_binary(
name = "griot",
embed = [":griot_lib"],
visibility = ["//visibility:public"],
)
12 changes: 12 additions & 0 deletions cmd/griot/app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "app",
srcs = ["app.go"],
importpath = "github.com/z5labs/griot/cmd/griot/app",
visibility = ["//visibility:public"],
deps = [
"//cmd/griot/content",
"//internal/command",
],
)
32 changes: 32 additions & 0 deletions cmd/griot/app/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2024 Z5Labs and Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package app

import (
"context"

"github.com/z5labs/griot/cmd/griot/content"
"github.com/z5labs/griot/internal/command"
)

type Config struct{}

func Init(ctx context.Context, cfg Config) (*command.App, error) {
app := command.NewApp(
"griot",
command.Sub(content.New()),
)
return app, nil
}
16 changes: 16 additions & 0 deletions cmd/griot/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Z5Labs and Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

logging:
level: {{env "LOGGING_LEVEL" | default "WARN"}}
12 changes: 12 additions & 0 deletions cmd/griot/content/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "content",
srcs = ["content.go"],
importpath = "github.com/z5labs/griot/cmd/griot/content",
visibility = ["//visibility:public"],
deps = [
"//cmd/griot/content/upload",
"//internal/command",
],
)
28 changes: 28 additions & 0 deletions cmd/griot/content/content.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 Z5Labs and Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package content

import (
"github.com/z5labs/griot/cmd/griot/content/upload"
"github.com/z5labs/griot/internal/command"
)

func New() *command.App {
return command.NewApp(
"content",
command.Short("Manage content"),
command.Sub(upload.New()),
)
}
30 changes: 30 additions & 0 deletions cmd/griot/content/upload/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "upload",
srcs = ["upload.go"],
importpath = "github.com/z5labs/griot/cmd/griot/content/upload",
visibility = ["//visibility:public"],
deps = [
"//internal/command",
"//services/content",
"//services/content/contentpb",
"@com_github_spf13_pflag//:pflag",
"@com_github_z5labs_humus//:humus",
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:otelhttp",
"@io_opentelemetry_go_otel//:otel",
],
)

go_test(
name = "upload_test",
srcs = ["upload_test.go"],
embed = [":upload"],
deps = [
"//internal/command",
"//services/content",
"//services/content/contentpb",
"@com_github_stretchr_testify//assert",
"@com_github_z5labs_bedrock//pkg/noop",
],
)
Loading
Loading