* Adding project level scopes for groups and roles. * Adding tests to verify the routes are working as expected.
164 lines
5.2 KiB
Protocol Buffer
164 lines
5.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package controller.api.services.v1;
|
|
|
|
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/services;services";
|
|
|
|
import "protoc-gen-swagger/options/annotations.proto";
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/field_mask.proto";
|
|
import "controller/api/resources/groups/v1/group.proto";
|
|
|
|
service GroupService {
|
|
|
|
// GetGroup returns a stored Group if present. The provided request
|
|
// must include the org and group id for the group being retrieved. If
|
|
// any of those ids are missing, malformed or reference a non existing
|
|
// resource an error is returned.
|
|
rpc GetGroup(GetGroupRequest) returns (GetGroupResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/orgs/{org_id}/groups/{id}"
|
|
response_body: "item"
|
|
additional_bindings {
|
|
get: "/v1/orgs/{org_id}/projects/{project_id}/groups/{id}"
|
|
response_body: "item"
|
|
}
|
|
};
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
|
|
summary: "Gets a single Group"
|
|
};
|
|
}
|
|
|
|
// ListGroups returns a list of stored groups which exist inside the org
|
|
// referenced inside the request. The request must include the org id for
|
|
// the groups being retrieved. If the org id is missing, malformed, or
|
|
// reference a non existing organization, an error is returned.
|
|
rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/orgs/{org_id}/groups"
|
|
additional_bindings {
|
|
get: "/v1/orgs/{org_id}/projects/{project_id}/groups"
|
|
}
|
|
};
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
|
|
summary: "Lists all Groups"
|
|
};
|
|
}
|
|
|
|
// CreateGroup creates and stores a group in watchtower. The provided
|
|
// request must include the org id in which the group will be created.
|
|
// If the org id is missing, malformed or references a non existing
|
|
// organization, an error is returned. If a name is provided that is in
|
|
// use in another group in the same organization, an error is returned.
|
|
rpc CreateGroup(CreateGroupRequest) returns (CreateGroupResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/orgs/{org_id}/groups"
|
|
body: "item"
|
|
response_body: "item"
|
|
additional_bindings {
|
|
post: "/v1/orgs/{org_id}/projects/{project_id}/groups"
|
|
body: "item"
|
|
response_body: "item"
|
|
}
|
|
};
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
|
|
summary: "Creates a single Group"
|
|
};
|
|
}
|
|
|
|
// UpdateGroup updates an existing group in watchtower. The provided
|
|
// group 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 group. An error is returned if either the organization
|
|
// or group 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 this organization.
|
|
rpc UpdateGroup(UpdateGroupRequest) returns (UpdateGroupResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/v1/orgs/{org_id}/groups/{id}"
|
|
body: "item"
|
|
response_body: "item"
|
|
additional_bindings {
|
|
patch: "/v1/orgs/{org_id}/projects/{project_id}/groups/{id}"
|
|
body: "item"
|
|
response_body: "item"
|
|
}
|
|
};
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
|
|
summary: "Updates a Group"
|
|
};
|
|
}
|
|
|
|
// DeleteGroup removes a group from Watchtower. If the provided org or group ids
|
|
// are malformed or not provided an error is returned. No error is returned
|
|
// if either ids reference resources that do not exist as the response itself
|
|
// specifies if the resource existed before the DeleteGroup request was
|
|
// received.
|
|
rpc DeleteGroup(DeleteGroupRequest) returns (DeleteGroupResponse) {
|
|
option (google.api.http) = {
|
|
delete: "/v1/orgs/{org_id}/groups/{id}"
|
|
additional_bindings {
|
|
delete: "/v1/orgs/{org_id}/projects/{project_id}/groups/{id}"
|
|
}
|
|
};
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
|
|
summary: "Deletes a Group"
|
|
};
|
|
}
|
|
}
|
|
|
|
message GetGroupRequest {
|
|
string org_id = 1;
|
|
string project_id = 2;
|
|
string id = 3;
|
|
string view = 4;
|
|
}
|
|
|
|
message GetGroupResponse {
|
|
resources.groups.v1.Group item = 1;
|
|
}
|
|
|
|
message ListGroupsRequest {
|
|
string org_id = 1;
|
|
string project_id = 2;
|
|
string view = 3;
|
|
}
|
|
|
|
message ListGroupsResponse {
|
|
repeated resources.groups.v1.Group items = 1;
|
|
}
|
|
|
|
message CreateGroupRequest {
|
|
string org_id = 1;
|
|
string project_id = 2;
|
|
resources.groups.v1.Group item = 3;
|
|
}
|
|
|
|
message CreateGroupResponse {
|
|
string uri = 1;
|
|
resources.groups.v1.Group item = 2;
|
|
}
|
|
|
|
message UpdateGroupRequest {
|
|
string org_id = 1;
|
|
string project_id = 2;
|
|
string id = 3;
|
|
resources.groups.v1.Group item = 4;
|
|
google.protobuf.FieldMask update_mask = 5;
|
|
}
|
|
|
|
message UpdateGroupResponse {
|
|
resources.groups.v1.Group item = 1;
|
|
}
|
|
|
|
message DeleteGroupRequest {
|
|
string org_id = 1;
|
|
string project_id = 2;
|
|
string id = 3;
|
|
}
|
|
|
|
message DeleteGroupResponse {
|
|
bool existed = 1;
|
|
}
|