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

Updated list service #254

Merged
merged 2 commits into from
Sep 20, 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
16 changes: 6 additions & 10 deletions cmd/list/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ var serviceCmd = &cobra.Command{
},
}

var serviceName, version, team, label string
var serviceName, version, tags string

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(&tags, "tags", "", "comma separated tags eg. key1=value1,key2=value2")
listCmd.AddCommand(serviceCmd)
}

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

if err != nil {
Expand All @@ -67,14 +65,13 @@ func writeListService(response *serviceProto.ListServiceResponse, format string)
}

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 @@ func writeListServiceAsJSON(response *serviceProto.ListServiceResponse) {
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 @@ -44,16 +44,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 @@ -116,8 +116,7 @@ message ListServiceResponse {
message ListServiceRequest {
string name = 1;
string version = 2;
string team = 3;
string label = 4;
string tags = 3;
}

message DescribeServiceRequest {
Expand Down
202 changes: 67 additions & 135 deletions proto/gen/go/dream11/od/dto/v1/service.pb.go

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

Loading
Loading