Documentation
¶
Index ¶
- Variables
- type API
- type APIServices
- type AccountService
- func (s *AccountService) Create(ctx context.Context, input CreateAccountInput) (*domain.Account, error)
- func (s *AccountService) Get(ctx context.Context, accountID domain.AccountID) (*domain.Account, error)
- func (s *AccountService) List(ctx context.Context, organizationID domain.OrganizationID) ([]domain.Account, error)
- type Accounts
- type Client
- type ConversationService
- func (s *ConversationService) Create(ctx context.Context, input CreateConversationInput) (*domain.Conversation, error)
- func (s *ConversationService) Delete(ctx context.Context, id domain.ConversationID) error
- func (s *ConversationService) Update(ctx context.Context, id domain.ConversationID, input UpdateConversationInput) (*domain.Conversation, error)
- type Conversations
- type CreateAccountInput
- type CreateConversationInput
- type CreateDatadogAccountInput
- type CreateOrganizationInput
- type DatadogAccount
- type DatadogAccountService
- func (s *DatadogAccountService) CreateAccount(ctx context.Context, input CreateDatadogAccountInput) (*DatadogAccount, error)
- func (s *DatadogAccountService) GetAccount(ctx context.Context, accountID string) (*DatadogAccount, error)
- func (s *DatadogAccountService) GetStatus(ctx context.Context, datadogAccountID string) (*DatadogAccountStatus, error)
- func (s *DatadogAccountService) HasAccount(ctx context.Context, accountID string) (bool, error)
- func (s *DatadogAccountService) ValidateAPIKey(ctx context.Context, input ValidateAPIKeyInput) (bool, string, error)
- type DatadogAccountStatus
- type DatadogAccountStatusState
- type DatadogAccounts
- type MessageService
- type Messages
- type OrderDirection
- type OrganizationBootstrapResult
- type OrganizationService
- type Organizations
- type ServiceService
- type Services
- type UpdateConversationInput
- type ValidateAPIKeyInput
- type WorkspaceService
- type Workspaces
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound indicates the requested resource does not exist. ErrNotFound = errors.New("not found") // ErrAlreadyExists indicates the resource already exists. ErrAlreadyExists = errors.New("already exists") )
Sentinel errors for API responses. Use errors.Is() to check for these error types.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Organizations *OrganizationService
Accounts *AccountService
DatadogAccounts *DatadogAccountService
Services *ServiceService
}
API bundles all control plane API services. It provides a single entry point for all API-related operations.
type APIServices ¶
type APIServices struct {
Organizations Organizations
Accounts Accounts
Workspaces Workspaces
DatadogAccounts DatadogAccounts
Conversations Conversations
Messages Messages
// contains filtered or unexported fields
}
APIServices aggregates all API services for easy dependency injection. This is the primary public interface for interacting with the Tero API.
func NewAPIServices ¶
func NewAPIServices(client Client, scope log.Scope) APIServices
NewAPIServices creates all API services from the given client. Use this constructor when you need to inject a mock client for testing.
func NewServices ¶
NewServices creates APIServices with an internally-managed client. This is the preferred constructor for production use.
func (APIServices) RawQuery ¶
func (s APIServices) RawQuery(ctx context.Context, query string, variables map[string]interface{}) (map[string]interface{}, error)
RawQuery executes an arbitrary GraphQL query (for debugging).
func (APIServices) SetAccountID ¶
func (s APIServices) SetAccountID(accountID domain.AccountID)
SetAccountID sets the account ID header for scoped requests.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService handles account-related API operations.
func NewAccountService ¶
func NewAccountService(client Client, scope log.Scope) *AccountService
NewAccountService creates a new account service.
func (*AccountService) Create ¶
func (s *AccountService) Create(ctx context.Context, input CreateAccountInput) (*domain.Account, error)
Create creates a new account with the given client-provided ID.
func (*AccountService) Get ¶
func (s *AccountService) Get(ctx context.Context, accountID domain.AccountID) (*domain.Account, error)
Get fetches a single account by ID. Returns nil if not found.
func (*AccountService) List ¶
func (s *AccountService) List(ctx context.Context, organizationID domain.OrganizationID) ([]domain.Account, error)
List fetches all accounts for an organization.
type Accounts ¶
type Accounts interface {
List(ctx context.Context, organizationID domain.OrganizationID) ([]domain.Account, error)
Get(ctx context.Context, accountID domain.AccountID) (*domain.Account, error)
Create(ctx context.Context, input CreateAccountInput) (*domain.Account, error)
}
Accounts provides access to accounts.
type Client ¶
type Client interface {
// SetAccountID sets the account ID header for scoped requests.
SetAccountID(accountID domain.AccountID)
// RawQuery executes an arbitrary GraphQL query (for debugging).
RawQuery(ctx context.Context, query string, variables map[string]interface{}) (map[string]interface{}, error)
// Organization operations
ListOrganizations(ctx context.Context) (*gen.ListOrganizationsResponse, error)
CreateOrganizationAndBootstrap(ctx context.Context, input gen.CreateOrganizationInput) (*gen.CreateOrganizationAndBootstrapResponse, error)
// Account operations
ListAccounts(ctx context.Context, organizationID string) (*gen.ListAccountsResponse, error)
CreateAccount(ctx context.Context, input gen.CreateAccountInput) (*gen.CreateAccountResponse, error)
GetAccount(ctx context.Context, accountID string) (*gen.GetAccountResponse, error)
// Datadog operations
ValidateDatadogApiKey(ctx context.Context, input gen.ValidateDatadogApiKeyInput) (*gen.ValidateDatadogApiKeyResponse, error)
CreateDatadogAccountWithCredentials(ctx context.Context, input gen.CreateDatadogAccountWithCredentialsInput) (*gen.CreateDatadogAccountWithCredentialsResponse, error)
GetDatadogAccountStatus(ctx context.Context, id string) (*gen.GetDatadogAccountStatusResponse, error)
// Workspace operations
ListWorkspaces(ctx context.Context, accountID string) (*gen.ListWorkspacesResponse, error)
// Conversation operations
CreateConversation(ctx context.Context, input gen.CreateConversationInput) (*gen.CreateConversationResponse, error)
UpdateConversation(ctx context.Context, id string, input gen.UpdateConversationInput) (*gen.UpdateConversationResponse, error)
DeleteConversation(ctx context.Context, id string) (*gen.DeleteConversationResponse, error)
// Message operations
CreateMessage(ctx context.Context, input gen.CreateMessageInput) (*gen.CreateMessageResponse, error)
}
Client defines the interface for communicating with the Tero control plane. This allows services to be tested without real API calls.
type ConversationService ¶
type ConversationService struct {
// contains filtered or unexported fields
}
ConversationService handles conversation-related API operations.
func NewConversationService ¶
func NewConversationService(client Client, scope log.Scope) *ConversationService
NewConversationService creates a new conversation service.
func (*ConversationService) Create ¶
func (s *ConversationService) Create(ctx context.Context, input CreateConversationInput) (*domain.Conversation, error)
Create creates a new conversation with the given client-provided ID.
func (*ConversationService) Delete ¶
func (s *ConversationService) Delete(ctx context.Context, id domain.ConversationID) error
Delete deletes a conversation. Returns ErrNotFound (via errors.Is) if the conversation does not exist.
func (*ConversationService) Update ¶
func (s *ConversationService) Update(ctx context.Context, id domain.ConversationID, input UpdateConversationInput) (*domain.Conversation, error)
Update updates a conversation.
type Conversations ¶
type Conversations interface {
Create(ctx context.Context, input CreateConversationInput) (*domain.Conversation, error)
Update(ctx context.Context, id domain.ConversationID, input UpdateConversationInput) (*domain.Conversation, error)
Delete(ctx context.Context, id domain.ConversationID) error
}
Conversations provides access to conversations.
type CreateAccountInput ¶
type CreateAccountInput struct {
ID uuid.UUID
OrganizationID domain.OrganizationID
Name string
}
CreateAccountInput contains the fields for creating an account.
type CreateConversationInput ¶
type CreateConversationInput struct {
ID uuid.UUID
WorkspaceID domain.WorkspaceID
Title string
}
CreateConversationInput contains the fields for creating a conversation.
type CreateDatadogAccountInput ¶
type CreateDatadogAccountInput struct {
ID uuid.UUID
AccountID string
Name string
Site string
APIKey string
AppKey string
}
CreateDatadogAccountInput contains the fields for creating a Datadog account with credentials.
type CreateOrganizationInput ¶
CreateOrganizationInput contains the fields for creating an organization.
type DatadogAccount ¶
type DatadogAccount struct {
ID string
Name string
Site string // GraphQL enum value (US1, US5, EU1, etc.)
}
DatadogAccount is the domain model for a Datadog account.
type DatadogAccountService ¶
type DatadogAccountService struct {
// contains filtered or unexported fields
}
DatadogAccountService handles Datadog account operations via the control plane API.
func NewDatadogAccountService ¶
func NewDatadogAccountService(client Client, scope log.Scope) *DatadogAccountService
NewDatadogAccountService creates a new Datadog account service.
func (*DatadogAccountService) CreateAccount ¶
func (s *DatadogAccountService) CreateAccount(ctx context.Context, input CreateDatadogAccountInput) (*DatadogAccount, error)
CreateAccount creates a Datadog account in the control plane with credentials. Both API key and Application key must be provided. Keys are sent to control plane and stored securely there - never stored locally. The control plane validates the credentials before creating the account.
func (*DatadogAccountService) GetAccount ¶
func (s *DatadogAccountService) GetAccount(ctx context.Context, accountID string) (*DatadogAccount, error)
GetAccount retrieves the Datadog account for the given account ID, or nil if none exists
func (*DatadogAccountService) GetStatus ¶
func (s *DatadogAccountService) GetStatus(ctx context.Context, datadogAccountID string) (*DatadogAccountStatus, error)
GetStatus gets the discovery status for a Datadog account. This is used during onboarding to track overall progress.
func (*DatadogAccountService) HasAccount ¶
HasAccount checks if an account has a Datadog integration configured
func (*DatadogAccountService) ValidateAPIKey ¶
func (s *DatadogAccountService) ValidateAPIKey(ctx context.Context, input ValidateAPIKeyInput) (bool, string, error)
ValidateAPIKey validates the API key via the control plane. The control plane handles validation against Datadog's API. Returns whether the key is valid, an error message if invalid, and any system errors.
type DatadogAccountStatus ¶
type DatadogAccountStatus struct {
Status DatadogAccountStatusState
PercentComplete float64
ServiceLogVolume int // Total log volume across all active services
DiscoveredLogVolume int // Volume of logs we've analyzed
ServiceCount int // Total number of services
ActiveServices int // Services not DISABLED or INACTIVE
ReadyServices int
AnalyzingServices int
DiscoveringServices int
StaleServices int
BrokenServices int
DisabledServices int
InactiveServices int
AnalyzedCount int // Number of log events analyzed (for progress display)
ResolvedCount int // Log events with all policies acted on
CleanCount int // Log events analyzed with no issues
PendingCount int // Log events with policies awaiting action
PendingPolicyCount int // Policies awaiting user action
ReadyForUse bool // Whether the account has enough data to proceed
}
DatadogAccountStatus tracks the log discovery status for a Datadog account.
type DatadogAccountStatusState ¶
type DatadogAccountStatusState string
DatadogAccountStatusState represents the log discovery pipeline state.
const ( DatadogAccountStatusDisabled DatadogAccountStatusState = "DISABLED" DatadogAccountStatusInactive DatadogAccountStatusState = "INACTIVE" DatadogAccountStatusBroken DatadogAccountStatusState = "BROKEN" DatadogAccountStatusStale DatadogAccountStatusState = "STALE" DatadogAccountStatusDiscovering DatadogAccountStatusState = "DISCOVERING" DatadogAccountStatusAnalyzing DatadogAccountStatusState = "ANALYZING" DatadogAccountStatusReady DatadogAccountStatusState = "READY" )
type DatadogAccounts ¶
type DatadogAccounts interface {
HasAccount(ctx context.Context, accountID string) (bool, error)
GetAccount(ctx context.Context, accountID string) (*DatadogAccount, error)
ValidateAPIKey(ctx context.Context, input ValidateAPIKeyInput) (bool, string, error)
CreateAccount(ctx context.Context, input CreateDatadogAccountInput) (*DatadogAccount, error)
GetStatus(ctx context.Context, datadogAccountID string) (*DatadogAccountStatus, error)
}
DatadogAccounts provides access to Datadog account operations.
type MessageService ¶
type MessageService struct {
// contains filtered or unexported fields
}
MessageService handles message persistence via GraphQL.
func NewMessageService ¶
func NewMessageService(client Client, scope log.Scope) *MessageService
NewMessageService creates a new message service.
func (*MessageService) CreateMessage ¶
CreateMessage persists a message to the control plane.
type Messages ¶
Messages persists messages to the control plane for durability. This is separate from the Chat API - it only handles persistence, not inference.
type OrderDirection ¶
type OrderDirection string
OrderDirection specifies the direction for ordering results. This is a common type used across all list operations.
const ( OrderDirectionAsc OrderDirection = "ASC" OrderDirectionDesc OrderDirection = "DESC" )
type OrganizationBootstrapResult ¶
type OrganizationBootstrapResult struct {
Organization *domain.Organization
Account *domain.Account
Workspace *domain.Workspace
}
OrganizationBootstrapResult contains the organization, account, and workspace created during bootstrap.
type OrganizationService ¶
type OrganizationService struct {
// contains filtered or unexported fields
}
OrganizationService handles organization-related API operations.
func NewOrganizationService ¶
func NewOrganizationService(client Client, scope log.Scope) *OrganizationService
NewOrganizationService creates a new organization service.
func (*OrganizationService) Create ¶
func (s *OrganizationService) Create(ctx context.Context, input CreateOrganizationInput) (*OrganizationBootstrapResult, error)
Create creates a new organization with bootstrapped account and workspace.
func (*OrganizationService) List ¶
func (s *OrganizationService) List(ctx context.Context) ([]domain.Organization, error)
List fetches all organizations for the user.
type Organizations ¶
type Organizations interface {
List(ctx context.Context) ([]domain.Organization, error)
Create(ctx context.Context, input CreateOrganizationInput) (*OrganizationBootstrapResult, error)
}
Organizations provides access to organizations.
type ServiceService ¶
type ServiceService struct {
// contains filtered or unexported fields
}
ServiceService handles service-related operations. Services are discovered from observability platforms (Datadog, Splunk, etc.) and represent applications/microservices generating telemetry.
func NewServiceService ¶
func NewServiceService(client Client, scope log.Scope) *ServiceService
NewServiceService creates a new service service.
type UpdateConversationInput ¶
type UpdateConversationInput struct {
Title *string
}
UpdateConversationInput contains the fields that can be updated on a conversation. Fields are pointers — nil means "don't change", non-nil means "set to this value".
type ValidateAPIKeyInput ¶
ValidateAPIKeyInput contains the fields for validating a Datadog API key.
type WorkspaceService ¶
type WorkspaceService struct {
// contains filtered or unexported fields
}
WorkspaceService handles workspace-related API operations.
func NewWorkspaceService ¶
func NewWorkspaceService(client Client, scope log.Scope) *WorkspaceService
NewWorkspaceService creates a new workspace service.