Skip to content

Commit

Permalink
new create aggregator payload
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasparada committed Dec 6, 2021
1 parent 204613c commit 22be64a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions cmd/calyptia/create_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
func newCmdCreateAggregator(config *config) *cobra.Command {
var projectKey string
var name string
var addHealthCheckPipeline bool
var healthCheckPipelinePort uint
var format string
cmd := &cobra.Command{
Use: "aggregator",
Expand All @@ -41,8 +43,10 @@ func newCmdCreateAggregator(config *config) *cobra.Command {
}
}

a, err := config.cloud.CreateAggregator(config.ctx, cloud.CreateAggregatorPayload{
Name: name,
a, err := config.cloud.CreateAggregator(config.ctx, cloud.AddAggregatorPayload{
Name: name,
AddHealthCheckPipeline: addHealthCheckPipeline,
HealthCheckPipelinePort: healthCheckPipelinePort,
}, cloud.CreateAggregatorWithProjectID(projectID))
if err != nil {
return fmt.Errorf("could not create aggregator: %w", err)
Expand Down Expand Up @@ -73,6 +77,8 @@ func newCmdCreateAggregator(config *config) *cobra.Command {
fs := cmd.Flags()
fs.StringVar(&projectKey, "project", config.defaultProject, "Parent project ID or name")
fs.StringVar(&name, "name", "", "Aggregator name; leave it empty to generate a random name")
fs.BoolVar(&addHealthCheckPipeline, "healthcheck", true, "Add a health check pipeline by default with the aggregator")
fs.UintVar(&healthCheckPipelinePort, "healthcheck-port", 2020, "Health check pipeline port if a health check pipeline is added")
fs.StringVarP(&format, "output-format", "f", "table", "Output format. Allowed: table, json")

_ = cmd.RegisterFlagCompletionFunc("project", config.completeProjects)
Expand Down
6 changes: 3 additions & 3 deletions cmd/calyptia/create_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newCmdCreatePipeline(config *config) *cobra.Command {
for k, v := range m {
secrets = append(secrets, cloud.AddPipelineSecretPayload{
Key: k,
Value: v,
Value: []byte(v),
})
}
case "json":
Expand All @@ -79,7 +79,7 @@ func newCmdCreatePipeline(config *config) *cobra.Command {
for k, v := range m {
secrets = append(secrets, cloud.AddPipelineSecretPayload{
Key: k,
Value: fmt.Sprintf("%v", v),
Value: []byte(fmt.Sprintf("%v", v)),
})
}
case "yaml", "yml":
Expand All @@ -92,7 +92,7 @@ func newCmdCreatePipeline(config *config) *cobra.Command {
for k, v := range m {
secrets = append(secrets, cloud.AddPipelineSecretPayload{
Key: k,
Value: fmt.Sprintf("%v", v),
Value: []byte(fmt.Sprintf("%v", v)),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/calyptia/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newCmd(ctx context.Context) *cobra.Command {
cobra.CheckErr(fmt.Errorf("invalid cloud url scheme %q", cloudURL.Scheme))
}

config.cloud.BaseURL = cloudURL.String()
config.cloud.BaseURL = cloudclient.Endpoint(cloudURL.String())

if tok == nil {
return
Expand Down

0 comments on commit 22be64a

Please sign in to comment.