Documentation
¶
Index ¶
- Constants
- func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
- type UnimplementedUserServiceHandler
- func (UnimplementedUserServiceHandler) AddUsersToOrganization(context.Context, *connect.Request[user.AddUsersToOrganizationRequest]) (*connect.Response[user.AddUsersToOrganizationResponse], error)
- func (UnimplementedUserServiceHandler) CreateOrganization(context.Context, *connect.Request[user.CreateOrganizationRequest]) (*connect.Response[user.CreateOrganizationResponse], error)
- func (UnimplementedUserServiceHandler) CreateProject(context.Context, *connect.Request[user.CreateProjectRequest]) (*connect.Response[user.CreateProjectResponse], error)
- func (UnimplementedUserServiceHandler) DeleteOrganization(context.Context, *connect.Request[user.DeleteOrganizationRequest]) (*connect.Response[user.DeleteOrganizationResponse], error)
- func (UnimplementedUserServiceHandler) DeleteProject(context.Context, *connect.Request[user.DeleteProjectRequest]) (*connect.Response[user.DeleteProjectResponse], error)
- func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect.Request[user.DeleteUserRequest]) (*connect.Response[user.DeleteUserResponse], error)
- func (UnimplementedUserServiceHandler) Enroll(context.Context, *connect.Request[user.EnrollRequest]) (*connect.Response[user.EnrollResponse], error)
- func (UnimplementedUserServiceHandler) EnrollMachineUser(context.Context, *connect.Request[user.EnrollMachineUserRequest]) (*connect.Response[user.EnrollMachineUserResponse], error)
- func (UnimplementedUserServiceHandler) GetCallerIdentity(context.Context, *connect.Request[user.GetCallerIdentityRequest]) (*connect.Response[user.GetCallerIdentityResponse], error)
- func (UnimplementedUserServiceHandler) ListAllOrganizations(context.Context, *connect.Request[user.ListAllOrganizationsRequest]) (*connect.Response[user.ListAllOrganizationsResponse], error)
- func (UnimplementedUserServiceHandler) RemoveUsersFromOrganization(context.Context, *connect.Request[user.RemoveUsersFromOrganizationRequest]) (*connect.Response[user.RemoveUsersFromOrganizationResponse], error)
- func (UnimplementedUserServiceHandler) Whoami(context.Context, *connect.Request[user.WhoamiRequest]) (*connect.Response[user.WhoamiResponse], error)
- type UserServiceClient
- type UserServiceHandler
Constants ¶
const ( // UserServiceWhoamiProcedure is the fully-qualified name of the UserService's Whoami RPC. UserServiceWhoamiProcedure = "/stately.user.UserService/Whoami" // UserServiceGetCallerIdentityProcedure is the fully-qualified name of the UserService's // GetCallerIdentity RPC. UserServiceGetCallerIdentityProcedure = "/stately.user.UserService/GetCallerIdentity" // UserServiceEnrollProcedure is the fully-qualified name of the UserService's Enroll RPC. UserServiceEnrollProcedure = "/stately.user.UserService/Enroll" // UserServiceDeleteUserProcedure is the fully-qualified name of the UserService's DeleteUser RPC. UserServiceDeleteUserProcedure = "/stately.user.UserService/DeleteUser" // UserServiceEnrollMachineUserProcedure is the fully-qualified name of the UserService's // EnrollMachineUser RPC. UserServiceEnrollMachineUserProcedure = "/stately.user.UserService/EnrollMachineUser" // UserServiceCreateProjectProcedure is the fully-qualified name of the UserService's CreateProject // RPC. UserServiceCreateProjectProcedure = "/stately.user.UserService/CreateProject" // UserServiceDeleteProjectProcedure is the fully-qualified name of the UserService's DeleteProject // RPC. UserServiceDeleteProjectProcedure = "/stately.user.UserService/DeleteProject" // UserServiceCreateOrganizationProcedure is the fully-qualified name of the UserService's // CreateOrganization RPC. UserServiceCreateOrganizationProcedure = "/stately.user.UserService/CreateOrganization" // UserServiceListAllOrganizationsProcedure is the fully-qualified name of the UserService's // ListAllOrganizations RPC. UserServiceListAllOrganizationsProcedure = "/stately.user.UserService/ListAllOrganizations" // UserServiceDeleteOrganizationProcedure is the fully-qualified name of the UserService's // DeleteOrganization RPC. UserServiceDeleteOrganizationProcedure = "/stately.user.UserService/DeleteOrganization" // UserServiceAddUsersToOrganizationProcedure is the fully-qualified name of the UserService's // AddUsersToOrganization RPC. UserServiceAddUsersToOrganizationProcedure = "/stately.user.UserService/AddUsersToOrganization" // UserServiceRemoveUsersFromOrganizationProcedure is the fully-qualified name of the UserService's // RemoveUsersFromOrganization RPC. UserServiceRemoveUsersFromOrganizationProcedure = "/stately.user.UserService/RemoveUsersFromOrganization" )
These constants are the fully-qualified names of the RPCs defined in this package. They're exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
Note that these are different from the fully-qualified method names used by google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to reflection-formatted method names, remove the leading slash and convert the remaining slash to a period.
const (
// UserServiceName is the fully-qualified name of the UserService service.
UserServiceName = "stately.user.UserService"
)
Variables ¶
This section is empty.
Functions ¶
func NewUserServiceHandler ¶ added in v0.1.1
func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption) (string, http.Handler)
NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path on which to mount the handler and the handler itself.
By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf and JSON codecs. They also support gzip compression.
Types ¶
type UnimplementedUserServiceHandler ¶ added in v0.1.1
type UnimplementedUserServiceHandler struct{}
UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
func (UnimplementedUserServiceHandler) AddUsersToOrganization ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) AddUsersToOrganization(context.Context, *connect.Request[user.AddUsersToOrganizationRequest]) (*connect.Response[user.AddUsersToOrganizationResponse], error)
func (UnimplementedUserServiceHandler) CreateOrganization ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) CreateOrganization(context.Context, *connect.Request[user.CreateOrganizationRequest]) (*connect.Response[user.CreateOrganizationResponse], error)
func (UnimplementedUserServiceHandler) CreateProject ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) CreateProject(context.Context, *connect.Request[user.CreateProjectRequest]) (*connect.Response[user.CreateProjectResponse], error)
func (UnimplementedUserServiceHandler) DeleteOrganization ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) DeleteOrganization(context.Context, *connect.Request[user.DeleteOrganizationRequest]) (*connect.Response[user.DeleteOrganizationResponse], error)
func (UnimplementedUserServiceHandler) DeleteProject ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) DeleteProject(context.Context, *connect.Request[user.DeleteProjectRequest]) (*connect.Response[user.DeleteProjectResponse], error)
func (UnimplementedUserServiceHandler) DeleteUser ¶ added in v0.2.2
func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect.Request[user.DeleteUserRequest]) (*connect.Response[user.DeleteUserResponse], error)
func (UnimplementedUserServiceHandler) Enroll ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) Enroll(context.Context, *connect.Request[user.EnrollRequest]) (*connect.Response[user.EnrollResponse], error)
func (UnimplementedUserServiceHandler) EnrollMachineUser ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) EnrollMachineUser(context.Context, *connect.Request[user.EnrollMachineUserRequest]) (*connect.Response[user.EnrollMachineUserResponse], error)
func (UnimplementedUserServiceHandler) GetCallerIdentity ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) GetCallerIdentity(context.Context, *connect.Request[user.GetCallerIdentityRequest]) (*connect.Response[user.GetCallerIdentityResponse], error)
func (UnimplementedUserServiceHandler) ListAllOrganizations ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) ListAllOrganizations(context.Context, *connect.Request[user.ListAllOrganizationsRequest]) (*connect.Response[user.ListAllOrganizationsResponse], error)
func (UnimplementedUserServiceHandler) RemoveUsersFromOrganization ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) RemoveUsersFromOrganization(context.Context, *connect.Request[user.RemoveUsersFromOrganizationRequest]) (*connect.Response[user.RemoveUsersFromOrganizationResponse], error)
func (UnimplementedUserServiceHandler) Whoami ¶ added in v0.1.1
func (UnimplementedUserServiceHandler) Whoami(context.Context, *connect.Request[user.WhoamiRequest]) (*connect.Response[user.WhoamiResponse], error)
type UserServiceClient ¶ added in v0.1.1
type UserServiceClient interface {
// Whoami returns information about the user that calls it (based on the auth
// token). This includes information about what organizations the user belongs
// to, what projects they have access to, what roles(?) they can use, etc.
// This is meant to be called from the Web Console or CLI in order to populate
// some basic information in the UI and allow calling other APIs like
// ListStores. It will return a NotFound error if the user does not exist -
// you can call Enroll to create the user and then try again.
Whoami(context.Context, *connect.Request[user.WhoamiRequest]) (*connect.Response[user.WhoamiResponse], error)
// GetCallerIdentity returns the Stately UserID of the caller.
// This simple API is meant for testing execution environments to ensure that the
// client is correctly authenticated.
// If the caller is not enrolled in Stately then NotFound will be returned.
GetCallerIdentity(context.Context, *connect.Request[user.GetCallerIdentityRequest]) (*connect.Response[user.GetCallerIdentityResponse], error)
// Enroll bootstraps a new User given a service principal ID from an auth
// provider. This includes creating a user record for them, and a default
// organization, project, and store for them to use. User information is
// automatically read from the auth token.
Enroll(context.Context, *connect.Request[user.EnrollRequest]) (*connect.Response[user.EnrollResponse], error)
// DeleteUser deletes a user from Stately's system. This also removes them
// from all organizations. This will fail if the user does not exist, or if
// you do not have permission to delete users. It is safe to retry this
// operation.
DeleteUser(context.Context, *connect.Request[user.DeleteUserRequest]) (*connect.Response[user.DeleteUserResponse], error)
// EnrollMachineUser bootstraps a new machine user principal ID from an auth
// provider and enrolls them in the organization ID which was passed in the
// request. Once a machine user has been enrolled in one organization, it
// cannot be in any other organization unless it is removed from the first
// one. ** THIS IS AN ADMIN ONLY API **
EnrollMachineUser(context.Context, *connect.Request[user.EnrollMachineUserRequest]) (*connect.Response[user.EnrollMachineUserResponse], error)
// CreateProject makes a new project within an organization. It will fail if
// the project already exists or you don't have permission to create projects
// in that organization.
CreateProject(context.Context, *connect.Request[user.CreateProjectRequest]) (*connect.Response[user.CreateProjectResponse], error)
// DeleteProject schedules a project to be deleted, including all data within it.
// This operation takes some time so it returns a handle to an operation that
// you can check to see if it is complete. This will fail if the project does
// not exist, if the project is already being deleted, or if you do not have
// permission to delete project.
DeleteProject(context.Context, *connect.Request[user.DeleteProjectRequest]) (*connect.Response[user.DeleteProjectResponse], error)
// CreateOrganization makes a new organization, optionally including the
// current user as a member. It will fail if you don't have permission to
// create organizations. Note that it is currently possible to create multiple
// orgs with the same name.
CreateOrganization(context.Context, *connect.Request[user.CreateOrganizationRequest]) (*connect.Response[user.CreateOrganizationResponse], error)
// ListAllOrganizations lists all the organizations registered with Stately.
// It will fail if you don't have permission to list all organizations (only
// admins have this). This includes information about all the members and
// resources in each organization.
ListAllOrganizations(context.Context, *connect.Request[user.ListAllOrganizationsRequest]) (*connect.Response[user.ListAllOrganizationsResponse], error)
// DeleteOrganization deletes an organization, including all data within it.
// This will fail if the organization does not exist, or if you do not have
// permission to delete the organization. It is safe to retry this operation.
DeleteOrganization(context.Context, *connect.Request[user.DeleteOrganizationRequest]) (*connect.Response[user.DeleteOrganizationResponse], error)
// AddUsersToOrganization adds users to an organization. This will fail if the
// organization does not exist, or if you do not have permission to update the
// organization. It is a noop if the user is already in the organization.
AddUsersToOrganization(context.Context, *connect.Request[user.AddUsersToOrganizationRequest]) (*connect.Response[user.AddUsersToOrganizationResponse], error)
// RemoveUsersFromOrganization removes users from an organization. This will
// fail if the organization does not exist, or if you do not have permission
// to update the organization. It is a noop if the user is not in the
// organization.
RemoveUsersFromOrganization(context.Context, *connect.Request[user.RemoveUsersFromOrganizationRequest]) (*connect.Response[user.RemoveUsersFromOrganizationResponse], error)
}
UserServiceClient is a client for the stately.user.UserService service.
func NewUserServiceClient ¶ added in v0.1.1
func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) UserServiceClient
NewUserServiceClient constructs a client for the stately.user.UserService service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
The URL supplied here should be the base URL for the Connect or gRPC server (for example, http://api.acme.com or https://acme.com/grpc).
type UserServiceHandler ¶ added in v0.1.1
type UserServiceHandler interface {
// Whoami returns information about the user that calls it (based on the auth
// token). This includes information about what organizations the user belongs
// to, what projects they have access to, what roles(?) they can use, etc.
// This is meant to be called from the Web Console or CLI in order to populate
// some basic information in the UI and allow calling other APIs like
// ListStores. It will return a NotFound error if the user does not exist -
// you can call Enroll to create the user and then try again.
Whoami(context.Context, *connect.Request[user.WhoamiRequest]) (*connect.Response[user.WhoamiResponse], error)
// GetCallerIdentity returns the Stately UserID of the caller.
// This simple API is meant for testing execution environments to ensure that the
// client is correctly authenticated.
// If the caller is not enrolled in Stately then NotFound will be returned.
GetCallerIdentity(context.Context, *connect.Request[user.GetCallerIdentityRequest]) (*connect.Response[user.GetCallerIdentityResponse], error)
// Enroll bootstraps a new User given a service principal ID from an auth
// provider. This includes creating a user record for them, and a default
// organization, project, and store for them to use. User information is
// automatically read from the auth token.
Enroll(context.Context, *connect.Request[user.EnrollRequest]) (*connect.Response[user.EnrollResponse], error)
// DeleteUser deletes a user from Stately's system. This also removes them
// from all organizations. This will fail if the user does not exist, or if
// you do not have permission to delete users. It is safe to retry this
// operation.
DeleteUser(context.Context, *connect.Request[user.DeleteUserRequest]) (*connect.Response[user.DeleteUserResponse], error)
// EnrollMachineUser bootstraps a new machine user principal ID from an auth
// provider and enrolls them in the organization ID which was passed in the
// request. Once a machine user has been enrolled in one organization, it
// cannot be in any other organization unless it is removed from the first
// one. ** THIS IS AN ADMIN ONLY API **
EnrollMachineUser(context.Context, *connect.Request[user.EnrollMachineUserRequest]) (*connect.Response[user.EnrollMachineUserResponse], error)
// CreateProject makes a new project within an organization. It will fail if
// the project already exists or you don't have permission to create projects
// in that organization.
CreateProject(context.Context, *connect.Request[user.CreateProjectRequest]) (*connect.Response[user.CreateProjectResponse], error)
// DeleteProject schedules a project to be deleted, including all data within it.
// This operation takes some time so it returns a handle to an operation that
// you can check to see if it is complete. This will fail if the project does
// not exist, if the project is already being deleted, or if you do not have
// permission to delete project.
DeleteProject(context.Context, *connect.Request[user.DeleteProjectRequest]) (*connect.Response[user.DeleteProjectResponse], error)
// CreateOrganization makes a new organization, optionally including the
// current user as a member. It will fail if you don't have permission to
// create organizations. Note that it is currently possible to create multiple
// orgs with the same name.
CreateOrganization(context.Context, *connect.Request[user.CreateOrganizationRequest]) (*connect.Response[user.CreateOrganizationResponse], error)
// ListAllOrganizations lists all the organizations registered with Stately.
// It will fail if you don't have permission to list all organizations (only
// admins have this). This includes information about all the members and
// resources in each organization.
ListAllOrganizations(context.Context, *connect.Request[user.ListAllOrganizationsRequest]) (*connect.Response[user.ListAllOrganizationsResponse], error)
// DeleteOrganization deletes an organization, including all data within it.
// This will fail if the organization does not exist, or if you do not have
// permission to delete the organization. It is safe to retry this operation.
DeleteOrganization(context.Context, *connect.Request[user.DeleteOrganizationRequest]) (*connect.Response[user.DeleteOrganizationResponse], error)
// AddUsersToOrganization adds users to an organization. This will fail if the
// organization does not exist, or if you do not have permission to update the
// organization. It is a noop if the user is already in the organization.
AddUsersToOrganization(context.Context, *connect.Request[user.AddUsersToOrganizationRequest]) (*connect.Response[user.AddUsersToOrganizationResponse], error)
// RemoveUsersFromOrganization removes users from an organization. This will
// fail if the organization does not exist, or if you do not have permission
// to update the organization. It is a noop if the user is not in the
// organization.
RemoveUsersFromOrganization(context.Context, *connect.Request[user.RemoveUsersFromOrganizationRequest]) (*connect.Response[user.RemoveUsersFromOrganizationResponse], error)
}
UserServiceHandler is an implementation of the stately.user.UserService service.