Skip to content

Commit ca3255c

Browse files
authored
backend: add tags to pipeline api (#1650)
* backend: add tags to pipeline api * backend: add field mask * chore: compile protos * proto: update comment
1 parent 9e28c19 commit ca3255c

File tree

6 files changed

+736
-534
lines changed

6 files changed

+736
-534
lines changed

backend/pkg/protogen/redpanda/api/dataplane/v1/pipeline.pb.go

+620-532
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/pkg/protogen/redpanda/api/dataplane/v1/pipeline.pb.gw.go

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/protogen/redpanda/api/dataplane/v1/pipeline_pb.ts

+36-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @ts-nocheck
55

66
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
7-
import { Message, proto3 } from "@bufbuild/protobuf";
7+
import { FieldMask, Message, proto3 } from "@bufbuild/protobuf";
88

99
/**
1010
* Defines the pipeline resource.
@@ -68,6 +68,14 @@ export class Pipeline extends Message<Pipeline> {
6868
*/
6969
url = "";
7070

71+
/**
72+
* Tags are key-value pairs that can be assigned to a pipeline resource.
73+
* They help organize pipelines and enable filtering when listing them.
74+
*
75+
* @generated from field: map<string, string> tags = 11;
76+
*/
77+
tags: { [key: string]: string } = {};
78+
7179
constructor(data?: PartialMessage<Pipeline>) {
7280
super();
7381
proto3.util.initPartial(data, this);
@@ -84,6 +92,7 @@ export class Pipeline extends Message<Pipeline> {
8492
{ no: 7, name: "state", kind: "enum", T: proto3.getEnumType(Pipeline_State) },
8593
{ no: 8, name: "status", kind: "message", T: Pipeline_Status },
8694
{ no: 10, name: "url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
95+
{ no: 11, name: "tags", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
8796
]);
8897

8998
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Pipeline {
@@ -553,6 +562,13 @@ export class ListPipelinesRequest_Filter extends Message<ListPipelinesRequest_Fi
553562
*/
554563
nameContains = "";
555564

565+
/**
566+
* Filter pipelines that contain all of these key/value pairs.
567+
*
568+
* @generated from field: map<string, string> tags = 2;
569+
*/
570+
tags: { [key: string]: string } = {};
571+
556572
constructor(data?: PartialMessage<ListPipelinesRequest_Filter>) {
557573
super();
558574
proto3.util.initPartial(data, this);
@@ -562,6 +578,7 @@ export class ListPipelinesRequest_Filter extends Message<ListPipelinesRequest_Fi
562578
static readonly typeName = "redpanda.api.dataplane.v1.ListPipelinesRequest.Filter";
563579
static readonly fields: FieldList = proto3.util.newFieldList(() => [
564580
{ no: 1, name: "name_contains", kind: "scalar", T: 9 /* ScalarType.STRING */ },
581+
{ no: 2, name: "tags", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
565582
]);
566583

567584
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListPipelinesRequest_Filter {
@@ -656,6 +673,14 @@ export class PipelineUpdate extends Message<PipelineUpdate> {
656673
*/
657674
resources?: Pipeline_Resources;
658675

676+
/**
677+
* Optional: A map of tags to add or update.
678+
* If a tag's value is empty, the server interprets that as a deletion.
679+
*
680+
* @generated from field: map<string, string> tags = 7;
681+
*/
682+
tags: { [key: string]: string } = {};
683+
659684
constructor(data?: PartialMessage<PipelineUpdate>) {
660685
super();
661686
proto3.util.initPartial(data, this);
@@ -668,6 +693,7 @@ export class PipelineUpdate extends Message<PipelineUpdate> {
668693
{ no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ },
669694
{ no: 3, name: "config_yaml", kind: "scalar", T: 9 /* ScalarType.STRING */ },
670695
{ no: 6, name: "resources", kind: "message", T: Pipeline_Resources },
696+
{ no: 7, name: "tags", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
671697
]);
672698

673699
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PipelineUpdate {
@@ -703,6 +729,14 @@ export class UpdatePipelineRequest extends Message<UpdatePipelineRequest> {
703729
*/
704730
pipeline?: PipelineUpdate;
705731

732+
/**
733+
* Specifies which fields should be updated. If not provided,
734+
* all fields will be updated.
735+
*
736+
* @generated from field: google.protobuf.FieldMask update_mask = 3;
737+
*/
738+
updateMask?: FieldMask;
739+
706740
constructor(data?: PartialMessage<UpdatePipelineRequest>) {
707741
super();
708742
proto3.util.initPartial(data, this);
@@ -713,6 +747,7 @@ export class UpdatePipelineRequest extends Message<UpdatePipelineRequest> {
713747
static readonly fields: FieldList = proto3.util.newFieldList(() => [
714748
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
715749
{ no: 2, name: "pipeline", kind: "message", T: PipelineUpdate },
750+
{ no: 3, name: "update_mask", kind: "message", T: FieldMask },
716751
]);
717752

718753
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdatePipelineRequest {

proto/gen/openapi/openapi.json

+1-1
Large diffs are not rendered by default.

proto/gen/openapi/openapi.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,11 @@ components:
893893
name_contains:
894894
description: Substring match on pipeline name. Case-sensitive.
895895
type: string
896+
tags[string]:
897+
additionalProperties:
898+
type: string
899+
description: Filter pipelines that contain all of these key/value pairs.
900+
type: object
896901
type: object
897902
ListPipelinesResponse:
898903
properties:
@@ -1164,6 +1169,13 @@ components:
11641169
$ref: '#/components/schemas/Pipeline.State'
11651170
status:
11661171
$ref: '#/components/schemas/Pipeline.Status'
1172+
tags:
1173+
additionalProperties:
1174+
type: string
1175+
description: |-
1176+
Tags are key-value pairs that can be assigned to a pipeline resource.
1177+
They help organize pipelines and enable filtering when listing them.
1178+
type: object
11671179
url:
11681180
description: |-
11691181
URL to connect to the pipeline, e.g. via http_server.
@@ -1229,6 +1241,13 @@ components:
12291241
type: string
12301242
resources:
12311243
$ref: '#/components/schemas/Resources'
1244+
tags:
1245+
additionalProperties:
1246+
type: string
1247+
description: |-
1248+
Optional: A map of tags to add or update.
1249+
If a tag's value is empty, the server interprets that as a deletion.
1250+
type: object
12321251
required:
12331252
- display_name
12341253
- config_yaml
@@ -3324,6 +3343,11 @@ paths:
33243343
name: filter.name_contains
33253344
schema:
33263345
type: string
3346+
- description: This is a request variable of the map type. The query format is "map_name[key]=value", e.g. If the map name is Age, the key type is string, and the value type is integer, the query parameter is expressed as Age["bob"]=18
3347+
in: query
3348+
name: filter.tags[string]
3349+
schema:
3350+
type: string
33273351
- description: Limit the paginated response to a number of items. Defaults to 100. Use -1 to disable pagination.
33283352
in: query
33293353
name: page_size
@@ -3572,6 +3596,13 @@ paths:
35723596
required: true
35733597
schema:
35743598
type: string
3599+
- description: |-
3600+
Specifies which fields should be updated. If not provided,
3601+
all fields will be updated.
3602+
in: query
3603+
name: update_mask
3604+
schema:
3605+
type: string
35753606
requestBody:
35763607
content:
35773608
application/json:

proto/redpanda/api/dataplane/v1/pipeline.proto

+30
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package redpanda.api.dataplane.v1;
55
import "buf/validate/validate.proto";
66
import "google/api/annotations.proto";
77
import "google/api/field_behavior.proto";
8+
import "google/protobuf/field_mask.proto";
89
import "protoc-gen-openapiv2/options/annotations.proto";
910

1011
// Defines the pipeline resource.
@@ -51,6 +52,15 @@ message Pipeline {
5152
// May be empty if no http_server is used.
5253
string url = 10;
5354

55+
// Tags are key-value pairs that can be assigned to a pipeline resource.
56+
// They help organize pipelines and enable filtering when listing them.
57+
map<string, string> tags = 11 [(buf.validate.field).map = {
58+
max_pairs: 16
59+
values: {
60+
string: {pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"}
61+
}
62+
}];
63+
5464
message Resources {
5565
// `memory_shares` is a string specifying the amount of memory to allocate for
5666
// the pipeline.
@@ -411,6 +421,14 @@ message ListPipelinesRequest {
411421
(buf.validate.field).string.pattern = "^[A-Za-z0-9-_ /]+$",
412422
(buf.validate.field).string.max_len = 128
413423
];
424+
425+
// Filter pipelines that contain all of these key/value pairs.
426+
map<string, string> tags = 2 [(buf.validate.field).map = {
427+
max_pairs: 16
428+
values: {
429+
string: {pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"}
430+
}
431+
}];
414432
}
415433
}
416434

@@ -445,6 +463,15 @@ message PipelineUpdate {
445463

446464
// The number of resources that are guaranteed to be assigned to the pipeline.
447465
Pipeline.Resources resources = 6;
466+
467+
// A map of tags to add, update or delete.
468+
// If a tag's value is empty, the server interprets that as a deletion.
469+
map<string, string> tags = 7 [(buf.validate.field).map = {
470+
max_pairs: 16
471+
values: {
472+
string: {pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$"}
473+
}
474+
}];
448475
}
449476

450477
message UpdatePipelineRequest {
@@ -458,6 +485,9 @@ message UpdatePipelineRequest {
458485
(google.api.field_behavior) = REQUIRED,
459486
(buf.validate.field).required = true
460487
];
488+
// Specifies which fields should be updated. If not provided,
489+
// all fields will be updated.
490+
google.protobuf.FieldMask update_mask = 3;
461491
}
462492

463493
message UpdatePipelineResponse {

0 commit comments

Comments
 (0)