Documentation
¶
Index ¶
- Variables
- type DeleteGraphAssetRequestBody
- type DeleteGraphRelationRequestBody
- type GraphAPI
- type GraphAPIOptions
- type GraphClient
- func (gc *GraphClient) DeleteAsset(asset knowledge.Asset) error
- func (gc *GraphClient) DeleteRelation(relation knowledge.Relation) error
- func (gc *GraphClient) ReadCurrentGraph() (*knowledge.Graph, error)
- func (gc *GraphClient) UpdateSchema(sg schema.SchemaGraph) error
- func (gc *GraphClient) UpsertAsset(asset knowledge.Asset) error
- func (gc *GraphClient) UpsertRelation(relation knowledge.Relation) error
- type GraphUpdateRequestBody
- type PutGraphAssetRequestBody
- type PutGraphRelationRequestBody
- type PutGraphSchemaRequestBody
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyRequests = fmt.Errorf("Too Many Requests")
ErrTooManyRequests error representing too many requests to the API
Functions ¶
This section is empty.
Types ¶
type DeleteGraphAssetRequestBody ¶
DeleteGraphAssetRequestBody a request body for the asset removal
type DeleteGraphRelationRequestBody ¶
DeleteGraphRelationRequestBody a request body for the relation removal
type GraphAPI ¶
type GraphAPI struct {
// contains filtered or unexported fields
}
GraphAPI represent the graph API from a data source point of view
func NewGraphAPI ¶
func NewGraphAPI(options GraphAPIOptions) *GraphAPI
NewGraphAPI create an emitter of graph
func (*GraphAPI) CreateTransaction ¶
func (gapi *GraphAPI) CreateTransaction(currentGraph *knowledge.Graph) *Transaction
CreateTransaction create a full graph transaction. This kind of transaction will diff the new graph with previous version of it.
type GraphAPIOptions ¶
GraphAPIOptions options to pass to build graph API
type GraphClient ¶
type GraphClient struct {
// contains filtered or unexported fields
}
GraphClient is a client of the GraphKB API
func NewGraphClient ¶
func NewGraphClient(URL, authToken string, skipVerify bool) *GraphClient
NewGraphClient create a client of the GraphKB API
func (*GraphClient) DeleteAsset ¶
func (gc *GraphClient) DeleteAsset(asset knowledge.Asset) error
DeleteAsset send an asset removal operation to the API
func (*GraphClient) DeleteRelation ¶
func (gc *GraphClient) DeleteRelation(relation knowledge.Relation) error
DeleteRelation send a relation upsert operation to the API
func (*GraphClient) ReadCurrentGraph ¶
func (gc *GraphClient) ReadCurrentGraph() (*knowledge.Graph, error)
ReadCurrentGraph read the current graph stored in graph kb
func (*GraphClient) UpdateSchema ¶
func (gc *GraphClient) UpdateSchema(sg schema.SchemaGraph) error
UpdateSchema send a graph schema update to the API
func (*GraphClient) UpsertAsset ¶
func (gc *GraphClient) UpsertAsset(asset knowledge.Asset) error
UpsertAsset send an asset upsert operation to the API
func (*GraphClient) UpsertRelation ¶
func (gc *GraphClient) UpsertRelation(relation knowledge.Relation) error
UpsertRelation send a relation upsert operation to the API
type GraphUpdateRequestBody ¶
type GraphUpdateRequestBody struct { Updates *knowledge.GraphUpdatesBulk `json:"updates"` Schema schema.SchemaGraph `json:"schema"` }
GraphUpdateRequestBody a request body for the graph update API
type PutGraphAssetRequestBody ¶
PutGraphAssetRequestBody a request body for the asset upsert
type PutGraphRelationRequestBody ¶
PutGraphRelationRequestBody a request body for the relation upsert
type PutGraphSchemaRequestBody ¶
type PutGraphSchemaRequestBody struct {
Schema schema.SchemaGraph `json:"schema"`
}
PutGraphSchemaRequestBody a request body for the schema update
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represent a transaction generating updates by diffing the provided graph against the previous version.
func (*Transaction) Bind ¶
func (cgt *Transaction) Bind(asset string, assetType schema.AssetType)
Bind bind one asset to an asset type from the schema
func (*Transaction) Commit ¶
func (cgt *Transaction) Commit() (*knowledge.Graph, error)
Commit commit the transaction and gives ownership to the source for caching.
func (*Transaction) Relate ¶
func (cgt *Transaction) Relate(from string, relationType schema.RelationType, to string)
Relate create a relation between two assets