Documentation
¶
Index ¶
- Constants
- func IsNativeResource(t string) bool
- func NativeKnownAttrs(resourceType string) map[string]bool
- func NativePropertyIDToSlug(props []NativePropertyInfo) map[string]string
- func NativePropertyMap(props []NativePropertyInfo) map[string]NativePropertyInfo
- func SDKCreatableKind(kind string) bool
- type BulkError
- type BulkResult
- type CatalogInfo
- type CatalogSpec
- type Client
- func (c *Client) BulkDelete(ctx context.Context, catalogID string, externalIDs []string) (*BulkResult, error)
- func (c *Client) BulkDeleteNative(ctx context.Context, resourceType string, externalIDs []string) (*BulkResult, error)
- func (c *Client) BulkUpsert(ctx context.Context, catalogID string, ents []catalog.DesiredEntity) (*BulkResult, error)
- func (c *Client) BulkUpsertNative(ctx context.Context, resourceType string, ents []catalog.DesiredEntity) (*BulkResult, error)
- func (c *Client) EnsureCatalog(ctx context.Context, spec CatalogSpec) (string, error)
- func (c *Client) EnsureFields(ctx context.Context, catalogID string, fields []FieldSpec) error
- func (c *Client) EnsureNativeProperty(ctx context.Context, resourceType, name, kind, kindCatalogID string) error
- func (c *Client) ListCatalogs(ctx context.Context) ([]CatalogInfo, error)
- func (c *Client) ListEntities(ctx context.Context, catalogID string) ([]catalog.LiveEntity, error)
- func (c *Client) ListNativeProperties(ctx context.Context, resourceType string) ([]NativePropertyInfo, error)
- func (c *Client) ListNativeResources(ctx context.Context, resourceType string) ([]catalog.LiveEntity, error)
- func (c *Client) ListNativeResourcesWithProps(ctx context.Context, resourceType string, propIDToSlug map[string]string) ([]catalog.LiveEntity, error)
- type ClientInterface
- type FieldSpec
- type NativePropertyInfo
- type Option
Constants ¶
const ( DefaultBaseURL = "https://api.rootly.com" DefaultAPIPath = "/v1" DefaultMaxRetries = 5 MaxBatchSize = 100 DefaultPageSize = 250 UserAgent = "rootly-catalog-sync/0.1.0 (+https://github.com/rootlyhq/rootly-catalog-sync)" )
const ( NativeService = "service" NativeFunctionality = "functionality" NativeEnvironment = "environment" NativeTeam = "team" )
Native resource type constants.
Variables ¶
This section is empty.
Functions ¶
func IsNativeResource ¶ added in v0.2.0
IsNativeResource returns true if the given type name is a built-in Rootly resource type that supports bulk sync (service, functionality, environment, team).
func NativeKnownAttrs ¶ added in v0.3.0
NativeKnownAttrs returns the known writable attributes for a native resource type.
func NativePropertyIDToSlug ¶ added in v0.3.0
func NativePropertyIDToSlug(props []NativePropertyInfo) map[string]string
NativePropertyIDToSlug builds a property-UUID-to-slug map for read-back resolution.
func NativePropertyMap ¶ added in v0.3.0
func NativePropertyMap(props []NativePropertyInfo) map[string]NativePropertyInfo
NativePropertyMap builds a slug-to-info map from a property list.
func SDKCreatableKind ¶ added in v0.3.1
Types ¶
type BulkResult ¶
type CatalogInfo ¶
type CatalogSpec ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BulkDelete ¶
func (c *Client) BulkDelete(ctx context.Context, catalogID string, externalIDs []string) (*BulkResult, error)
BulkDelete deletes entities by external ID in batches of MaxBatchSize.
func (*Client) BulkDeleteNative ¶ added in v0.2.0
func (c *Client) BulkDeleteNative(ctx context.Context, resourceType string, externalIDs []string) (*BulkResult, error)
BulkDeleteNative deletes native resources by external ID in batches.
func (*Client) BulkUpsert ¶
func (c *Client) BulkUpsert(ctx context.Context, catalogID string, ents []catalog.DesiredEntity) (*BulkResult, error)
BulkUpsert creates or updates entities in batches of MaxBatchSize.
func (*Client) BulkUpsertNative ¶ added in v0.2.0
func (c *Client) BulkUpsertNative(ctx context.Context, resourceType string, ents []catalog.DesiredEntity) (*BulkResult, error)
BulkUpsertNative upserts native resources in batches. For each entity, fields matching known attributes are set directly on the SDK struct; remaining fields go into the catalog Fields array.
func (*Client) EnsureCatalog ¶
EnsureCatalog finds a catalog by name or creates it, returning the catalog ID.
func (*Client) EnsureFields ¶
EnsureFields ensures all desired fields exist on a catalog, creating any that are missing.
func (*Client) EnsureNativeProperty ¶ added in v0.3.0
func (*Client) ListCatalogs ¶
func (c *Client) ListCatalogs(ctx context.Context) ([]CatalogInfo, error)
ListCatalogs returns all catalogs, paginating with page[number].
func (*Client) ListEntities ¶
ListEntities returns all entities for a catalog, using page-based pagination. It also fetches catalog fields to resolve property IDs to field names.
func (*Client) ListNativeProperties ¶ added in v0.3.0
func (*Client) ListNativeResources ¶ added in v0.2.0
func (c *Client) ListNativeResources(ctx context.Context, resourceType string) ([]catalog.LiveEntity, error)
ListNativeResources lists all resources of the given native type, paginating through the API until all pages are fetched.
type ClientInterface ¶
type ClientInterface interface {
ListEntities(ctx context.Context, catalogID string) ([]catalog.LiveEntity, error)
BulkUpsert(ctx context.Context, catalogID string, ents []catalog.DesiredEntity) (*BulkResult, error)
BulkDelete(ctx context.Context, catalogID string, externalIDs []string) (*BulkResult, error)
EnsureCatalog(ctx context.Context, spec CatalogSpec) (string, error)
EnsureFields(ctx context.Context, catalogID string, fields []FieldSpec) error
ListCatalogs(ctx context.Context) ([]CatalogInfo, error)
}
type NativePropertyInfo ¶ added in v0.3.0
type Option ¶
type Option func(*Client)