@@ -10,6 +10,8 @@ import "protoc-gen-openapiv2/options/annotations.proto";
1010import "sift/calculated_channels/v1/calculated_channels.proto" ;
1111import "sift/common/type/v1/channel_data_type.proto" ;
1212import "sift/common/type/v1/resource_identifier.proto" ;
13+ import "sift/common/type/v1/user_defined_functions.proto" ;
14+ import "sift/metadata/v1/metadata.proto" ;
1315
1416
1517
@@ -94,6 +96,15 @@ service CalculatedChannelService {
9496 description : "Resolve a batch of calculated channels into expressions with references"
9597 };
9698 }
99+
100+ // Retrieve the latest versions of calculated channels based on an optional filter.
101+ rpc ListResolvedCalculatedChannels (ListResolvedCalculatedChannelsRequest ) returns (ListResolvedCalculatedChannelsResponse ) {
102+ option (google.api.http ) = {get : "/api/v2/calculated-channels/resolved" };
103+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
104+ summary : "ListResolvedCalculatedChannels" ,
105+ description : "Retrieve the latest versions of calculated channels based on an optional filter."
106+ };
107+ }
97108}
98109
99110message CalculatedChannel {
@@ -114,6 +125,8 @@ message CalculatedChannel {
114125 CalculatedChannelConfiguration calculated_channel_configuration = 15 [(google.api.field_behavior ) = REQUIRED ];
115126 string created_by_user_id = 16 [(google.api.field_behavior ) = REQUIRED ];
116127 string modified_by_user_id = 17 [(google.api.field_behavior ) = REQUIRED ];
128+ repeated sift.common.type.v1.FunctionDependency function_dependencies = 19 [(google.api.field_behavior ) = REQUIRED ];
129+ repeated sift.metadata.v1.MetadataValue metadata = 20 [(google.api.field_behavior ) = REQUIRED ];
117130}
118131
119132message CalculatedChannelConfiguration {
@@ -180,6 +193,7 @@ message CreateCalculatedChannelRequest {
180193 optional string units = 7 [(google.api.field_behavior ) = OPTIONAL ];
181194 optional string client_key = 4 [(google.api.field_behavior ) = OPTIONAL ];
182195 CalculatedChannelConfiguration calculated_channel_configuration = 5 [(google.api.field_behavior ) = REQUIRED ];
196+ repeated sift.metadata.v1.MetadataValue metadata = 8 [(google.api.field_behavior ) = REQUIRED ];
183197}
184198
185199message CreateCalculatedChannelResponse {
@@ -211,7 +225,7 @@ message ListCalculatedChannelsRequest {
211225
212226 // How to order the retrieved calculated channels. Formatted as a comma-separated string i.e. "FIELD_NAME[ desc],...".
213227 // Available fields to order_by are `created_date` and `modified_date`.
214- // If left empty, items are ordered by `created_date` in ascending order (oldest -first).
228+ // If left empty, items are ordered by `created_date` in descending order (newest -first).
215229 // For more information about the format of this field, read [this](https://google.aip.dev/132#ordering)
216230 // Example: "created_date desc,modified_date"
217231 string order_by = 5 [(google.api.field_behavior ) = OPTIONAL ];
@@ -232,7 +246,7 @@ message UpdateCalculatedChannelRequest {
232246 // The calculated channel to update.
233247 CalculatedChannel calculated_channel = 1 [(google.api.field_behavior ) = REQUIRED ];
234248
235- // The list of fields to be updated. The fields available to be updated are `name`, `description`, `units`,
249+ // The list of fields to be updated. The fields available to be updated are `name`, `description`, `units`, `metadata`,
236250 // `query_configuration`, `archived_date`, and `asset_configuration`.
237251 google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior ) = REQUIRED ];
238252
@@ -264,7 +278,7 @@ message ListCalculatedChannelVersionsRequest {
264278 string page_token = 4 [(google.api.field_behavior ) = OPTIONAL ];
265279
266280 // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string.
267- // Available fields to filter by are `calculated_channel_id`, `client_key`, `name`, `asset_id`, `asset_name`, `tag_id`, `tag_name`, `version`, and `archived_date .
281+ // Available fields to filter by are `calculated_channel_id`, `client_key`, `name`, `asset_id`, `asset_name`, `tag_id`, `tag_name`, `version`, `archived_date`, and `metadata` .
268282 // For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions).
269283 // For more information about the fields used for filtering, please refer to [this definition](/docs/api/grpc/protocol-buffers/calculated_channels#calculated_channel). Optional.
270284 string filter = 5 [(google.api.field_behavior ) = OPTIONAL ];
@@ -308,24 +322,25 @@ message ResolveCalculatedChannelRequest {
308322 optional sift.common.type.v1.ResourceIdentifier run = 5 [(google.api.field_behavior ) = OPTIONAL ];
309323}
310324
311- // The response of a call to `CalculatedChannelService_ResolveCalculatedChannel`.
312- message ResolveCalculatedChannelResponse {
313- // A specific calculated channel including the asset and exact channels to query.
314- message ResolvedCalculatedChannel {
315- // The name of the specific asset that was resolved.
316- string asset_name = 1 [(google.api.field_behavior ) = REQUIRED ];
317- // The expression resolved including channel references.
318- sift.calculated_channels.v1.ExpressionRequest expression_request = 2 [(google.api.field_behavior ) = REQUIRED ];
319- sift.common.type.v1.ChannelDataType output_data_type = 3 [(google.api.field_behavior ) = REQUIRED ];
320- }
325+ // A specific calculated channel including the asset and exact channels to query.
326+ message ResolvedCalculatedChannel {
327+ // The name of the specific asset that was resolved.
328+ string asset_name = 1 [(google.api.field_behavior ) = REQUIRED ];
329+ // The expression resolved including channel references.
330+ sift.calculated_channels.v1.ExpressionRequest expression_request = 2 [(google.api.field_behavior ) = REQUIRED ];
331+ sift.common.type.v1.ChannelDataType output_data_type = 3 [(google.api.field_behavior ) = REQUIRED ];
332+ string asset_id = 4 [(google.api.field_behavior ) = REQUIRED ];
333+ }
321334
322- // Any failure in resolution.
323- message UnresolvedCalculatedChannel {
324- // The name of the specific asset that was not resolved.
325- string asset_name = 1 [(google.api.field_behavior ) = REQUIRED ];
326- string error_message = 2 [(google.api.field_behavior ) = REQUIRED ];
327- }
335+ // Any failure in resolution.
336+ message UnresolvedCalculatedChannel {
337+ // The name of the specific asset that was not resolved.
338+ string asset_name = 1 [(google.api.field_behavior ) = REQUIRED ];
339+ string error_message = 2 [(google.api.field_behavior ) = REQUIRED ];
340+ }
328341
342+ // The response of a call to `CalculatedChannelService_ResolveCalculatedChannel`.
343+ message ResolveCalculatedChannelResponse {
329344 // If provided in the request, the calculated channel resolved.
330345 optional string calculated_channel_id = 1 [(google.api.field_behavior ) = OPTIONAL ];
331346 // All resolved calculated channels.
@@ -345,3 +360,47 @@ message BatchResolveCalculatedChannelsResponse {
345360 // All calculated channels that attempted resolution.
346361 repeated ResolveCalculatedChannelResponse responses = 1 [(google.api.field_behavior ) = REQUIRED ];
347362}
363+
364+ message ListResolvedCalculatedChannelsRequest {
365+ // Assets or runs to get the resolved calculated channels for. At least one asset or run must be provided.
366+ string asset_id = 1 [(google.api.field_behavior ) = OPTIONAL ];
367+ string run_id = 2 [(google.api.field_behavior ) = OPTIONAL ];
368+
369+ // The maximum number of calculated channels to return. The service may return fewer than this value.
370+ // If unspecified, at most 50 calculated channels will be returned. The maximum value is 1000; values above
371+ // 1000 will be coerced to 1000. Optional.
372+ uint32 page_size = 3 [(google.api.field_behavior ) = OPTIONAL ];
373+
374+ // A page token, received from a previous `ListCalculatedChannels` call.
375+ // Provide this to retrieve the subsequent page.
376+ // When paginating, all other parameters provided to `ListCalculatedChannels` must match
377+ // the call that provided the page token. Optional.
378+ string page_token = 4 [(google.api.field_behavior ) = OPTIONAL ];
379+
380+ // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string.
381+ // Available fields to filter by are `calculated_channel_id`, `client_key`, `name`, `asset_id`, `asset_name`, `tag_id`, `tag_name`, `version`, and `archived_date.
382+ // For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions).
383+ // For more information about the fields used for filtering, please refer to [this definition](/docs/api/grpc/protocol-buffers/calculated_channels#calculated_channel). Optional.
384+ string filter = 5 [(google.api.field_behavior ) = OPTIONAL ];
385+
386+ // How to order the retrieved calculated channels. Formatted as a comma-separated string i.e. "FIELD_NAME[ desc],...".
387+ // Available fields to order_by are `created_date` and `modified_date`.
388+ // If left empty, items are ordered by `created_date` in descending order (newest-first).
389+ // For more information about the format of this field, read [this](https://google.aip.dev/132#ordering)
390+ // Example: "created_date desc,modified_date"
391+ string order_by = 6 [(google.api.field_behavior ) = OPTIONAL ];
392+ }
393+
394+ message CalculatedChannelResolution {
395+ // The calculated channel resolved.
396+ optional CalculatedChannel calculated_channel = 1 [(google.api.field_behavior ) = OPTIONAL ];
397+ // All resolved calculated channels.
398+ repeated ResolvedCalculatedChannel resolved = 2 [(google.api.field_behavior ) = REQUIRED ];
399+ // All assets with any issues in resolution.
400+ repeated UnresolvedCalculatedChannel unresolved = 3 [(google.api.field_behavior ) = REQUIRED ];
401+ }
402+
403+ message ListResolvedCalculatedChannelsResponse {
404+ repeated CalculatedChannelResolution calculated_channel_resolutions = 1 [(google.api.field_behavior ) = REQUIRED ];
405+ string next_page_token = 3 [(google.api.field_behavior ) = OPTIONAL ];
406+ }
0 commit comments