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

Update list service #253

Open
wants to merge 1 commit into
base: 2.x.x
Choose a base branch
from
Open
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
14 changes: 5 additions & 9 deletions cmd/list/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
func init() {
serviceCmd.Flags().StringVar(&serviceName, "name", "", "name of the service")
serviceCmd.Flags().StringVar(&version, "version", "", "version of services to be listed")
serviceCmd.Flags().StringVar(&team, "team", "", "name of team")
serviceCmd.Flags().StringVar(&label, "label", "", "name of label")
serviceCmd.Flags().StringVar(&label, "tags", "", "list of tags")
listCmd.AddCommand(serviceCmd)
}

Expand All @@ -40,8 +39,7 @@
response, err := serviceClient.ListService(&ctx, &serviceProto.ListServiceRequest{
Name: serviceName,
Version: version,
Team: team,
Label: label,
Tags: tags,

Check failure on line 42 in cmd/list/service.go

View workflow job for this annotation

GitHub Actions / lint

unknown field Tags in struct literal of type "github.com/dream11/odin/proto/gen/go/dream11/od/service/v1".ListServiceRequest

Check failure on line 42 in cmd/list/service.go

View workflow job for this annotation

GitHub Actions / lint

undefined: tags
})

if err != nil {
Expand All @@ -67,14 +65,13 @@
}

func writeListServiceAsText(response *serviceProto.ListServiceResponse) {
var tableHeaders = []string{"Name", "Version", "Label", "Description"}
var tableHeaders = []string{"Name", "Version", "Tags"}
var tableData [][]interface{}
for _, serviceEntity := range response.Services {
tableData = append(tableData, []interface{}{
serviceEntity.Name,
serviceEntity.Version,
serviceEntity.Labels,
serviceEntity.Description,
serviceEntity.Tags,
})
}
table.Write(tableHeaders, tableData)
Expand All @@ -86,8 +83,7 @@
services = append(services, map[string]interface{}{
"name": serviceEntity.Name,
"version": serviceEntity.Version,
"labels": serviceEntity.Labels,
"description": serviceEntity.Description,
"tags": serviceEntity.Tags,
})
}
output, _ := json.MarshalIndent(services, "", " ")
Expand Down
13 changes: 3 additions & 10 deletions proto/dream11/od/dto/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ message ProvisioningConfig {
}

message ServiceMetadata {
int32 id = 1;
string name = 2;
string version = 3;
string description = 4;
string created_by = 5;
string updated_by = 6;
string created_at = 7;
string updated_at = 8;
string tags = 9; // JSON encoded string
string labels = 10; // comma seperated string
string name = 1;
string version = 2;
string tags = 3;
}

message AddComponentRequestOptions {
Expand Down
3 changes: 1 addition & 2 deletions proto/dream11/od/service/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,5 @@ message ListServiceResponse {
message ListServiceRequest {
string name = 1;
string version = 2;
string team = 3;
string label = 4;
string tags = 3;
}
Loading