2020-09-29 13:17:59 -07:00
// Copyright (c) HashiCorp, Inc.
2020-07-22 00:14:28 -04:00
// SPDX-License-Identifier: MPL-2.0
2023-02-02 17:15:17 -08:00
2020-06-15 15:22:41 -07:00
syntax = "proto3" ;
package controller.api.services.v1 ;
2020-08-10 17:15:02 -04:00
import "controller/api/resources/groups/v1/group.proto" ;
2020-06-15 15:22:41 -07:00
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" ;
2020-08-10 17:15:02 -04:00
service GroupService {
2024-04-08 13:55:17 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag ) = {
name : "Group service"
description :
"A group is a resource that represents a collection of users that can be "
"treated equally for the purposes of access control. "
"The group service provides endpoints for managing groups in Boundary. "
external_docs : {
url : "https://developer.hashicorp.com/boundary/docs/concepts/domain-model/groups" ;
description : "Read about groups in the Boundary domain model" ;
}
};
2020-07-22 00:14:28 -04:00
// GetGroup returns a stored Group if present. The provided request must
2020-09-29 13:17:59 -07:00
// include the Group id and if it is missing, malformed or referencing a
// non existing resource an error is returned.
2020-06-15 15:22:41 -07:00
rpc GetGroup ( GetGroupRequest ) returns ( GetGroupResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
get : "/v1/groups/{id}"
2020-06-15 15:22:41 -07:00
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Gets a single Group." };
2020-06-15 15:22:41 -07:00
}
2020-09-29 13:17:59 -07:00
// ListGroups returns a list of stored Groups which exist inside the
// provided scope id. If that id is missing, malformed, or
2020-07-22 00:14:28 -04:00
// references a non-existing scope, an error is returned.
2020-06-15 15:22:41 -07:00
rpc ListGroups ( ListGroupsRequest ) returns ( ListGroupsResponse ) {
option ( google.api.http ) = { get : "/v1/groups" };
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Lists all Groups." };
2020-06-15 15:22:41 -07:00
}
2020-09-29 13:17:59 -07:00
// CreateGroup creates and stores a Group in boundary. The provided
// request must include the scope ID in which the Group will be created.
2020-07-22 00:14:28 -04:00
// If the scope ID is missing, malformed or references a non existing
2020-09-29 13:17:59 -07:00
// resource, an error is returned. If a name is provided that is in
// use in another Group in the same scope, an error is returned.
2020-06-15 15:22:41 -07:00
rpc CreateGroup ( CreateGroupRequest ) returns ( CreateGroupResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
post : "/v1/groups"
2020-06-15 15:22:41 -07:00
body : "item"
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Creates a single Group." };
2020-06-15 15:22:41 -07:00
}
2020-09-29 13:17:59 -07:00
// UpdateGroup updates an existing Group in boundary. The provided Group
2020-07-22 00:14:28 -04:00
// 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
2020-09-29 13:17:59 -07:00
// Group. An error is returned if the Group 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 used by another Group in the
// same scope.
2020-06-15 15:22:41 -07:00
rpc UpdateGroup ( UpdateGroupRequest ) returns ( UpdateGroupResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
patch : "/v1/groups/{id}"
2020-06-15 15:22:41 -07:00
body : "item"
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Updates a Group." };
2020-06-15 15:22:41 -07:00
}
2020-09-29 13:17:59 -07:00
// DeleteGroup removes a Group from Boundary. If the provided Group
// ID is malformed or not provided an error is returned.
2020-06-15 15:22:41 -07:00
rpc DeleteGroup ( DeleteGroupRequest ) returns ( DeleteGroupResponse ) {
option ( google.api.http ) = { delete : "/v1/groups/{id}" };
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Deletes a Group." };
2020-06-15 15:22:41 -07:00
}
2020-07-22 15:10:21 -07:00
2020-09-29 13:17:59 -07:00
// AddGroupMembers adds members to a Group. The provided request must include
// the scope id and the Group id which the members will be added to.
// An error is returned if any provided id is missing, malformed or
// references a non-existing resource.
2020-07-22 15:10:21 -07:00
rpc AddGroupMembers ( AddGroupMembersRequest ) returns ( AddGroupMembersResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
post : "/v1/groups/{id}:add-members"
2020-08-18 17:38:38 -07:00
body : "*"
2020-07-22 15:10:21 -07:00
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Adds members to a Group." };
2020-07-22 15:10:21 -07:00
}
2020-09-29 13:17:59 -07:00
// SetGroupMembers sets the Group's members. Any existing members on
// the Group are deleted if they are not included in this request. The provided
// request must include the Group id which the members will be set to.
// An error is returned if any provided id is missing, malformed or
// references a non-existing resource.
2020-07-22 15:10:21 -07:00
rpc SetGroupMembers ( SetGroupMembersRequest ) returns ( SetGroupMembersResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
post : "/v1/groups/{id}:set-members"
2020-08-18 17:38:38 -07:00
body : "*"
2020-07-22 15:10:21 -07:00
response_body : "item"
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Set a Group's members to exactly the list of provided in the request, removing any members that are not specified." };
}
2020-09-29 13:17:59 -07:00
// RemoveGroupMembers removes members from the specified Group.
// The provided request must include the the Group id to which the members
// will be set.
// An error is returned if any provided id is missing, malformed or
// references a non-existing resource.
2020-07-22 15:10:21 -07:00
rpc RemoveGroupMembers ( RemoveGroupMembersRequest ) returns ( RemoveGroupMembersResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
post : "/v1/groups/{id}:remove-members"
2020-08-18 17:38:38 -07:00
body : "*"
2020-07-22 15:10:21 -07:00
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Removes the specified members from a Group." };
2020-07-22 15:10:21 -07:00
}
2020-06-15 15:22:41 -07:00
}
message GetGroupRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-06-15 15:22:41 -07:00
}
message GetGroupResponse {
resources.groups.v1.Group item = 1 ;
}
message ListGroupsRequest {
2023-07-28 12:41:55 -07:00
string scope_id = 1 [ json_name = "scope_id" ]; // @gotags: `class:"public" eventstream:"observation"`
2023-08-24 12:43:52 -07:00
bool recursive = 20 [ json_name = "recursive" ]; // @gotags: `class:"public" eventstream:"observation"`
2024-04-08 13:55:17 -07:00
// You can specify that the filter should only return items that match.
// Refer to [filter expressions](https://developer.hashicorp.com/boundary/docs/concepts/filtering) for more information.
2022-04-08 13:39:06 -04:00
string filter = 30 [ json_name = "filter" ]; // @gotags: `class:"public"`
2023-12-21 12:54:27 -08:00
2024-04-08 13:55:17 -07:00
// An opaque token that Boundary uses to continue an existing iteration or
// request updated items. If you do not specify a token, pagination
// starts from the beginning. To learn more about list pagination
// in Boundary, refer to [list pagination](https://developer.hashicorp.com/boundary/docs/api-clients/api/pagination).
2023-12-21 12:54:27 -08:00
string list_token = 40 [ json_name = "list_token" ]; // @gotags: `class:"public"`
// The maximum size of a page in this iteration.
// If unset, the default page size configured will be used.
// If the page_size is greater than the default page configured,
2024-04-08 13:55:17 -07:00
// the page size will be truncated to this number.
2023-12-21 12:54:27 -08:00
uint32 page_size = 50 [ json_name = "page_size" ]; // @gotags: `class:"public"`
2020-06-15 15:22:41 -07:00
}
message ListGroupsResponse {
repeated resources.groups.v1.Group items = 1 ;
2023-12-21 12:54:27 -08:00
// The type of response, either "delta" or "complete".
// Delta signifies that this is part of a paginated result
// or an update to a previously completed pagination.
// Complete signifies that it is the last page.
string response_type = 2 [ json_name = "response_type" ]; // @gotags: `class:"public"`
// An opaque token used to continue an existing pagination or
// request updated items. Use this token in the next list request
// to request the next page.
string list_token = 3 [ json_name = "list_token" ]; // @gotags: `class:"public"`
// The name of the field which the items are sorted by.
string sort_by = 4 [ json_name = "sort_by" ]; // @gotags: `class:"public"`
// The direction of the sort, either "asc" or "desc".
string sort_dir = 5 [ json_name = "sort_dir" ]; // @gotags: `class:"public"`
// A list of item IDs that have been removed since they were returned
// as part of a pagination. They should be dropped from any client cache.
// This may contain items that are not known to the cache, if they were
// created and deleted between listings.
repeated string removed_ids = 6 [ json_name = "removed_ids" ]; // @gotags: `class:"public"`
// An estimate at the total items available. This may change during pagination.
uint32 est_item_count = 7 [ json_name = "est_item_count" ]; // @gotags: `class:"public"`
2020-06-15 15:22:41 -07:00
}
message CreateGroupRequest {
2020-07-22 00:14:28 -04:00
resources.groups.v1.Group item = 1 ;
2020-06-15 15:22:41 -07:00
}
message CreateGroupResponse {
2023-07-28 12:41:55 -07:00
string uri = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-06-15 15:22:41 -07:00
resources.groups.v1.Group item = 2 ;
}
message UpdateGroupRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-08-18 17:38:38 -07:00
resources.groups.v1.Group item = 2 ;
2020-09-26 08:30:27 -04:00
google.protobuf.FieldMask update_mask = 3 [ json_name = "update_mask" ];
2020-06-15 15:22:41 -07:00
}
message UpdateGroupResponse {
resources.groups.v1.Group item = 1 ;
}
message DeleteGroupRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-06-15 15:22:41 -07:00
}
2020-09-08 23:57:26 -04:00
message DeleteGroupResponse {}
2020-07-22 15:10:21 -07:00
message AddGroupMembersRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-09-29 13:17:59 -07:00
// 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.
2022-04-08 13:39:06 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2023-07-28 12:41:55 -07:00
repeated string member_ids = 3 [ json_name = "member_ids" ]; // @gotags: `class:"public" eventstream:"observation"`
2020-07-22 15:10:21 -07:00
}
message AddGroupMembersResponse {
resources.groups.v1.Group item = 1 ;
}
message SetGroupMembersRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-09-29 13:17:59 -07:00
// 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.
2022-04-08 13:39:06 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2023-07-28 12:41:55 -07:00
repeated string member_ids = 3 [ json_name = "member_ids" ]; // @gotags: `class:"public" eventstream:"observation"`
2020-07-22 15:10:21 -07:00
}
message SetGroupMembersResponse {
resources.groups.v1.Group item = 1 ;
}
message RemoveGroupMembersRequest {
2023-07-28 12:41:55 -07:00
string id = 1 ; // @gotags: `class:"public" eventstream:"observation"`
2020-09-29 13:17:59 -07:00
// 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.
2022-04-08 13:39:06 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2023-07-28 12:41:55 -07:00
repeated string member_ids = 3 [ json_name = "member_ids" ]; // @gotags: `class:"public" eventstream:"observation"`
2020-07-22 15:10:21 -07:00
}
message RemoveGroupMembersResponse {
resources.groups.v1.Group item = 1 ;
}