This adds an action to the API that allows pulling out an activation token that can be given to a worker in its config (directly or via env or file). The worker can pass this along with its normal request in place of its normal nonce and the server will automatically accept it. Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
233 lines
8.4 KiB
Protocol Buffer
233 lines
8.4 KiB
Protocol Buffer
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 "google/protobuf/struct.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."
|
|
};
|
|
}
|
|
|
|
// CreateWorkerLed 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 CreateWorkerLed(CreateWorkerLedRequest) returns (CreateWorkerLedResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/workers:create:worker-led"
|
|
body: "item"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Creates a single Worker."
|
|
};
|
|
}
|
|
|
|
// CreateControllerLed creates and stores a Worker in Boundary and returns an
|
|
// activation token that can be used by a worker binary to claim the created
|
|
// Worker's identity. 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 CreateControllerLed(CreateControllerLedRequest) returns (CreateControllerLedResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/workers:create:controller-led"
|
|
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."
|
|
};
|
|
}
|
|
|
|
// AddWorkerTags adds api tags to an existing Worker. If missing, malformed,
|
|
// or referencing a non-existing resource, an error is returned.
|
|
rpc AddWorkerTags(AddWorkerTagsRequest) returns (AddWorkerTagsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/workers/{id}:add-worker-tags"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Adds api tags to an existing Worker."
|
|
};
|
|
}
|
|
|
|
// SetWorkerTags sets api tags for an existing Worker. Any existing tags are overridden
|
|
// if they are not included in this request. If missing, malformed, or referencing a
|
|
// non-existing resource, an error is returned.
|
|
rpc SetWorkerTags(SetWorkerTagsRequest) returns (SetWorkerTagsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/workers/{id}:set-worker-tags"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Sets api tags for an existing Worker."
|
|
};
|
|
}
|
|
|
|
// RemoveWorkerTags removes api tags from an existing Worker. If missing, malformed,
|
|
// or referencing a non-existing resource, an error is returned.
|
|
rpc RemoveWorkerTags(RemoveWorkerTagsRequest) returns (RemoveWorkerTagsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/workers/{id}:remove-worker-tags"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Removes api tags from an existing 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 CreateWorkerLedRequest {
|
|
resources.workers.v1.Worker item = 1;
|
|
}
|
|
|
|
message CreateWorkerLedResponse {
|
|
string uri = 1; // @gotags: `class:"public"`
|
|
resources.workers.v1.Worker item = 2;
|
|
}
|
|
|
|
message CreateControllerLedRequest {
|
|
resources.workers.v1.Worker item = 1;
|
|
}
|
|
|
|
message CreateControllerLedResponse {
|
|
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 {}
|
|
|
|
message AddWorkerTagsRequest {
|
|
string id = 1; // @gotags: `class:"public"`
|
|
// Version is used to ensure this resource has not changed.
|
|
// The mutation will fail if the version does not match the latest known good version.
|
|
uint32 version = 2; // @gotags: `class:"public"`
|
|
map<string, google.protobuf.ListValue> api_tags = 3 [json_name = "api_tags"]; // @gotags: `class:"public"`
|
|
}
|
|
|
|
message AddWorkerTagsResponse {
|
|
resources.workers.v1.Worker item = 1;
|
|
}
|
|
|
|
message SetWorkerTagsRequest {
|
|
string id = 1; // @gotags: `class:"public"`
|
|
// Version is used to ensure this resource has not changed.
|
|
// The mutation will fail if the version does not match the latest known good version.
|
|
uint32 version = 2; // @gotags: `class:"public"`
|
|
map<string, google.protobuf.ListValue> api_tags = 3 [json_name = "api_tags"]; // @gotags: `class:"public"`
|
|
}
|
|
|
|
message SetWorkerTagsResponse {
|
|
resources.workers.v1.Worker item = 1;
|
|
}
|
|
|
|
message RemoveWorkerTagsRequest {
|
|
string id = 1; // @gotags: `class:"public"`
|
|
// Version is used to ensure this resource has not changed.
|
|
// The mutation will fail if the version does not match the latest known good version.
|
|
uint32 version = 2; // @gotags: `class:"public"`
|
|
map<string, google.protobuf.ListValue> api_tags = 3 [json_name = "api_tags"]; // @gotags: `class:"public"`
|
|
}
|
|
|
|
message RemoveWorkerTagsResponse {
|
|
resources.workers.v1.Worker item = 1;
|
|
}
|