Files
threshold/internal/proto/controller/api/services/v1/role_service.proto
T
Johan Brandhorst-Satzkorn b1d6a1da9a Switch to buf for protobuf generation (#1944)
* Install buf with go install

This reduces the impact of using buf on our dependency
closure, which was significant. It also avoids potential
issues with building buf given our own internal dependency
constraints. This has caused issues (including crashes!)
in the past.

See https://github.com/cockroachdb/cockroach/issues/67216#issuecomment-874176186
for more discussion on using tool dependencies generally, and
https://github.com/bufbuild/buf/issues/52
for an example of where this sort of thing caused an issue for a user.

* Upgrade buf version

We should migrate to v1 sooner rather than later, as it has some
breaking changes from v0.

* Change buf lint/breaking commands

These commands were moved up one level for v1

* Migrate to buf.yaml to v1

* Remove unused imports

These were uncovered by using "buf lint".

* Use buf v1.3.1

* Depend on googleapis and grpc-gateway via BSR

* Switch to buf for proto generation

* Remove third party dependency

* Remove unused tools and scripts

* Move local protos up one level

* Temporarily don't fail on breaking changes

* Generate CI config

* Fix generation of controller.json

* Replace use of deprecated flag

* Remove unused import, regenerate files

* Remove temporary skipping over breaking check
2022-04-04 13:55:42 -04:00

296 lines
10 KiB
Protocol Buffer

syntax = "proto3";
package controller.api.services.v1;
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/roles/v1/role.proto";
service RoleService {
// GetRole returns a stored Role if present. The provided request must include
// the Role ID for the Role being retrieved. If the ID is missing, malformed
// or reference a non-existing resource an error is returned.
rpc GetRole(GetRoleRequest) returns (GetRoleResponse) {
option (google.api.http) = {
get: "/v1/roles/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single Role."
};
}
// ListRoles returns a list of stored Roles which exist inside the scope
// referenced inside the request. The request must include the scope ID for
// the Roles being retrieved. If the scope ID is missing, malformed, or
// reference a non-existing scope, an error is returned.
rpc ListRoles(ListRolesRequest) returns (ListRolesResponse) {
option (google.api.http) = {
get: "/v1/roles"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all Roles."
};
}
// CreateRole creates and stores a Role. The provided request must include the
// scope ID in which the Role will be created. If the scope ID is missing,
// malformed, or references a non-existing scope, an error is returned. If a
// name is provided that is in use in another Role in the same scope, an error
// is returned.
rpc CreateRole(CreateRoleRequest) returns (CreateRoleResponse) {
option (google.api.http) = {
post: "/v1/roles"
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a single Role."
};
}
// UpdateRole updates an existing Role in boundary. The provided
// Role 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 Role. An error is returned if either the scope
// or Role IDs are 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 the same scope.
rpc UpdateRole(UpdateRoleRequest) returns (UpdateRoleResponse) {
option (google.api.http) = {
patch: "/v1/roles/{id}"
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a Role."
};
}
// DeleteRole removes a Role from Boundary. If the provided scope or Role IDs
// are malformed, or not provided an error is returned.
rpc DeleteRole(DeleteRoleRequest) returns (DeleteRoleResponse) {
option (google.api.http) = {
delete: "/v1/roles/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a Role."
};
}
// AddRolePrincipals adds users and/or groups to a Role. The provided request
// must include the Role ID to which the users and/or groups will be added.
// If the Role ID is missing, malformed, or reference non-existing resources,
// an error is returned. An error is also returned if the request attempts to
// add a principal that is already part of the role.
rpc AddRolePrincipals(AddRolePrincipalsRequest) returns (AddRolePrincipalsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:add-principals"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds Users and/or Groups to a Role."
};
}
// SetRolePrincipals sets the Role's users and/or groups. Any existing
// principals on the Role are deleted if they are not included in this
// request. The provided request must include the Role ID on
// which the users and/or groups will be set. If the Role ID is
// missing, malformed, or referencing a non-existing resource, an error is
// returned.
rpc SetRolePrincipals(SetRolePrincipalsRequest) returns (SetRolePrincipalsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:set-principals"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Set Users and/or Groups to a Role, removing any principals that are not specified in the request."
};
}
// RemoveRolePrincipals removes the users and/or groups from the specified
// Role. The provided request must include the Role ID from
// which the users and/or groups will be removed. If that ID is missing,
// malformed, or reference a non-existing resource, an error is returned.
// An error is returned if a remove is called for a principal that is not
// part of the role.
rpc RemoveRolePrincipals(RemoveRolePrincipalsRequest) returns (RemoveRolePrincipalsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:remove-principals"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes the specified Users and/or Groups from a Role."
};
}
// AddRoleGrants adds grants to a Role. The provided request must include
// the Role id which the grants will be added to. An error is returned
// if the provided id is malformed or references a non-existing resource.
rpc AddRoleGrants(AddRoleGrantsRequest) returns (AddRoleGrantsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:add-grants"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds grants to a Role"
};
}
// SetRoleGrants sets the Role's grants. Any existing grants on the Role are
// deleted if they are not included in this request. The provided request must
// include the Role ID on which the grants will be set. If missing, malformed,
// or referencing a non-existing resource, an error is returned.
rpc SetRoleGrants(SetRoleGrantsRequest) returns (SetRoleGrantsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:set-grants"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Set grants for a Role, removing any grants that are not specified in the request."
};
}
// RemoveRoleGrants removes the grants from the specified Role.
// The provided request must include the Role IDs from which the
// grants will be removed. If missing, malformed, or references a non-existing
// resource, an error is returned.
rpc RemoveRoleGrants(RemoveRoleGrantsRequest) returns (RemoveRoleGrantsResponse) {
option (google.api.http) = {
post: "/v1/roles/{id}:remove-grants"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes grants from a Role."
};
}
}
message GetRoleRequest {
string id = 1;
}
message GetRoleResponse {
resources.roles.v1.Role item = 1;
}
message ListRolesRequest {
string scope_id = 1 [json_name="scope_id"];
bool recursive = 20 [json_name="recursive"];
string filter = 30 [json_name="filter"];
}
message ListRolesResponse {
repeated resources.roles.v1.Role items = 1;
}
message CreateRoleRequest {
resources.roles.v1.Role item = 1;
}
message CreateRoleResponse {
string uri = 1;
resources.roles.v1.Role item = 2;
}
message UpdateRoleRequest {
string id = 1;
resources.roles.v1.Role item = 2;
google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"];
}
message UpdateRoleResponse {
resources.roles.v1.Role item = 1;
}
message DeleteRoleRequest {
string id = 1;
}
message DeleteRoleResponse {}
message AddRolePrincipalsRequest {
string id = 1;
// 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;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
message AddRolePrincipalsResponse {
resources.roles.v1.Role item = 1;
}
message SetRolePrincipalsRequest {
string id = 1;
// 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;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
message SetRolePrincipalsResponse {
resources.roles.v1.Role item = 1;
}
message RemoveRolePrincipalsRequest {
string id = 1;
// 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;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
message RemoveRolePrincipalsResponse {
resources.roles.v1.Role item = 1;
}
message AddRoleGrantsRequest {
string id = 1;
// 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;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
message AddRoleGrantsResponse {
resources.roles.v1.Role item = 1;
}
message SetRoleGrantsRequest {
string id = 1;
// 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;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
message SetRoleGrantsResponse {
resources.roles.v1.Role item = 1;
}
message RemoveRoleGrantsRequest {
string id = 1;
// 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;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
message RemoveRoleGrantsResponse {
resources.roles.v1.Role item = 1;
}