Create the Worker API resource and the CRUDL operation definitions for a worker. (#2114)
This commit is contained in:
7 files changed
+2790
No files matched your search
@@ -0,0 +1,91 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.resources.workers.v1;
|
||||
|
||||
import "controller/api/resources/scopes/v1/scope.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/workers;workers";
|
||||
|
||||
// WorkerConfig contains configuration values reported by the worker daemon.
|
||||
message WorkerConfig {
|
||||
// Output only. The address the worker daemon reports itself as reachable at.
|
||||
string address = 10;
|
||||
|
||||
// Output only. The name the worker daemon reports itself having.
|
||||
string name = 20;
|
||||
|
||||
// Output only. The boundary version the worker has reported itself as running.
|
||||
string version = 30;
|
||||
|
||||
// Output only. The tags reporteed by the worker daemon.
|
||||
map<string, google.protobuf.ListValue> tags = 40;
|
||||
}
|
||||
|
||||
// Worker contains all fields related to a Worker resource
|
||||
message Worker {
|
||||
// Output only. The ID of the User.
|
||||
string id = 10; // @gotags: `class:"public"`
|
||||
|
||||
// The ID of the Scope this resource is in.
|
||||
string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. Scope information for this resource.
|
||||
resources.scopes.v1.ScopeInfo scope = 30;
|
||||
|
||||
// Optional name for identification purposes.
|
||||
google.protobuf.StringValue name = 40 [
|
||||
(custom_options.v1.generate_sdk_option) = true,
|
||||
(custom_options.v1.mask_mapping) = {
|
||||
this: "name"
|
||||
that: "name"
|
||||
}
|
||||
]; // @gotags: `class:"sensitive"`
|
||||
|
||||
// Optional user-set description for identification purposes.
|
||||
google.protobuf.StringValue description = 50 [
|
||||
(custom_options.v1.generate_sdk_option) = true,
|
||||
(custom_options.v1.mask_mapping) = {
|
||||
this: "description"
|
||||
that: "description"
|
||||
}
|
||||
]; // @gotags: `class:"sensitive"`
|
||||
|
||||
// Output only. The time this resource was created.
|
||||
google.protobuf.Timestamp created_time = 60 [json_name = "created_time"]; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. The time this resource was last updated.
|
||||
google.protobuf.Timestamp updated_time = 70 [json_name = "updated_time"]; // @gotags: `class:"public"`
|
||||
|
||||
// Version is used in mutation requests, after the initial creation, to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 80; // @gotags: `class:"public"`
|
||||
|
||||
// The address that this worker is reachable at.
|
||||
google.protobuf.StringValue address = 90; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. This is the address used by authorized session. The value
|
||||
// is the same as the address field if set. Otherwise it uses the address the
|
||||
// worker reports.
|
||||
string canonical_address = 100; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. The tags attached to this worker.
|
||||
map<string, google.protobuf.ListValue> tags = 110; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. The deduplicated union of the tags reported by the worker and
|
||||
// the tags added through the user facing api. This is used when applying
|
||||
// worker filters.
|
||||
map<string, google.protobuf.ListValue> canonical_tags = 120; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. The time this worker daemon last reported its status.
|
||||
google.protobuf.Timestamp last_status_time = 130 [json_name = "last_status_time"]; // @gotags: `class:"public"`
|
||||
|
||||
// Output only. The set of information the worker daemon has reported about
|
||||
// itself.
|
||||
WorkerConfig worker_config = 140 [json_name = "worker_config"];
|
||||
|
||||
// TODO: Add worker auth related fields.
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.services.v1;
|
||||
|
||||
import "controller/api/resources/workers/v1/worker.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services";
|
||||
|
||||
service WorkerService {
|
||||
// GetWorker returns a stored Worker if present. The provided request
|
||||
// must include the Worker ID for the Worker being retrieved. If
|
||||
// that ID is missing, malformed or reference a non existing
|
||||
// resource an error is returned.
|
||||
rpc GetWorker(GetWorkerRequest) returns (GetWorkerResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/workers/{id}"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Gets a single Worker."
|
||||
};
|
||||
}
|
||||
|
||||
// ListWorkers returns a list of stored Workers which exist inside the provided
|
||||
// scope. The request must include the scope ID for the Workers being listed.
|
||||
// If the scope ID is missing, malformed, or reference a non existing scope,
|
||||
// an error is returned.
|
||||
rpc ListWorkers(ListWorkersRequest) returns (ListWorkersResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/workers"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Lists all Workers."
|
||||
};
|
||||
}
|
||||
|
||||
// CreateWorker creates and stores a Worker in boundary. The provided
|
||||
// request must include the Scope id in which the Worker will be created.
|
||||
// If the Scope id is missing, malformed or references a non existing
|
||||
// resource, an error is returned. If a name is provided that is in
|
||||
// use in another Worker in the same scope, an error is returned.
|
||||
rpc CreateWorker(CreateWorkerRequest) returns (CreateWorkerResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/workers"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Creates a single Worker."
|
||||
};
|
||||
}
|
||||
|
||||
// UpdateWorker updates an existing Worker in boundary. The provided
|
||||
// Worker must not have any read only fields set. The update mask must be
|
||||
// included in the request and contain at least 1 mutable field. To unset
|
||||
// a field's value, include the field in the update mask and don't set it
|
||||
// in the provided Worker. An error is returned if either the Worker id is
|
||||
// missing or reference a non existing resource. An error is also returned
|
||||
// if the request attempts to update the name to one that is already in use
|
||||
// in this Scope.
|
||||
rpc UpdateWorker(UpdateWorkerRequest) returns (UpdateWorkerResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/workers/{id}"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Updates a Worker."
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteWorker removes a Worker from Boundary. If the provided Worker ID
|
||||
// is malformed or not provided an error is returned.
|
||||
rpc DeleteWorker(DeleteWorkerRequest) returns (DeleteWorkerResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/workers/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Deletes a Worker."
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetWorkerRequest {
|
||||
string id = 1; // @gotags: `class:"public"`
|
||||
}
|
||||
|
||||
message GetWorkerResponse {
|
||||
resources.workers.v1.Worker item = 1;
|
||||
}
|
||||
|
||||
message ListWorkersRequest {
|
||||
string scope_id = 1; // @gotags: `class:"public"`
|
||||
bool recursive = 20 [json_name = "recursive"]; // @gotags: `class:"public"`
|
||||
string filter = 30 [json_name = "filter"]; // @gotags: `class:"sensitive"`
|
||||
}
|
||||
|
||||
message ListWorkersResponse {
|
||||
repeated resources.workers.v1.Worker items = 1;
|
||||
}
|
||||
|
||||
message CreateWorkerRequest {
|
||||
resources.workers.v1.Worker item = 1;
|
||||
}
|
||||
|
||||
message CreateWorkerResponse {
|
||||
string uri = 1; // @gotags: `class:"public"`
|
||||
resources.workers.v1.Worker item = 2;
|
||||
}
|
||||
|
||||
message UpdateWorkerRequest {
|
||||
string id = 1; // @gotags: `class:"public"`
|
||||
resources.workers.v1.Worker item = 2;
|
||||
google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"];
|
||||
}
|
||||
|
||||
message UpdateWorkerResponse {
|
||||
resources.workers.v1.Worker item = 1;
|
||||
}
|
||||
|
||||
message DeleteWorkerRequest {
|
||||
string id = 1; // @gotags: `class:"public"`
|
||||
}
|
||||
|
||||
message DeleteWorkerResponse {}
|
||||
Reference in new issue
Block a user