connector

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

TraitMap maps lowercase string representations of traits to the corresponding SDK enum.

Functions

This section is empty.

Types

type EntitlementData

type EntitlementData struct {
	ResourceName string `yaml:"resource_name" json:"resource_name"` // Name/ID of the resource this entitlement is defined ON
	Entitlement  string `yaml:"entitlement" json:"entitlement"`     // acts as the Slug
	DisplayName  string `yaml:"display_name" json:"display_name"`
	Description  string `yaml:"description" json:"description"`
}

EntitlementData struct holds raw data corresponding to a row in the 'entitlements' tab. It is defined for parsing data into an intermediary Go representation. It holds fields ResourceName (the resource it's defined on), Entitlement (acting as the slug), DisplayName, and Description. structure represents a single entitlement definition before conversion to an SDK Entitlement object.

type FileConnector

type FileConnector struct {
	// contains filtered or unexported fields
}

FileConnector struct is the main implementation of the Baton connector for file processing. It is required by the connectorbuilder.Connector interface for defining connector behavior. It holds the path to the input data file. structure provides the context (file path) needed for loading data during sync operations. Instances are created by NewFileConnector.

func NewFileConnector

func NewFileConnector(ctx context.Context, filePath string) (*FileConnector, error)

NewFileConnector creates a new instance of the FileConnector. function is the constructor used by the main command to initialize the connector. main command requires this constructor to instantiate the connector server. Which provides the application entry point with a configured connector instance. implementation stores the provided file path for use during syncs.

func (*FileConnector) Metadata

func (fc *FileConnector) Metadata(ctx context.Context) (*v2.ConnectorMetadata, error)

Metadata returns the connector's metadata. function is required by the connectorbuilder.Connector interface.

func (*FileConnector) ResourceSyncers

func (fc *FileConnector) ResourceSyncers(ctx context.Context) []connectorbuilder.ResourceSyncer

ResourceSyncers returns a list of syncers for the connector. function is required by the connectorbuilder.Connector interface. It determines resource types from the input file and creates a syncer instance for each type, enabling the SDK to sync them. implementation loads minimal data to find resource types, builds the type cache, and creates simple syncers passing only the file path for per-sync loading.

func (*FileConnector) Validate

Validate validates the connector configuration. function is required by the connectorbuilder.Connector interface.

type GrantData

type GrantData struct {
	Principal     string `yaml:"principal" json:"principal"`           // Format: "name" or "entitlement_id"
	EntitlementId string `yaml:"entitlement_id" json:"entitlement_id"` // Format: "resource_name:entitlement_slug"
}

GrantData struct holds raw data corresponding to a row in the 'grants' tab. It is defined for parsing data into an intermediary Go representation. It holds fields Principal (type:name[:membership_slug]) and EntitlementId (resource_name:entitlement_slug). structure represents a single grant relationship before conversion to an SDK Grant object.

type LoadedData

type LoadedData struct {
	Users        []UserData        `yaml:"users" json:"users"`
	Resources    []ResourceData    `yaml:"resources" json:"resources"`
	Entitlements []EntitlementData `yaml:"entitlements" json:"entitlements"`
	Grants       []GrantData       `yaml:"grants" json:"grants"`
}

LoadedData holds all the data parsed from the input file. It is the top-level structure used to unmarshal data from YAML/JSON files.

func LoadFileData

func LoadFileData(filePath string) (*LoadedData, error)

LoadFileData function reads data from the specified input file (Excel, YAML, or JSON). It is called by syncer methods to load the complete dataset required for processing. syncer methods require this to get the raw data before building local caches. Which ensures each sync operation uses data reflecting the file's state at that moment. implementation detects the file type based on its extension and dispatches to the appropriate parser function.

type ResourceData

type ResourceData struct {
	ResourceType     string `yaml:"resource_type" json:"resource_type"`         // Resource Type string (e.g., "role", "team", "workspace")
	ResourceFunction string `yaml:"resource_function" json:"resource_function"` // Resource Function string (trait name like "group", "role")
	Name             string `yaml:"name" json:"name"`                           // Unique name/ID of the resource
	DisplayName      string `yaml:"display_name" json:"display_name"`
	Description      string `yaml:"description" json:"description"`
	ParentResource   string `yaml:"parent_resource" json:"parent_resource"` // Name/ID of the parent resource, if any
}

ResourceData struct holds raw data corresponding to a row in the 'resources' tab. It is defined for parsing data into an intermediary Go representation. It holds fields ResourceType (e.g., "role"), ResourceFunction (trait string like "group"), Name, DisplayName, Description, ParentResource. structure represents a single resource definition before conversion to an SDK Resource object.

type UserData

type UserData struct {
	Name        string                 `yaml:"name" json:"name"`
	DisplayName string                 `yaml:"display_name" json:"display_name"`
	Email       string                 `yaml:"email" json:"email"`
	Status      string                 `yaml:"status" json:"status"`
	LastLogin   string                 `yaml:"last_login" json:"last_login"` // Expected format MM/DD/YYYY (e.g., 04/01/2025)
	Type        string                 `yaml:"type" json:"type"`             // Expected: "human" or "service" (maps to UserTrait_AccountType)
	Profile     map[string]interface{} `yaml:"profile" json:"profile"`       // For user_profile_* columns / profile map
}

UserData struct holds raw data corresponding to a row in the 'users' tab. It is defined for parsing data into an intermediary Go representation. It holds fields Name, DisplayName, Email, Status, LastLogin (expected format MM/DD/YYYY), Type, and a map for dynamic Profile attributes. structure represents a single user definition before conversion to an SDK Resource object with a User trait.

Jump to

Keyboard shortcuts

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