diff --git a/protos/sift/annotation_logs/v1/annotation_logs.proto b/protos/sift/annotation_logs/v1/annotation_logs.proto index c7965da6..efa6b888 100644 --- a/protos/sift/annotation_logs/v1/annotation_logs.proto +++ b/protos/sift/annotation_logs/v1/annotation_logs.proto @@ -7,7 +7,7 @@ import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/annotation_logs/v1;annotation_logsv1pb"; + service AnnotationLogService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { diff --git a/protos/sift/annotations/v1/annotations.proto b/protos/sift/annotations/v1/annotations.proto index 9b51dc30..4e6cfe23 100644 --- a/protos/sift/annotations/v1/annotations.proto +++ b/protos/sift/annotations/v1/annotations.proto @@ -8,7 +8,7 @@ import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/annotations/v1;annotationsv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Annotation Service"} }; @@ -104,6 +104,7 @@ message Annotation { repeated string tags = 15 [(google.api.field_behavior) = REQUIRED]; optional string legend_config = 16 [(google.api.field_behavior) = OPTIONAL]; optional string created_by_condition_id = 17 [(google.api.field_behavior) = OPTIONAL]; + optional string created_by_rule_condition_version_id = 18 [(google.api.field_behavior) = OPTIONAL]; } enum AnnotationState { @@ -167,6 +168,8 @@ message CreateAnnotationRequest { optional string created_by_condition_id = 14 [(google.api.field_behavior) = OPTIONAL]; // A JSON string containing the axes configuration of the annotation's linked channels. optional string legend_config = 13 [(google.api.field_behavior) = OPTIONAL]; + // The ID of the rule condition version that created this annotation. + optional string created_by_rule_condition_version_id = 15 [(google.api.field_behavior) = OPTIONAL]; } // The result of a call to `AnnotationService_CreateAnnotation`. @@ -213,7 +216,7 @@ message ListAnnotationsRequest { // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. // Available fields to filter by are `annotation_id`, `start_time`, `end_time`, - // `created_date`, `modified_date`, `run_id`, `name`, `description`, `state`, `created_by_user_id`, `created_by_condition_id`, + // `created_date`, `modified_date`, `run_id`, `name`, `description`, `state`, `created_by_user_id`, `created_by_rule_condition_version_id`, // and `annotation_type`. // 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). // For more information about the fields used for filtering, please refer to [this definition](/protocol-buffers/documentation#annotation). Optional. diff --git a/protos/sift/assets/v1/assets.proto b/protos/sift/assets/v1/assets.proto index e7537537..83e590c6 100644 --- a/protos/sift/assets/v1/assets.proto +++ b/protos/sift/assets/v1/assets.proto @@ -7,7 +7,7 @@ import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/assets/v1;assetsv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Asset Service"} }; diff --git a/protos/sift/calculated_channels/v1/calculated_channels.proto b/protos/sift/calculated_channels/v1/calculated_channels.proto index bc272429..e03a85ad 100644 --- a/protos/sift/calculated_channels/v1/calculated_channels.proto +++ b/protos/sift/calculated_channels/v1/calculated_channels.proto @@ -7,7 +7,7 @@ import "google/api/field_behavior.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; import "sift/common/type/v1/channel_data_type.proto"; -option go_package = "azimuth/gen/protos/go/sift/calculated_channels/v1;calculatedchannelsv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Calculated Channels Service"} }; diff --git a/protos/sift/channel_schemas/v1/channel_schemas.proto b/protos/sift/channel_schemas/v1/channel_schemas.proto index 2b10135a..7ca88b6d 100644 --- a/protos/sift/channel_schemas/v1/channel_schemas.proto +++ b/protos/sift/channel_schemas/v1/channel_schemas.proto @@ -9,7 +9,7 @@ import "sift/common/type/v1/channel_bit_field_element.proto"; import "sift/common/type/v1/channel_data_type.proto"; import "sift/common/type/v1/channel_enum_type.proto"; -option go_package = "azimuth/gen/protos/go/sift/channel_schemas/v1;channelschemasv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Channel Schema Service"} }; diff --git a/protos/sift/channels/v2/channels.proto b/protos/sift/channels/v2/channels.proto index 4e47ff01..2ef49582 100644 --- a/protos/sift/channels/v2/channels.proto +++ b/protos/sift/channels/v2/channels.proto @@ -10,7 +10,7 @@ import "sift/common/type/v1/channel_bit_field_element.proto"; import "sift/common/type/v1/channel_data_type.proto"; import "sift/common/type/v1/channel_enum_type.proto"; -option go_package = "azimuth/gen/protos/go/sift/channels/v2;channelsv2pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Channel service"} }; diff --git a/protos/sift/common/type/v1/channel_bit_field_element.proto b/protos/sift/common/type/v1/channel_bit_field_element.proto index 4a0d8c05..048f6ab6 100644 --- a/protos/sift/common/type/v1/channel_bit_field_element.proto +++ b/protos/sift/common/type/v1/channel_bit_field_element.proto @@ -4,7 +4,7 @@ package sift.common.type.v1; import "google/api/field_behavior.proto"; -option go_package = "azimuth/gen/protos/go/sift/common/type/v1;typev1pb"; + message ChannelBitFieldElement { string name = 1 [(google.api.field_behavior) = REQUIRED]; diff --git a/protos/sift/common/type/v1/channel_data_type.proto b/protos/sift/common/type/v1/channel_data_type.proto index ed80ab8e..340f3b92 100644 --- a/protos/sift/common/type/v1/channel_data_type.proto +++ b/protos/sift/common/type/v1/channel_data_type.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package sift.common.type.v1; -option go_package = "azimuth/gen/protos/go/sift/common/type/v1;typev1pb"; + enum ChannelDataType { CHANNEL_DATA_TYPE_UNSPECIFIED = 0 [deprecated = true]; diff --git a/protos/sift/common/type/v1/channel_enum_type.proto b/protos/sift/common/type/v1/channel_enum_type.proto index 90fc8b6a..c67a2e86 100644 --- a/protos/sift/common/type/v1/channel_enum_type.proto +++ b/protos/sift/common/type/v1/channel_enum_type.proto @@ -4,7 +4,7 @@ package sift.common.type.v1; import "google/api/field_behavior.proto"; -option go_package = "azimuth/gen/protos/go/sift/common/type/v1;typev1pb"; + message ChannelEnumType { string name = 1 [(google.api.field_behavior) = REQUIRED]; diff --git a/protos/sift/common/type/v1/organization.proto b/protos/sift/common/type/v1/organization.proto index 5c657f7e..3a1b0c89 100644 --- a/protos/sift/common/type/v1/organization.proto +++ b/protos/sift/common/type/v1/organization.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package sift.common.type.v1; -option go_package = "azimuth/gen/protos/go/sift/common/type/v1;typev1pb"; + message Organization { string organization_id = 1; diff --git a/protos/sift/common/type/v1/user.proto b/protos/sift/common/type/v1/user.proto index 8de8110a..b05e838f 100644 --- a/protos/sift/common/type/v1/user.proto +++ b/protos/sift/common/type/v1/user.proto @@ -5,7 +5,7 @@ package sift.common.type.v1; import "google/api/field_behavior.proto"; import "sift/common/type/v1/organization.proto"; -option go_package = "azimuth/gen/protos/go/sift/common/type/v1;typev1pb"; + message User { string user_id = 1 [(google.api.field_behavior) = REQUIRED]; diff --git a/protos/sift/data/v1/data.proto b/protos/sift/data/v1/data.proto index 3cf2f229..918d65f7 100644 --- a/protos/sift/data/v1/data.proto +++ b/protos/sift/data/v1/data.proto @@ -12,7 +12,7 @@ import "sift/common/type/v1/channel_bit_field_element.proto"; import "sift/common/type/v1/channel_data_type.proto"; import "sift/common/type/v1/channel_enum_type.proto"; -option go_package = "azimuth/gen/protos/go/sift/data/v1;datav1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Data Service"} }; diff --git a/protos/sift/ingest/v1/ingest.proto b/protos/sift/ingest/v1/ingest.proto index 28a3bea0..939f455a 100644 --- a/protos/sift/ingest/v1/ingest.proto +++ b/protos/sift/ingest/v1/ingest.proto @@ -5,7 +5,7 @@ package sift.ingest.v1; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "azimuth/gen/protos/go/sift/ingest/v1;ingestv1pb"; + service IngestService { rpc IngestWithConfigDataStream(stream IngestWithConfigDataStreamRequest) returns (IngestWithConfigDataStreamResponse); diff --git a/protos/sift/ingestion_configs/v1/ingestion_configs.proto b/protos/sift/ingestion_configs/v1/ingestion_configs.proto index bca49537..5af35ef5 100644 --- a/protos/sift/ingestion_configs/v1/ingestion_configs.proto +++ b/protos/sift/ingestion_configs/v1/ingestion_configs.proto @@ -9,7 +9,7 @@ import "sift/common/type/v1/channel_bit_field_element.proto"; import "sift/common/type/v1/channel_data_type.proto"; import "sift/common/type/v1/channel_enum_type.proto"; -option go_package = "azimuth/gen/protos/go/sift/ingestion_configs/v1;ingestion_configsv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Ingestion Config Service"} }; diff --git a/protos/sift/notifications/v1/notifications.proto b/protos/sift/notifications/v1/notifications.proto index abb26bd5..de76acbe 100644 --- a/protos/sift/notifications/v1/notifications.proto +++ b/protos/sift/notifications/v1/notifications.proto @@ -8,7 +8,7 @@ import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/notifications/v1;notificationsv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Notification Service"} }; diff --git a/protos/sift/remote_files/v1/remote_files.proto b/protos/sift/remote_files/v1/remote_files.proto new file mode 100644 index 00000000..a8ad694c --- /dev/null +++ b/protos/sift/remote_files/v1/remote_files.proto @@ -0,0 +1,234 @@ +syntax = "proto3"; + +package sift.remote_files.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: {title: "RemoteFile service"} +}; + +service RemoteFileService { + // Retrieve a remote file. + rpc GetRemoteFile(GetRemoteFileRequest) returns (GetRemoteFileResponse) { + option (google.api.http) = {get: "/api/v1/remote-files/{remote_file_id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "GetRemoteFile", + description: "Retrieve a remote file." + }; + } + + // Create a remote file. + rpc CreateRemoteFile(CreateRemoteFileRequest) returns (CreateRemoteFileResponse) { + option (google.api.http) = { + post: "/api/v1/remote-files" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "CreateRemoteFile" + description: "Create a remote file." + }; + } + + // List remote files. + rpc ListRemoteFiles(ListRemoteFilesRequest) returns (ListRemoteFilesResponse) { + option (google.api.http) = {get: "/api/v1/remote-files"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "ListRemoteFiles" + description: "List remote files." + }; + } + + // Updates an existing remote file using using the list of fields specified in `update_mask`. + rpc UpdateRemoteFile(UpdateRemoteFileRequest) returns (UpdateRemoteFileResponse) { + option (google.api.http) = { + patch: "/api/v1/remote-files" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "UpdateRemoteFile" + description: "Updates an existing remote file using using the list of fields specified in `update_mask`." + }; + } + + // Delete a remote file. + rpc DeleteRemoteFile(DeleteRemoteFileRequest) returns (DeleteRemoteFileResponse) { + option (google.api.http) = {delete: "/api/v1/remote-files/{remote_file_id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "DeleteRemoteFile" + description: "Delete a remote file." + }; + } + + // Batch deletes remote files. Each batch is limited to 1000 records. + rpc BatchDeleteRemoteFiles(BatchDeleteRemoteFilesRequest) returns (BatchDeleteRemoteFilesResponse) { + option (google.api.http) = { + post: "/api/v1/remote-files:batchDelete", + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "BatchDeleteRemoteFiles" + description: "Batch delete remote files. Each batch is limited to 1000 records." + }; + } + + // Gets a download URL for the remote file. + rpc GetRemoteFileDownloadUrl(GetRemoteFileDownloadUrlRequest) returns (GetRemoteFileDownloadUrlResponse) { + option (google.api.http) = {get: "/api/v1/remote-files/{remote_file_id}/download-url"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "GetRemoteFileUrl", + description: "Gets a download URL for the remote file." + }; + } +} + +message RemoteFile { + string remote_file_id = 1 [(google.api.field_behavior) = REQUIRED]; + string organization_id = 2 [(google.api.field_behavior) = REQUIRED]; + string entity_id = 3 [(google.api.field_behavior) = REQUIRED]; + EntityType entity_type = 4 [(google.api.field_behavior) = REQUIRED]; + string file_name = 5 [(google.api.field_behavior) = REQUIRED]; + string file_mime_type = 6 [(google.api.field_behavior) = REQUIRED]; + string file_content_encoding = 7 [(google.api.field_behavior) = REQUIRED]; + string storage_key = 8 [(google.api.field_behavior) = REQUIRED]; + uint64 file_size = 9 [(google.api.field_behavior) = REQUIRED]; + optional string description = 10 [(google.api.field_behavior) = OPTIONAL]; + oneof metadata { + VideoMetadata video_metadata = 11 [(google.api.field_behavior) = OPTIONAL]; + ImageMetadata image_metadata = 12 [(google.api.field_behavior) = OPTIONAL]; + } + string created_by_user_id = 13 [(google.api.field_behavior) = REQUIRED]; + string modified_by_user_id = 14 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp created_date = 15 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp modified_date = 16 [(google.api.field_behavior) = REQUIRED]; +} + +message VideoMetadata { + uint32 height = 1 [(google.api.field_behavior) = OPTIONAL]; + uint32 width = 2 [(google.api.field_behavior) = OPTIONAL]; + float duration_seconds = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message ImageMetadata { + uint32 height = 1 [(google.api.field_behavior) = OPTIONAL]; + uint32 width = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +enum EntityType { + ENTITY_TYPE_UNSPECIFIED = 0; + ENTITY_TYPE_RUN = 1; + ENTITY_TYPE_ANNOTATION = 2; + ENTITY_TYPE_ASSET = 3; + ENTITY_TYPE_ANNOTATION_LOG = 4; +} + +// The request for a call to `RemoteFileService_GetRemoteFile` to retrieve a remote file; +message GetRemoteFileRequest { + string remote_file_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `RemoteFileService_GetRemoteFile`. +message GetRemoteFileResponse { + RemoteFile remote_file = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `RemoteFileService_ListRemoteFiles` to retrieve remote files. +message ListRemoteFilesRequest { + // The maximum number of remote files to return. The service may return fewer than this value. + // If unspecified, at most 50 remote files will be returned. The maximum value is 1000; values above + // 1000 will be coerced to 1000. Optional. + uint32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // A page token, received from a previous `ListRemoteFiles` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListRemoteFiles` must match + // the call that provided the page token. Optional. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. + // Available fields to filter by are `remote_file_id`, `entity_id`, `entity_type`, and `file_name`. + // 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). + // For more information about the fields used for filtering, please refer to [this definition](/protocol-buffers/documentation#remote_files). Optional. + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // This field is only required if your user belongs to multiple organizations. + string organization_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response of a call to `RemoteFileService_ListRemoteFilesResponse`. +message ListRemoteFilesResponse { + repeated RemoteFile remote_files = 1; + string next_page_token = 2; +} + +// The request for a call to `RemoteFileService_CreateRemoteFile` to create a remote file. +message CreateRemoteFileRequest { + string file_name = 1 [(google.api.field_behavior) = REQUIRED]; + string entity_id = 2 [(google.api.field_behavior) = REQUIRED]; + EntityType entity_type = 3 [(google.api.field_behavior) = REQUIRED]; + string file_mime_type = 4 [(google.api.field_behavior) = REQUIRED]; + string file_content_encoding = 5 [(google.api.field_behavior) = REQUIRED]; + uint64 file_size = 6 [(google.api.field_behavior) = REQUIRED]; + optional string description = 7 [(google.api.field_behavior) = OPTIONAL]; + + // This field is only required if your user belongs to multiple organizations. + string organization_id = 8 [(google.api.field_behavior) = OPTIONAL]; + oneof metadata { + VideoMetadata video_metadata = 9 [(google.api.field_behavior) = OPTIONAL]; + ImageMetadata image_metadata = 10 [(google.api.field_behavior) = OPTIONAL]; + } + + // A custom UUID used to generate the object key. Recommended to be left unset. + optional string custom_uuid = 11 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for a call to `RemoteFileService_CreateRemoteFile`. +message CreateRemoteFileResponse { + RemoteFile remote_file = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `RemoteFileService_DeleteRemoteFile` to delete a remote file. +message DeleteRemoteFileRequest { + string remote_file_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `RemoteFileService_DeleteRemoteFile`. +message DeleteRemoteFileResponse {} + +// The request for a call to `RemoteFileService_BatchDeleteRemoteFiles` to delete remote files. +message BatchDeleteRemoteFilesRequest { + // Up to 1000 remote file IDs can be provided per request. + repeated string remote_file_ids = 1; +} + +// The response of a call to `RemoteFileService_BatchDeleteRemoteFiles`. +message BatchDeleteRemoteFilesResponse {} + +// The request for a call to `RemoteFileService_UpdateRemoteFile` to update a remote file. +message UpdateRemoteFileRequest { + // The remote file to update. + RemoteFile remote_file = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. The field available to be updated is `description`. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `RemoteFileService_UpdateRemoteFile`. +message UpdateRemoteFileResponse { + RemoteFile remote_file = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `RemoteFileService_GetRemoteFileDownloadUrl`. +message GetRemoteFileDownloadUrlRequest { + string remote_file_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `RemoteFileService_GetRemoteFileDownloadUrl`. +message GetRemoteFileDownloadUrlResponse { + string download_url = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/protos/sift/rules/v1/rules.proto b/protos/sift/rules/v1/rules.proto index 41314b4b..c5887b35 100644 --- a/protos/sift/rules/v1/rules.proto +++ b/protos/sift/rules/v1/rules.proto @@ -15,7 +15,7 @@ import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; import "sift/annotations/v1/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/rules/v1;rulesv1pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Rule Service"} }; @@ -41,12 +41,12 @@ service RuleService { }; } - // Retrieves a rule. + // Retrieves the latest version of a rule. rpc GetRule(GetRuleRequest) returns (GetRuleResponse) { option (google.api.http) = {get: "/api/v1/rules"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { - summary: "GetRules" - description: "Retrieves a rule." + summary: "GetRule" + description: "Retrieves the latest version of a rule." }; } @@ -165,6 +165,36 @@ service RuleService { description: "Batch update rules given the `rules_json` which is a JSON list of rules." }; } + + // Retrieves a list of rule versions for the given rule. + rpc ListRuleVersions(ListRuleVersionsRequest) returns (ListRuleVersionsResponse) { + option (google.api.http) = {get: "/api/v1/rules/{rule_id}/versions"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "ListRuleVersions" + description: "Retrieves a list of rule versions for the given rule." + }; + } + + // Retrieves a specific version of a rule. + rpc GetRuleVersion(GetRuleVersionRequest) returns (GetRuleVersionResponse) { + option (google.api.http) = {get: "/api/v1/rules:version"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "GetRuleVersion" + description: "Retrieves a specific version of a rule." + }; + } + + // Retrieves multiple rules by rule versions. + rpc BatchGetRuleVersions(BatchGetRuleVersionsRequest) returns (BatchGetRuleVersionsResponse) { + option (google.api.http) = { + post: "/api/v1/rules:batchGetVersions" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "BatchGetRuleVersions" + description: "Retrieves multiple rules by rule versions." + }; + } } message Rule { @@ -181,6 +211,7 @@ message Rule { string modified_by_user_id = 10 [(google.api.field_behavior) = REQUIRED]; string organization_id = 11 [(google.api.field_behavior) = REQUIRED]; repeated RuleCondition conditions = 12 [(google.api.field_behavior) = REQUIRED]; + RuleVersion rule_version = 13 [(google.api.field_behavior) = REQUIRED]; } message RuleCondition { // 4 is reserved from old "status" column that lived directly on rule condition @@ -193,6 +224,7 @@ message RuleCondition { string created_by_user_id = 7 [(google.api.field_behavior) = REQUIRED]; string modified_by_user_id = 8 [(google.api.field_behavior) = REQUIRED]; repeated RuleAction actions = 9 [(google.api.field_behavior) = REQUIRED]; + string rule_condition_version_id = 10 [(google.api.field_behavior) = REQUIRED]; } message RuleAction { string rule_action_id = 1 [(google.api.field_behavior) = REQUIRED]; @@ -203,6 +235,11 @@ message RuleAction { google.protobuf.Timestamp modified_date = 6 [(google.api.field_behavior) = REQUIRED]; string created_by_user_id = 7 [(google.api.field_behavior) = REQUIRED]; string modified_by_user_id = 8 [(google.api.field_behavior) = REQUIRED]; + string rule_action_version_id = 9 [(google.api.field_behavior) = REQUIRED]; +} + +message RuleAssetConfiguration { + repeated string asset_ids = 1; } message SearchRulesRequest { @@ -228,7 +265,7 @@ enum SearchOrder { } message SearchRulesResponse { uint32 count = 1 [(google.api.field_behavior) = REQUIRED]; - // Conditions are not included in the search response + // Conditions are not included in the search response. The latest version of the rule is returned. repeated Rule rules = 2 [(google.api.field_behavior) = REQUIRED]; } @@ -260,6 +297,7 @@ message UpdateRuleRequest { bool is_enabled = 5 [(google.api.field_behavior) = REQUIRED]; repeated UpdateConditionRequest conditions = 6 [(google.api.field_behavior) = REQUIRED]; string organization_id = 7; + string version_notes = 8; } message UpdateConditionRequest { // 2 is reserved from old status update support on rule condition directly @@ -354,12 +392,66 @@ message UpdateJsonRulesResponse { JsonRulesResponse response = 1 [(google.api.field_behavior) = REQUIRED]; } +message ListRuleVersionsRequest { + string rule_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of Rule Versions to return. + // The service may return fewer than this value. + // If unspecified, at most 50 Rule Versions will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + uint32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // A page token, received from a previous `ListRuleVersions` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListRuleVersions` must match + // the call that provided the page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. + // Available fields to filter by are `rule_version_id`, `user_notes`, and `change_message`. + // 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). Optional. + string filter = 4; +} + +message RuleVersion { + string rule_id = 1 [(google.api.field_behavior) = REQUIRED]; + string rule_version_id = 2 [(google.api.field_behavior) = REQUIRED]; + string version = 3 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp created_date = 4 [(google.api.field_behavior) = REQUIRED]; + string created_by_user_id = 5 [(google.api.field_behavior) = REQUIRED]; + string version_notes = 6 [(google.api.field_behavior) = REQUIRED]; + string generated_change_message = 7 [(google.api.field_behavior) = REQUIRED]; +} + +message ListRuleVersionsResponse { + repeated RuleVersion rule_versions = 1 [(google.api.field_behavior) = REQUIRED]; + string next_page_token = 2; +} + +message GetRuleVersionRequest { + string rule_version_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message GetRuleVersionResponse { + Rule rule = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message BatchGetRuleVersionsRequest { + repeated string rule_version_ids = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message BatchGetRuleVersionsResponse { + repeated Rule rules = 1 [(google.api.field_behavior) = REQUIRED]; +} + message RuleConditionExpression { oneof expression { - SingleChannelComparisonExpression single_channel_comparison = 1; + SingleChannelComparisonExpression single_channel_comparison = 1 [deprecated = true]; CalculatedChannelConfig calculated_channel = 2; } } + +// Deprecated - use CalculatedChannelConfig. message SingleChannelComparisonExpression { string channel_component = 1 [(google.api.field_behavior) = REQUIRED]; string channel_name = 2 [(google.api.field_behavior) = REQUIRED]; @@ -433,4 +525,5 @@ message DryRunAnnotation { string name = 2; google.protobuf.Timestamp start_time = 3; google.protobuf.Timestamp end_time = 4; + string condition_version_id = 5; } diff --git a/protos/sift/runs/v2/runs.proto b/protos/sift/runs/v2/runs.proto index c88af5cd..a7a7d6d4 100644 --- a/protos/sift/runs/v2/runs.proto +++ b/protos/sift/runs/v2/runs.proto @@ -8,7 +8,7 @@ import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "azimuth/gen/protos/go/sift/runs/v2;runsv2pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "Run service"} }; diff --git a/protos/sift/saved_searches/v1/saved_searches.proto b/protos/sift/saved_searches/v1/saved_searches.proto new file mode 100644 index 00000000..8cf9e7c9 --- /dev/null +++ b/protos/sift/saved_searches/v1/saved_searches.proto @@ -0,0 +1,189 @@ +syntax = "proto3"; + +package sift.saved_searches.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: {title: "SavedSearch service"} +}; + +service SavedSearchService { + // Retrieve a saved search. + rpc GetSavedSearch(GetSavedSearchRequest) returns (GetSavedSearchResponse) { + option (google.api.http) = {get: "/api/v1/saved_searches/{saved_search_id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "GetSavedSearch", + description: "Retrieve a saved search." + }; + } + + // Create a saved search. + rpc CreateSavedSearch(CreateSavedSearchRequest) returns (CreateSavedSearchResponse) { + option (google.api.http) = { + post: "/api/v1/saved_searches" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "CreateSavedSearch" + description: "Create a saved search." + }; + } + + // List saved searches. + rpc ListSavedSearches(ListSavedSearchesRequest) returns (ListSavedSearchesResponse) { + option (google.api.http) = {get: "/api/v1/saved_searches"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "ListSavedSearches" + description: "List saved searches." + }; + } + + // Updates an existing saved search using using the list of fields specified in `update_mask`. + rpc UpdateSavedSearch(UpdateSavedSearchRequest) returns (UpdateSavedSearchResponse) { + option (google.api.http) = { + patch: "/api/v1/saved_searches" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "UpdateSavedSearch" + description: "Updates an existing saved search using using the list of fields specified in `update_mask`." + }; + } + + // Delete a saved search. + rpc DeleteSavedSearch(DeleteSavedSearchRequest) returns (DeleteSavedSearchResponse) { + option (google.api.http) = {delete: "/api/v1/saved_searches/{saved_search_id}"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "DeleteSavedSearch" + description: "Delete a saved search." + }; + } + + // Batch deletes saved searches. + rpc BatchDeleteSavedSearches(BatchDeleteSavedSearchesRequest) returns (BatchDeleteSavedSearchesResponse) { + option (google.api.http) = { + post: "/api/v1/saved_searches:batchDelete", + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "BatchDeleteSavedSearches" + description: "Batch delete saved searches." + }; + } +} + +message SavedSearch { + string saved_search_id = 1 [(google.api.field_behavior) = REQUIRED]; + string organization_id = 2 [(google.api.field_behavior) = REQUIRED]; + string name = 3 [(google.api.field_behavior) = REQUIRED]; + SavedSearchProperties properties = 4 [(google.api.field_behavior) = REQUIRED]; + string created_by_user_id = 5 [(google.api.field_behavior) = REQUIRED]; + string modified_by_user_id = 6 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp created_date = 7 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.Timestamp modified_date = 8 [(google.api.field_behavior) = REQUIRED]; +} + +message SavedSearchProperties { + string overview_mode = 1 [(google.api.field_behavior) = REQUIRED]; + optional string search_term = 2 [(google.api.field_behavior) = OPTIONAL]; + optional google.protobuf.Timestamp from_date_time = 3 [(google.api.field_behavior) = OPTIONAL]; + optional google.protobuf.Timestamp to_date_time = 4 [(google.api.field_behavior) = OPTIONAL]; + repeated SavedSearchFilterItem asset_items = 5 [(google.api.field_behavior) = OPTIONAL]; + repeated SavedSearchFilterItem user_items = 6 [(google.api.field_behavior) = OPTIONAL]; + repeated SavedSearchFilterItem tag_items = 7 [(google.api.field_behavior) = OPTIONAL]; + repeated SavedSearchFilterItem annotation_items = 8 [(google.api.field_behavior) = OPTIONAL]; + repeated SavedSearchFilterItem run_items = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +message SavedSearchFilterItem { + string id = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `SavedSearchService_GetSavedSearch` to retrieve a saved search; +message GetSavedSearchRequest { + string saved_search_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `SavedSearchService_GetSavedSearch`. +message GetSavedSearchResponse { + SavedSearch saved_search = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `SavedSearchService_ListSavedSearches` to retrieve saved searches. +message ListSavedSearchesRequest { + // The maximum number of saved searches to return. The service may return fewer than this value. + // If unspecified, at most 50 saved searches will be returned. The maximum value is 1000; values above + // 1000 will be coerced to 1000. Optional. + uint32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // A page token, received from a previous `ListSavedSearches` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListSavedSearches` must match + // the call that provided the page token. Optional. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. + // Available fields to filter by are 'name' and 'saved_search_id'. + // 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). + // For more information about the fields used for filtering, please refer to [this definition](/protocol-buffers/documentation#saved_searches). Optional. + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // This field is only required if your user belongs to multiple organizations. + string organization_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response of a call to `SavedSearchService_ListSavedSearchesResponse`. +message ListSavedSearchesResponse { + repeated SavedSearch saved_searches = 1; + string next_page_token = 2; +} + +// The request for a call to `SavedSearchService_CreateSavedSearch` to create a saved search. +message CreateSavedSearchRequest { + string name = 1 [(google.api.field_behavior) = REQUIRED]; + SavedSearchProperties properties = 2 [(google.api.field_behavior) = REQUIRED]; + // This field is only required if your user belongs to multiple organizations. + string organization_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for a call to `SavedSearchService_CreateSavedResponse`. +message CreateSavedSearchResponse { + SavedSearch saved_search = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request for a call to `SavedSearchService_DeleteSavedSearch` to delete a saved search. +message DeleteSavedSearchRequest { + string saved_search_id = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `SavedSearchService_DeleteSavedSearch`. +message DeleteSavedSearchResponse {} + +// The request for a call to `SavedSearchService_BatchDeleteSavedSearches` to delete saved searches. +message BatchDeleteSavedSearchesRequest { + repeated string saved_search_ids = 1; +} + +// The response of a call to `SavedSearchService_BatchDeleteSavedSearches`. +message BatchDeleteSavedSearchesResponse {} + +// The request for a call to `SavedSearchService_UpdateSavedSearch` to update a saved search. +message UpdateSavedSearchRequest { + // The saved search to update. + SavedSearch saved_search = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. The fields available to be updated are `name` and `properties`. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response of a call to `SavedSearchService_UpdateSavedSearch`. +message UpdateSavedSearchResponse { + SavedSearch saved_search = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/protos/sift/tags/v1/tags.proto b/protos/sift/tags/v1/tags.proto index 55cadb27..30d68aa9 100644 --- a/protos/sift/tags/v1/tags.proto +++ b/protos/sift/tags/v1/tags.proto @@ -5,7 +5,7 @@ package sift.tags.v1; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "azimuth/gen/protos/go/sift/tags/v1;tagsv1pb"; + message Tag { string tag_id = 1 [(google.api.field_behavior) = REQUIRED]; diff --git a/protos/sift/users/v2/users.proto b/protos/sift/users/v2/users.proto index 692c4ba5..40a2778f 100644 --- a/protos/sift/users/v2/users.proto +++ b/protos/sift/users/v2/users.proto @@ -7,7 +7,7 @@ import "google/api/field_behavior.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; import "sift/common/type/v1/user.proto"; -option go_package = "azimuth/gen/protos/go/sift/users/v2;usersv2pb"; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: {title: "User Service"} }; diff --git a/scripts/gen.sh b/scripts/gen.sh index 2dab55aa..d1a14b52 100755 --- a/scripts/gen.sh +++ b/scripts/gen.sh @@ -69,6 +69,8 @@ gen_python_modules() { # This is necessary to split `google` module into separate directories: one generated from the googleapis buf plugin, # and the other coming from the `protobuf` PyPI package that gets installed as `google`. echo "__path__ = __import__('pkgutil').extend_path(__path__, __name__)" >> "$python_lib/google/__init__.py" + touch "$sift_py/py.typed" + touch "$sift_grafana/py.typed" echo "ok" }