cmdb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIClass

type CIClass struct {
	SysID        string    `json:"sys_id"`
	Name         string    `json:"name"`
	Label        string    `json:"label"`
	SuperClass   string    `json:"super_class"`
	TableName    string    `json:"name"`
	Package      string    `json:"sys_package"`
	Active       bool      `json:"active"`
	Abstract     bool      `json:"abstract"`
	Extensible   bool      `json:"extensible"`
	NumberPrefix string    `json:"number_ref"`
	Attributes   []string  `json:"attributes,omitempty"`
	Description  string    `json:"sys_documentation"`
	CreatedBy    string    `json:"sys_created_by"`
	CreatedOn    time.Time `json:"sys_created_on"`
	UpdatedBy    string    `json:"sys_updated_by"`
	UpdatedOn    time.Time `json:"sys_updated_on"`
}

CIClass represents a Configuration Item class definition

type CIDependencyMap

type CIDependencyMap struct {
	RootCI        *ConfigurationItem   `json:"root_ci"`
	Dependencies  []*ConfigurationItem `json:"dependencies"`
	Dependents    []*ConfigurationItem `json:"dependents"`
	Relationships []*CIRelationship    `json:"relationships"`
	Depth         int                  `json:"depth"`
}

CIDependencyMap represents a dependency mapping for a CI

type CIFilter

type CIFilter struct {
	Class             string    `json:"class,omitempty"`
	State             string    `json:"state,omitempty"`
	OperationalStatus string    `json:"operational_status,omitempty"`
	Environment       string    `json:"environment,omitempty"`
	Location          string    `json:"location,omitempty"`
	Owner             string    `json:"owner,omitempty"`
	SupportGroup      string    `json:"support_group,omitempty"`
	SerialNumber      string    `json:"serial_number,omitempty"`
	AssetTag          string    `json:"asset_tag,omitempty"`
	IPAddress         string    `json:"ip_address,omitempty"`
	FQDN              string    `json:"fqdn,omitempty"`
	Name              string    `json:"name,omitempty"`
	CreatedAfter      time.Time `json:"created_after,omitempty"`
	CreatedBefore     time.Time `json:"created_before,omitempty"`
	UpdatedAfter      time.Time `json:"updated_after,omitempty"`
	UpdatedBefore     time.Time `json:"updated_before,omitempty"`
	Limit             int       `json:"limit,omitempty"`
	Offset            int       `json:"offset,omitempty"`
	OrderBy           string    `json:"order_by,omitempty"`
	Fields            []string  `json:"fields,omitempty"`
}

CIFilter provides filtering options for CI queries

type CIIdentificationRequest

type CIIdentificationRequest struct {
	Items   []map[string]interface{} `json:"items"`
	Options *IdentificationOptions   `json:"options,omitempty"`
}

CIIdentificationRequest contains data for CI identification

type CIIdentificationResult

type CIIdentificationResult struct {
	Matches   []CIMatch                `json:"matches"`
	NoMatches []map[string]interface{} `json:"no_matches"`
}

CIIdentificationResult contains the result of CI identification

type CIMatch

type CIMatch struct {
	InputItem map[string]interface{} `json:"input_item"`
	MatchedCI *ConfigurationItem     `json:"matched_ci"`
	Score     float64                `json:"score"`
	MatchedOn []string               `json:"matched_on"`
}

CIMatch represents a matched CI during identification

type CIReconciliationRequest

type CIReconciliationRequest struct {
	Items      []map[string]interface{} `json:"items"`
	DataSource string                   `json:"data_source"`
	Options    *ReconciliationOptions   `json:"options,omitempty"`
}

CIReconciliationRequest contains options for CI reconciliation

type CIReconciliationResult

type CIReconciliationResult struct {
	Created      []*ConfigurationItem  `json:"created"`
	Updated      []*ConfigurationItem  `json:"updated"`
	Skipped      []string              `json:"skipped"`
	Errors       []ReconciliationError `json:"errors"`
	TotalItems   int                   `json:"total_items"`
	SuccessCount int                   `json:"success_count"`
	ErrorCount   int                   `json:"error_count"`
	SkippedCount int                   `json:"skipped_count"`
}

CIReconciliationResult contains the result of CI reconciliation

type CIRelationship

type CIRelationship struct {
	SysID            string                 `json:"sys_id"`
	Parent           string                 `json:"parent"`
	Child            string                 `json:"child"`
	Type             string                 `json:"type"`
	ConnectionType   string                 `json:"connection_type"`
	ParentDescriptor string                 `json:"parent_descriptor"`
	ChildDescriptor  string                 `json:"child_descriptor"`
	Direction        string                 `json:"direction"`
	Weight           int                    `json:"weight"`
	Attributes       map[string]interface{} `json:"attributes,omitempty"`
	CreatedBy        string                 `json:"sys_created_by"`
	CreatedOn        time.Time              `json:"sys_created_on"`
	UpdatedBy        string                 `json:"sys_updated_by"`
	UpdatedOn        time.Time              `json:"sys_updated_on"`
}

CIRelationship represents a relationship between Configuration Items

type CMDBClient

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

CMDBClient provides methods for managing Configuration Items and CMDB operations

func NewCMDBClient

func NewCMDBClient(client *core.Client) *CMDBClient

NewCMDBClient creates a new CMDB client

func (*CMDBClient) CreateCI

func (c *CMDBClient) CreateCI(className string, ciData map[string]interface{}) (*ConfigurationItem, error)

CreateCI creates a new Configuration Item

func (*CMDBClient) CreateCIWithContext

func (c *CMDBClient) CreateCIWithContext(ctx context.Context, className string, ciData map[string]interface{}) (*ConfigurationItem, error)

CreateCIWithContext creates a new Configuration Item with context support

func (*CMDBClient) DeleteCI

func (c *CMDBClient) DeleteCI(className, sysID string) error

DeleteCI removes a Configuration Item

func (*CMDBClient) DeleteCIWithContext

func (c *CMDBClient) DeleteCIWithContext(ctx context.Context, className, sysID string) error

DeleteCIWithContext removes a Configuration Item with context support

func (*CMDBClient) GetCI

func (c *CMDBClient) GetCI(sysID string) (*ConfigurationItem, error)

GetCI retrieves a Configuration Item by sys_id

func (*CMDBClient) GetCIByClass

func (c *CMDBClient) GetCIByClass(className, sysID string) (*ConfigurationItem, error)

GetCIByClass retrieves a Configuration Item by class and sys_id

func (*CMDBClient) GetCIByClassWithContext

func (c *CMDBClient) GetCIByClassWithContext(ctx context.Context, className, sysID string) (*ConfigurationItem, error)

GetCIByClassWithContext retrieves a Configuration Item by class and sys_id with context support

func (*CMDBClient) GetCIWithContext

func (c *CMDBClient) GetCIWithContext(ctx context.Context, sysID string) (*ConfigurationItem, error)

GetCIWithContext retrieves a Configuration Item by sys_id with context support

func (*CMDBClient) ListCIs

func (c *CMDBClient) ListCIs(filter *CIFilter) ([]*ConfigurationItem, error)

ListCIs retrieves Configuration Items based on filter criteria

func (*CMDBClient) ListCIsWithContext

func (c *CMDBClient) ListCIsWithContext(ctx context.Context, filter *CIFilter) ([]*ConfigurationItem, error)

ListCIsWithContext retrieves Configuration Items based on filter criteria with context support

func (*CMDBClient) NewClassClient

func (c *CMDBClient) NewClassClient() *ClassClient

NewClassClient creates a new class client

func (*CMDBClient) NewIdentificationClient

func (c *CMDBClient) NewIdentificationClient() *IdentificationClient

NewIdentificationClient creates a new identification client

func (*CMDBClient) NewReconciliationClient

func (c *CMDBClient) NewReconciliationClient() *ReconciliationClient

NewReconciliationClient creates a new reconciliation client

func (*CMDBClient) NewRelationshipClient

func (c *CMDBClient) NewRelationshipClient() *RelationshipClient

NewRelationshipClient creates a new relationship client

func (*CMDBClient) UpdateCI

func (c *CMDBClient) UpdateCI(className, sysID string, updates map[string]interface{}) (*ConfigurationItem, error)

UpdateCI updates an existing Configuration Item

func (*CMDBClient) UpdateCIWithContext

func (c *CMDBClient) UpdateCIWithContext(ctx context.Context, className, sysID string, updates map[string]interface{}) (*ConfigurationItem, error)

UpdateCIWithContext updates an existing Configuration Item with context support

type ClassClient

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

ClassClient handles CI class operations

func (*ClassClient) GetCIClass

func (c *ClassClient) GetCIClass(className string) (*CIClass, error)

GetCIClass retrieves a CI class definition

func (*ClassClient) GetCIClassWithContext

func (c *ClassClient) GetCIClassWithContext(ctx context.Context, className string) (*CIClass, error)

GetCIClassWithContext retrieves a CI class definition with context support

func (*ClassClient) GetClassAttributes

func (c *ClassClient) GetClassAttributes(className string) ([]string, error)

GetClassAttributes retrieves attributes for a CI class

func (*ClassClient) GetClassAttributesWithContext

func (c *ClassClient) GetClassAttributesWithContext(ctx context.Context, className string) ([]string, error)

GetClassAttributesWithContext retrieves class attributes with context support

func (*ClassClient) GetClassHierarchy

func (c *ClassClient) GetClassHierarchy(rootClass string) (map[string][]*CIClass, error)

GetClassHierarchy retrieves the class hierarchy starting from a root class

func (*ClassClient) GetClassHierarchyWithContext

func (c *ClassClient) GetClassHierarchyWithContext(ctx context.Context, rootClass string) (map[string][]*CIClass, error)

GetClassHierarchyWithContext retrieves class hierarchy with context support

func (*ClassClient) GetParentClass

func (c *ClassClient) GetParentClass(className string) (*CIClass, error)

GetParentClass retrieves the parent class of a CI class

func (*ClassClient) GetParentClassWithContext

func (c *ClassClient) GetParentClassWithContext(ctx context.Context, className string) (*CIClass, error)

GetParentClassWithContext retrieves parent class with context support

func (*ClassClient) IsSubclassOf

func (c *ClassClient) IsSubclassOf(childClass, parentClass string) (bool, error)

IsSubclassOf checks if a class is a subclass of another class

func (*ClassClient) IsSubclassOfWithContext

func (c *ClassClient) IsSubclassOfWithContext(ctx context.Context, childClass, parentClass string) (bool, error)

IsSubclassOfWithContext checks inheritance relationship with context support

func (*ClassClient) ListCIClasses

func (c *ClassClient) ListCIClasses() ([]*CIClass, error)

ListCIClasses retrieves all CI classes

func (*ClassClient) ListCIClassesWithContext

func (c *ClassClient) ListCIClassesWithContext(ctx context.Context) ([]*CIClass, error)

ListCIClassesWithContext retrieves all CI classes with context support

type ConfigurationItem

type ConfigurationItem struct {
	SysID                  string                 `json:"sys_id"`
	Name                   string                 `json:"name"`
	SysClassName           string                 `json:"sys_class_name"`
	State                  string                 `json:"install_status"`
	OperationalStatus      string                 `json:"operational_status"`
	Category               string                 `json:"category"`
	Subcategory            string                 `json:"subcategory"`
	Environment            string                 `json:"environment"`
	Location               string                 `json:"location"`
	Owner                  string                 `json:"owned_by"`
	SupportGroup           string                 `json:"support_group"`
	AssignedTo             string                 `json:"assigned_to"`
	SerialNumber           string                 `json:"serial_number"`
	AssetTag               string                 `json:"asset_tag"`
	ModelID                string                 `json:"model_id"`
	ModelNumber            string                 `json:"model_number"`
	Manufacturer           string                 `json:"manufacturer"`
	Vendor                 string                 `json:"vendor"`
	ShortDescription       string                 `json:"short_description"`
	Description            string                 `json:"description"`
	IPAddress              string                 `json:"ip_address"`
	MacAddress             string                 `json:"mac_address"`
	FQDN                   string                 `json:"fqdn"`
	DNSDomain              string                 `json:"dns_domain"`
	OSName                 string                 `json:"os"`
	OSVersion              string                 `json:"os_version"`
	OSServicePack          string                 `json:"os_service_pack"`
	CPUCount               int                    `json:"cpu_count"`
	CPUSpeed               string                 `json:"cpu_speed"`
	CPUType                string                 `json:"cpu_type"`
	RAM                    string                 `json:"ram"`
	DiskSpace              string                 `json:"disk_space"`
	CostCenter             string                 `json:"cost_center"`
	PurchaseDate           time.Time              `json:"purchase_date"`
	WarrantyExpiration     time.Time              `json:"warranty_expiration"`
	LeaseID                string                 `json:"lease_id"`
	CostCC                 string                 `json:"cost"`
	Depreciation           string                 `json:"depreciation"`
	SalvageValue           string                 `json:"salvage_value"`
	FirstDiscovered        time.Time              `json:"first_discovered"`
	LastDiscovered         time.Time              `json:"last_discovered"`
	DiscoverySource        string                 `json:"discovery_source"`
	Attributes             map[string]interface{} `json:"attributes,omitempty"`
	BusinessService        string                 `json:"business_service"`
	Application            string                 `json:"application"`
	ChangeControl          string                 `json:"change_control"`
	MaintenanceSchedule    string                 `json:"maintenance_schedule"`
	MonitoringTool         string                 `json:"monitoring_tool"`
	BackupTool             string                 `json:"backup_tool"`
	AntivirusSoftware      string                 `json:"antivirus_software"`
	PatchGroup             string                 `json:"patch_group"`
	ComplianceStatus       string                 `json:"compliance_status"`
	SecurityClassification string                 `json:"security_classification"`
	CreatedBy              string                 `json:"sys_created_by"`
	CreatedOn              time.Time              `json:"sys_created_on"`
	UpdatedBy              string                 `json:"sys_updated_by"`
	UpdatedOn              time.Time              `json:"sys_updated_on"`
}

ConfigurationItem represents a Configuration Item in ServiceNow

type IdentificationClient

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

IdentificationClient handles CI identification operations

func (*IdentificationClient) IdentifyCIs

IdentifyCIs identifies existing CIs based on provided data

func (*IdentificationClient) IdentifyCIsWithContext

func (i *IdentificationClient) IdentifyCIsWithContext(ctx context.Context, request *CIIdentificationRequest) (*CIIdentificationResult, error)

IdentifyCIsWithContext identifies CIs with context support

type IdentificationOptions

type IdentificationOptions struct {
	MatchingAttributes []string `json:"matching_attributes,omitempty"`
	Threshold          float64  `json:"threshold,omitempty"`
	Strategy           string   `json:"strategy"`
	ClassName          string   `json:"class_name,omitempty"`
}

IdentificationOptions contains options for CI identification

type ReconciliationClient

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

ReconciliationClient handles CI reconciliation operations

func (*ReconciliationClient) ReconcileCIs

ReconcileCIs reconciles CI data with existing records

func (*ReconciliationClient) ReconcileCIsWithContext

func (r *ReconciliationClient) ReconcileCIsWithContext(ctx context.Context, request *CIReconciliationRequest) (*CIReconciliationResult, error)

ReconcileCIsWithContext reconciles CIs with context support

type ReconciliationError

type ReconciliationError struct {
	Item    map[string]interface{} `json:"item"`
	Error   string                 `json:"error"`
	Code    string                 `json:"code"`
	Details string                 `json:"details,omitempty"`
}

ReconciliationError represents an error during reconciliation

type ReconciliationOptions

type ReconciliationOptions struct {
	CreateMissing      bool     `json:"create_missing"`
	UpdateExisting     bool     `json:"update_existing"`
	MatchingRules      []string `json:"matching_rules,omitempty"`
	ConflictResolution string   `json:"conflict_resolution"`
	DryRun             bool     `json:"dry_run"`
	ClassName          string   `json:"class_name,omitempty"`
}

ReconciliationOptions contains options for CI reconciliation

type RelationshipClient

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

RelationshipClient handles CI relationship operations

func (*RelationshipClient) BulkCreateRelationships

func (r *RelationshipClient) BulkCreateRelationships(relationships []map[string]interface{}) ([]*CIRelationship, error)

BulkCreateRelationships creates multiple relationships in one operation

func (*RelationshipClient) BulkCreateRelationshipsWithContext

func (r *RelationshipClient) BulkCreateRelationshipsWithContext(ctx context.Context, relationships []map[string]interface{}) ([]*CIRelationship, error)

BulkCreateRelationshipsWithContext creates multiple relationships with context support

func (*RelationshipClient) CreateRelationship

func (r *RelationshipClient) CreateRelationship(parentSysID, childSysID, relType string) (*CIRelationship, error)

CreateRelationship creates a new relationship between CIs

func (*RelationshipClient) CreateRelationshipWithContext

func (r *RelationshipClient) CreateRelationshipWithContext(ctx context.Context, parentSysID, childSysID, relType string) (*CIRelationship, error)

CreateRelationshipWithContext creates a new relationship with context support

func (*RelationshipClient) DeleteRelationship

func (r *RelationshipClient) DeleteRelationship(relationshipSysID string) error

DeleteRelationship removes a relationship

func (*RelationshipClient) DeleteRelationshipWithContext

func (r *RelationshipClient) DeleteRelationshipWithContext(ctx context.Context, relationshipSysID string) error

DeleteRelationshipWithContext removes a relationship with context support

func (*RelationshipClient) FindPath

func (r *RelationshipClient) FindPath(fromCISysID, toCISysID string, maxDepth int) ([][]*CIRelationship, error)

FindPath finds a path between two CIs through relationships

func (*RelationshipClient) FindPathWithContext

func (r *RelationshipClient) FindPathWithContext(ctx context.Context, fromCISysID, toCISysID string, maxDepth int) ([][]*CIRelationship, error)

FindPathWithContext finds paths between CIs with context support

func (*RelationshipClient) GetChildRelationships

func (r *RelationshipClient) GetChildRelationships(ciSysID string) ([]*CIRelationship, error)

GetChildRelationships retrieves relationships where the CI is a parent

func (*RelationshipClient) GetChildRelationshipsWithContext

func (r *RelationshipClient) GetChildRelationshipsWithContext(ctx context.Context, ciSysID string) ([]*CIRelationship, error)

GetChildRelationshipsWithContext retrieves child relationships with context support

func (*RelationshipClient) GetDependencyMap

func (r *RelationshipClient) GetDependencyMap(ciSysID string, depth int) (*CIDependencyMap, error)

GetDependencyMap builds a dependency map for a CI showing its dependencies and dependents

func (*RelationshipClient) GetDependencyMapWithContext

func (r *RelationshipClient) GetDependencyMapWithContext(ctx context.Context, ciSysID string, depth int) (*CIDependencyMap, error)

GetDependencyMapWithContext builds a dependency map with context support

func (*RelationshipClient) GetImpactAnalysis

func (r *RelationshipClient) GetImpactAnalysis(ciSysID string, depth int) (*CIDependencyMap, error)

GetImpactAnalysis analyzes the impact of a CI change or outage

func (*RelationshipClient) GetImpactAnalysisWithContext

func (r *RelationshipClient) GetImpactAnalysisWithContext(ctx context.Context, ciSysID string, depth int) (*CIDependencyMap, error)

GetImpactAnalysisWithContext analyzes impact with context support

func (*RelationshipClient) GetParentRelationships

func (r *RelationshipClient) GetParentRelationships(ciSysID string) ([]*CIRelationship, error)

GetParentRelationships retrieves relationships where the CI is a child

func (*RelationshipClient) GetParentRelationshipsWithContext

func (r *RelationshipClient) GetParentRelationshipsWithContext(ctx context.Context, ciSysID string) ([]*CIRelationship, error)

GetParentRelationshipsWithContext retrieves parent relationships with context support

func (*RelationshipClient) GetRelationshipTypes

func (r *RelationshipClient) GetRelationshipTypes() ([]string, error)

GetRelationshipTypes retrieves all available relationship types

func (*RelationshipClient) GetRelationshipTypesWithContext

func (r *RelationshipClient) GetRelationshipTypesWithContext(ctx context.Context) ([]string, error)

GetRelationshipTypesWithContext retrieves relationship types with context support

func (*RelationshipClient) GetRelationships

func (r *RelationshipClient) GetRelationships(ciSysID string) ([]*CIRelationship, error)

GetRelationships retrieves all relationships for a CI

func (*RelationshipClient) GetRelationshipsByType

func (r *RelationshipClient) GetRelationshipsByType(relType string) ([]*CIRelationship, error)

GetRelationshipsByType retrieves relationships of a specific type

func (*RelationshipClient) GetRelationshipsByTypeWithContext

func (r *RelationshipClient) GetRelationshipsByTypeWithContext(ctx context.Context, relType string) ([]*CIRelationship, error)

GetRelationshipsByTypeWithContext retrieves relationships by type with context support

func (*RelationshipClient) GetRelationshipsWithContext

func (r *RelationshipClient) GetRelationshipsWithContext(ctx context.Context, ciSysID string) ([]*CIRelationship, error)

GetRelationshipsWithContext retrieves all relationships for a CI with context support

Jump to

Keyboard shortcuts

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