Documentation
¶
Overview ¶
Package admin provides the administrative API for infrascope, including full CRUD operations for managing organisations (top-level tenants).
The admin module implements the admin/v1 gRPC service defined in proto/infrascope/admin/v1/organisations.proto and exposes it via both gRPC and HTTP (via grpc-gateway).
All endpoints require bearer token authentication configured via the admin.token flag or config file.
Index ¶
- type Admin
- func (a *Admin) CreateOrganisation(ctx context.Context, req *adminv1.CreateOrganisationRequest) (*adminv1.Organisation, error)
- func (a *Admin) DeleteOrganisation(ctx context.Context, req *adminv1.DeleteOrganisationRequest) (*emptypb.Empty, error)
- func (a *Admin) GetOrganisation(ctx context.Context, req *adminv1.GetOrganisationRequest) (*adminv1.Organisation, error)
- func (a *Admin) ListOrganisations(ctx context.Context, req *adminv1.ListOrganisationsRequest) (*adminv1.ListOrganisationsResponse, error)
- func (a *Admin) UpdateOrganisation(ctx context.Context, req *adminv1.UpdateOrganisationRequest) (*adminv1.Organisation, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
services.Service
adminv1.UnimplementedOrganisationsServer
// contains filtered or unexported fields
}
Admin implements the admin/v1 Organisations gRPC service. It provides CRUD operations for organisations with authentication.
func New ¶
New creates a new Admin service instance and registers it with the server. It validates the configuration, sets up CEL filtering for organisations, and registers the gRPC service handlers.
func (*Admin) CreateOrganisation ¶
func (a *Admin) CreateOrganisation(ctx context.Context, req *adminv1.CreateOrganisationRequest) (*adminv1.Organisation, error)
CreateOrganisation creates a new organisation in the database. Requires a valid bearer token and non-empty slug/display_name. Returns the created organisation with generated ID and timestamps.
func (*Admin) DeleteOrganisation ¶
func (a *Admin) DeleteOrganisation(ctx context.Context, req *adminv1.DeleteOrganisationRequest) (*emptypb.Empty, error)
DeleteOrganisation removes an organisation from the database. Name must be in the format "orgs/{slug}". Returns NotFound error if the organisation doesn't exist.
func (*Admin) GetOrganisation ¶
func (a *Admin) GetOrganisation(ctx context.Context, req *adminv1.GetOrganisationRequest) (*adminv1.Organisation, error)
GetOrganisation retrieves a single organisation by its resource name. Name must be in the format "orgs/{slug}". Returns NotFound error if the organisation doesn't exist.
func (*Admin) ListOrganisations ¶
func (a *Admin) ListOrganisations(ctx context.Context, req *adminv1.ListOrganisationsRequest) (*adminv1.ListOrganisationsResponse, error)
ListOrganisations returns a paginated list of all organisations. Uses cursor-based pagination for stable results. Results are ordered by created_at DESC, id DESC. Returns up to page_size organisations and a next_page_token if more exist.
func (*Admin) UpdateOrganisation ¶
func (a *Admin) UpdateOrganisation(ctx context.Context, req *adminv1.UpdateOrganisationRequest) (*adminv1.Organisation, error)
UpdateOrganisation updates specific fields of an organisation using field masks. Only fields specified in update_mask.paths will be updated. Allowed fields: display_name, slug Returns NotFound if organisation doesn't exist, AlreadyExists if new slug conflicts.
type Config ¶
type Config struct {
Token string `yaml:"token"`
// contains filtered or unexported fields
}
Config holds the configuration for the Admin module.
func (*Config) RegisterFlags ¶
RegisterFlags registers Admin configuration flags with the provided FlagSet.