admin

package
v0.0.0-...-624bb30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

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

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

func New(logger log.Logger, cfg Config, store *store.Store, server *server.Server) (*Admin, error)

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

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

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers Admin configuration flags with the provided FlagSet.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks whether the Admin configuration is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL