212 lines
7.3 KiB
Protocol Buffer
212 lines
7.3 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/users/v1/user.proto";
|
|
|
|
service UserService {
|
|
|
|
// GetUser returns a stored User if present. The provided request
|
|
// must include the scope and user ID for the user being retrieved. If
|
|
// any of those IDs are missing, malformed or reference a non existing
|
|
// resource an error is returned.
|
|
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/users/{id}"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Gets a single User"
|
|
};
|
|
}
|
|
|
|
// ListUsers returns a list of stored users which exist inside the org
|
|
// referenced inside the request. The request must include the scope ID for
|
|
// the users being retrieved. If the scope ID is missing, malformed, or
|
|
// reference a non existing scope, an error is returned.
|
|
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/users"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Lists all Users"
|
|
};
|
|
}
|
|
|
|
// CreateUser creates and stores a user in boundary. The provided
|
|
// request must include the scope id in which the user 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 user in the same scope, an error is returned.
|
|
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/users"
|
|
body: "item"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Creates a single User"
|
|
};
|
|
}
|
|
|
|
// UpdateUser updates an existing user in boundary. The provided
|
|
// user 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 user. An error is returned if either the scope
|
|
// or user 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 scope.
|
|
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/v1/users/{id}"
|
|
body: "item"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Updates a User"
|
|
};
|
|
}
|
|
|
|
// DeleteUser removes a user from Boundary. If the provided scope or user 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 DeleteUser request was
|
|
// received.
|
|
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) {
|
|
option (google.api.http) = {
|
|
delete: "/v1/users/{id}"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Deletes a User"
|
|
};
|
|
}
|
|
|
|
// AddUserAccounts adds users as members to a group. The provided request
|
|
// must include the user id which the account will be added to. If the any
|
|
// of the ids are missing, malformed or references a non
|
|
// existing resource, an error is returned. If any of the accounts are
|
|
// associated with another user an error is returned.
|
|
rpc AddUserAccounts(AddUserAccountsRequest) returns (AddUserAccountsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/users/{id}:add-accounts"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Associates an Account to a User."
|
|
};
|
|
}
|
|
|
|
// SetUserAccounts sets the group's members. Any existing accounts are
|
|
// removed if they are not included in this request. The provided request
|
|
// must include the user ids which the account will be set to. If the user
|
|
// id is missing, malformed or references a non existing resource, an error
|
|
// is returned. If any of the accounts are associated with another
|
|
// user an error is returned.
|
|
rpc SetUserAccounts(SetUserAccountsRequest) returns (SetUserAccountsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/users/{id}:set-accounts"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Set the Accounts associated to the User to exactly the list of provided in the request, removing any Accounts that are not specified."
|
|
};
|
|
}
|
|
|
|
// RemoveUserAccounts removes accounts from the specified user.
|
|
// The provided request must include the user id which the accounts
|
|
// will be removed from. If the provided account id is not associated with the
|
|
// provided user, an error is returned.
|
|
rpc RemoveUserAccounts(RemoveUserAccountsRequest) returns (RemoveUserAccountsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/users/{id}:remove-accounts"
|
|
body: "*"
|
|
response_body: "item"
|
|
};
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Removes the specified Accounts from being associated with the provided User."
|
|
};
|
|
}
|
|
}
|
|
|
|
message GetUserRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message GetUserResponse {
|
|
resources.users.v1.User item = 1;
|
|
}
|
|
|
|
message ListUsersRequest {
|
|
string scope_id = 1;
|
|
}
|
|
|
|
message ListUsersResponse {
|
|
repeated resources.users.v1.User items = 1;
|
|
}
|
|
|
|
message CreateUserRequest {
|
|
resources.users.v1.User item = 1;
|
|
}
|
|
|
|
message CreateUserResponse {
|
|
string uri = 1;
|
|
resources.users.v1.User item = 2;
|
|
}
|
|
|
|
message UpdateUserRequest {
|
|
string id = 1;
|
|
resources.users.v1.User item = 2;
|
|
google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"];
|
|
}
|
|
|
|
message UpdateUserResponse {
|
|
resources.users.v1.User item = 1;
|
|
}
|
|
|
|
message DeleteUserRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message DeleteUserResponse {}
|
|
|
|
message AddUserAccountsRequest {
|
|
string id = 1;
|
|
// The version ensures the user hasn't changed since it was last retrieved and if it has the request will fail.
|
|
uint32 version = 2;
|
|
repeated string account_ids = 3 [json_name="account_ids"];
|
|
}
|
|
|
|
message AddUserAccountsResponse {
|
|
resources.users.v1.User item = 1;
|
|
}
|
|
|
|
message SetUserAccountsRequest {
|
|
string id = 1;
|
|
// The version ensures the user hasn't changed since it was last retrieved and if it has the request will fail.
|
|
uint32 version = 2;
|
|
repeated string account_ids = 3 [json_name="account_ids"];
|
|
}
|
|
|
|
message SetUserAccountsResponse {
|
|
resources.users.v1.User item = 1;
|
|
}
|
|
|
|
message RemoveUserAccountsRequest {
|
|
string id = 1;
|
|
// The version ensures the user hasn't changed since it was last retrieved and if it has the request will fail.
|
|
uint32 version = 2;
|
|
repeated string account_ids = 3 [json_name="account_ids"];
|
|
}
|
|
|
|
message RemoveUserAccountsResponse {
|
|
resources.users.v1.User item = 1;
|
|
}
|