api

package
v0.0.0-...-1573b19 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Specversion     string      `json:"specversion"`
	Type            string      `json:"type"`
	Source          string      `json:"source"`
	Id              string      `json:"id"`
	Subject         string      `json:"subject"`
	Time            time.Time   `json:"time"`
	DataContentType string      `json:"datacontenttype"`
	Data            interface{} `json:"data"`
}

Event represents a CloudEvent structure used for inventory system events. Todo: get rid of this Event and have an Event (as event output) with all the assignments going on the New* functions

func NewRelationshipEvent

func NewRelationshipEvent(operationType biz.EventOperationType, relationship *model_legacy.Relationship, reportedTime time.Time) (*Event, error)

NewRelationshipEvent creates a new Event for relationship operations.

func NewResourceEvent

func NewResourceEvent(operationType biz.EventOperationType, resource *model_legacy.Resource, reportedTime time.Time) (*Event, error)

NewResourceEvent creates a new Event for resource operations.

type Manager

type Manager interface {
	// Lookup hides the logic of figuring out which topic to send an event on.
	Lookup(identity *authnapi.Identity, resource_type string, resource_id uuid.UUID) (Producer, error)

	Errs() <-chan error
	Shutdown(ctx context.Context) error
}

Manager defines the interface for managing event producers and routing events to appropriate topics. It provides methods to look up producers based on identity and resource information, error handling, and graceful shutdown capabilities.

type Producer

type Producer interface {
	// Produce will send the event.  The destination of the event is captured in the Producer implementation.
	Produce(ctx context.Context, event *Event) error
}

Producer defines the interface for sending events to a specific destination. The destination is determined by the Producer implementation.

type RelationshipData

type RelationshipData struct {
	Metadata     RelationshipMetadata `json:"metadata"`
	ReporterData RelationshipReporter `json:"reporter_data"`
	ResourceData internal.JsonObject  `json:"resource_data,omitempty"`
}

RelationshipData contains the data payload for relationship-related events.

type RelationshipMetadata

type RelationshipMetadata struct {
	Id               string     `json:"id"`
	RelationshipType string     `json:"relationship_type"`
	CreatedAt        *time.Time `json:"created_at,omitempty"`
	UpdatedAt        *time.Time `json:"updated_at,omitempty"`
	DeletedAt        *time.Time `json:"deleted_at,omitempty"`
}

RelationshipMetadata contains metadata information for inventory relationships.

type RelationshipReporter

type RelationshipReporter struct {
	ReporterType           string `json:"reporter_type"`
	SubjectLocalResourceId string `json:"subject_local_resource_id"`
	ObjectLocalResourceId  string `json:"object_local_resource_id"`
	ReporterVersion        string `json:"reporter_version"`
	ReporterInstanceId     string `json:"reporter_instance_id"`
}

RelationshipReporter contains information about the system that reported the relationship.

type ResourceData

type ResourceData struct {
	Metadata     ResourceMetadata    `json:"metadata"`
	ReporterData ResourceReporter    `json:"reporter_data"`
	ResourceData internal.JsonObject `json:"resource_data,omitempty"`
}

ResourceData contains the data payload for resource-related events.

type ResourceLabel

type ResourceLabel struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

ResourceLabel represents a key-value label associated with a resource.

type ResourceMetadata

type ResourceMetadata struct {
	Id           string          `json:"id"`
	ResourceType string          `json:"resource_type"`
	OrgId        string          `json:"org_id"`
	CreatedAt    *time.Time      `json:"created_at,omitempty"`
	UpdatedAt    *time.Time      `json:"updated_at,omitempty"`
	DeletedAt    *time.Time      `json:"deleted_at,omitempty"`
	WorkspaceId  string          `json:"workspace_id"`
	Labels       []ResourceLabel `json:"labels,omitempty"`
}

ResourceMetadata contains metadata information for inventory resources.

type ResourceReporter

type ResourceReporter struct {
	ReporterInstanceId string `json:"reporter_instance_id"`
	ReporterType       string `json:"reporter_type"`
	ConsoleHref        string `json:"console_href"`
	ApiHref            string `json:"api_href"`
	LocalResourceId    string `json:"local_resource_id"`
	ReporterVersion    string `json:"reporter_version"`
}

ResourceReporter contains information about the system that reported the resource.

Jump to

Keyboard shortcuts

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