Skip to content

Commit

Permalink
ControlPlane initial proto definitions. (#1843)
Browse files Browse the repository at this point in the history
Co-authored-by: Marco Premier <[email protected]>
Co-authored-by: marcopremier <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent b5c84f8 commit 80b8c44
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/api-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
shell: bash
steps:
- uses: actions/checkout@v4

- uses: world-federation-of-advertisers/actions/setup-api-linter@v2
with:
version: 1.67.2
sha256: 260064fad8c38feae402595b6cefef51d70e72b0b5968359c79ee8f3ad33ab27

# Authenticate to Google Cloud for access to remote cache.
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
Expand All @@ -58,4 +58,6 @@ jobs:
- env:
BAZEL: bazelisk
run: tools/api-lint wfa/measurement/system
run: |
tools/api-lint wfa/measurement/system
tools/api-lint wfa/measurement/securecomputation
12 changes: 12 additions & 0 deletions src/main/proto/api-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- included_paths:
- 'wfa/measurement/reporting/**/*.proto'
- 'wfa/measurement/system/**/*.proto'
- 'wfa/measurement/securecomputation/controlplane/**/*.proto'
disabled_rules:
- 'core::0191::java-package'
- 'core::0146::any'
Expand Down Expand Up @@ -43,3 +44,14 @@
- 'core::0133::request-id-field'
- 'core::0121::resource-must-support-get'
- 'core::0203::field-behavior-required'

- included_paths:
- 'wfa/measurement/securecomputation/controlplane/v1*/*.proto'
disabled_rules:
# Not all methods are useful for all resource types.
- 'core::0121::resource-must-support-get'
- 'core::0121::resource-must-support-list'

# gRPC-only. REST/HTTP not supported.
- 'core::0127::http-annotation'
- 'core::0133::http-uri-parent'
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"@wfa_rules_kotlin_jvm//kotlin:defs.bzl",
"kt_jvm_grpc_proto_library",
"kt_jvm_proto_library",
)

package(default_visibility = ["//visibility:public"])

IMPORT_PREFIX = "/src/main/proto"

#Resources and shared message types.

proto_library(
name = "queue_proto",
srcs = ["queue.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
],
)

kt_jvm_proto_library(
name = "queue_kt_jvm_proto",
deps = [":queue_proto"],
)

proto_library(
name = "work_item_proto",
srcs = ["work_item.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
"@com_google_googleapis//google/api:field_behavior_proto",
"@com_google_googleapis//google/api:resource_proto",
"@com_google_protobuf//:any_proto",
],
)

kt_jvm_proto_library(
name = "work_item_kt_jvm_proto",
deps = [":work_item_proto"],
)

#Services.

proto_library(
name = "work_items_service_proto",
srcs = ["work_items_service.proto"],
strip_import_prefix = IMPORT_PREFIX,
deps = [
":work_item_proto",
"@com_google_googleapis//google/api:client_proto",
"@com_google_googleapis//google/api:field_behavior_proto",
],
)

kt_jvm_grpc_proto_library(
name = "work_items_service_kt_jvm_grpc_proto",
deps = [":work_items_service_proto"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2024 The Cross-Media Measurement Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package wfa.measurement.securecomputation.controlplane.v1alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option java_package = "org.wfanet.measurement.securecomputation.controlplane.v1alpha";
option java_multiple_files = true;
option java_outer_classname = "QueueProto";

// Resource representing a queue.
message Queue {
option (google.api.resource) = {
type: "control-plane.secure-computation.halo-cmm.org/Queue"
pattern: "queues/{queue}"
singular: "queue"
plural: "queues"
};

// Resource name.
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2024 The Cross-Media Measurement Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package wfa.measurement.securecomputation.controlplane.v1alpha;

import "google/protobuf/any.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";

option java_package = "org.wfanet.measurement.securecomputation.controlplane.v1alpha";
option java_multiple_files = true;
option java_outer_classname = "WorkItemProto";

// Resource representing a work item.
message WorkItem {
option (google.api.resource) = {
type: "control-plane.secure-computation.halo-cmm.org/WorkItem"
pattern: "workItems/{work_item}"
singular: "workItem"
plural: "workItems"
};

// Resource name.
string name = 1 [(google.api.field_behavior) = IDENTIFIER];

// The queue into which this `WorkItem` must be enqueued.
// Available queues are specified in a configuration file.
string queue = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "control-plane.secure-computation.halo-cmm.org/Queue"
}
];
// The parameters to be delivered to the TEE application.
google.protobuf.Any work_item_params = 3
[(google.api.field_behavior) = IMMUTABLE];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2024 The Cross-Media Measurement Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package wfa.measurement.securecomputation.controlplane.v1alpha;

import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "wfa/measurement/securecomputation/controlplane/v1alpha/work_item.proto";

option java_package = "org.wfanet.measurement.securecomputation.controlplane.v1alpha";
option java_multiple_files = true;
option java_outer_classname = "WorkItemsServiceProto";

// Service for interacting with `WorkItems` resources.
service WorkItems {
// Creates a `WorkItem`.
//
// Enqueues the `WorkItem` into the appropriate queue.
// Results in PERMISSION_DENIED if the queue specified in the `WorkItem`
// is not listed in the configuration file.
rpc CreateWorkItem(CreateWorkItemRequest) returns (WorkItem) {
option (google.api.method_signature) = "work_item,work_item_id";
}
}

// Request message for `CreateWorkItem` method.
message CreateWorkItemRequest {
// The ID to use for the `WorkItem`, which will become the final
// component of the `WorkItem`s resource name.
//
// This must conform to RFC 1034, with the additional restriction that all
// letters must be lower-case.
string work_item_id = 1 [(google.api.field_behavior) = REQUIRED];

// The `WorkItem` to create.
WorkItem work_item = 2 [(google.api.field_behavior) = REQUIRED];
}

0 comments on commit 80b8c44

Please sign in to comment.