resourceutil

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BasicProperties = []string{"application", "environment", "status", "connections"}

BasicProperties is a list of common properties that are expected to be present in all resources

Functions

func GetConnectionNameandSourceIDs added in v0.49.0

func GetConnectionNameandSourceIDs[P any](resource P) (map[string]string, error)

GetConnectionNameandSourceIDs extracts the connected resource IDs from the resource's properties. It returns a map where the keys are connection names and the values are the corresponding connected resource's IDs.

func GetPropertiesFromResource

func GetPropertiesFromResource[P any](resource P) (map[string]any, error)

GetPropertiesFromResource extracts the "properties" field from the resource by serializing it to JSON and deserializing just the "properties" field.

Types

type ResourceMetadata added in v0.55.0

type ResourceMetadata struct {
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Type       string         `json:"type"`
	Properties map[string]any `json:"properties,omitempty"`
}

ResourceMetadata represents resource metadata including ID, Name, Type and Properties

func GetAllPropertiesFromResource added in v0.55.0

func GetAllPropertiesFromResource[P any](resource P) (*ResourceMetadata, error)

GetAllPropertiesFromResource extracts the resource metadata including ID, Name, Type and properties by unmarshalling the resource and extracting the required fields.

Jump to

Keyboard shortcuts

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