Documentation ¶
Overview ¶
Do not edit mock_Import_Closer.go directly as your changes will be overwritten. Instead, edit mock_Import_Closer.go.src and re-run "go generate ./" in the root SDK package.
Package sdk contains the low-level interfaces and API for creating Sentinel plugins. A Sentinel plugin can provide data dynamically to Sentinel policies.
For plugin authors, the subfolder "framework" contains a high-level framework for easily implementing imports in Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Undefined is a constant value that represents the undefined object in // Sentinel. By making this the return value, it'll be converted to // Undefined. Undefined = &undefined{} // Null is a constant value that represents the null object in Sentinel. // By making this a return value, it will convert to null. Null = &null{} )
Functions ¶
This section is empty.
Types ¶
type GetKey ¶
type GetKey struct { // The key for this part of the request. Key string // The list of arguments for a call expression. This is "nil" if // this key is not a call. This may be length zero (but non-nil) if // this is a call with no arguments. Args []interface{} }
GetKey is an individual key in the larger possible selector of the specific import call, along with any supplied arguments for the specific key.
type GetReq ¶
type GetReq struct { // ExecId is a unique ID representing the particular execution for this // request. This can be used to maintain state locally. // // ExecDeadline is a hint of when the execution will be over and the // state can be thrown away. The time given here will always be in UTC // time. Note that this is susceptible to clock shifts, but Go is planning // to make the time APIs monotonic by default (see proposal 12914). After // that this will be resolved. ExecId uint64 ExecDeadline time.Time // Keys is the list of keys being requested. For example for "a.b.c" // where "a" is the import, Keys would be ["b", "c"]. Keys []GetKey // KeyId is a unique ID for this key. This should match exactly the // GetResult KeyId so that the result for this can be found quickly. KeyId uint64 // Context, if supplied, is an arbitrary object intended to // represent the data from an existing namespace. If the import // supports the framework.New interface, the contents are passed to // it, with any resulting namespace being what Get operates on. // // The Get call operates on the root of the import if this is set // to nil. If this is set and the import does not implement // framework.New, an error is returned. Context map[string]interface{} }
GetReq are the arguments given to Get for an Import.
type GetResult ¶
type GetResult struct { KeyId uint64 // KeyId matching GetReq.KeyId, or zero. Keys []string // Keys structure from GetReq.Keys, or new key set. Value interface{} // Value compatible with lang/object.ToObject Context map[string]interface{} // Updated Context if it was sent Callable bool // true if returned Value is callable }
GetResult is the result structure for a Get request.
type GetResultList ¶
type GetResultList []*GetResult
GetResultList is a wrapper around a slice of GetResult structures to provide helpers.
func (GetResultList) KeyId ¶
func (r GetResultList) KeyId(id uint64) *GetResult
KeyId gets the result with the given key ID, or nil if its not found.
type Import ¶
type Import interface { // Configure is called to configure the plugin before it is accessed. // This must be called before any call to Get(). Configure(map[string]interface{}) error // Get is called when an import field is accessed or called as a function. // // Get may request more than one value at a time, represented by multiple // GetReq values. The result GetResult should contain the matching // KeyId for the requests. // // The result value is not a map keyed on KeyId to allow flexibility // in the future of potentially allowing pre-fetched data. This has no // effect currently. Get(reqs []*GetReq) ([]*GetResult, error) }
Import is an importable package.
Imports are a namespace that may contain objects and functions. The root level has no value nor can it be called. For example `import "a'` allows access to fields within "a" such as `a.b` but doesn't allow referencing or calling it directly with `a` alone. This is an important difference between imports and external objects (which themselves express a value).
type MockImport ¶
MockImport is an autogenerated mock type for the Import type
func (*MockImport) Configure ¶
func (_m *MockImport) Configure(_a0 map[string]interface{}) error
Configure provides a mock function with given fields: _a0
type MockImportCloser ¶
type MockImportCloser struct {
MockImport
}
MockImportCloser augments MockImport to also implement io.Closer
func (*MockImportCloser) Close ¶
func (_m *MockImportCloser) Close() error
Close mocks Close for MockImportCloser
Directories ¶
Path | Synopsis |
---|---|
Package framework contains a high-level framework for implementing Sentinel imports with Go.
|
Package framework contains a high-level framework for implementing Sentinel imports with Go. |
proto
|
|
go
Package proto contains the Go generated files for the protocol buffer files.
|
Package proto contains the Go generated files for the protocol buffer files. |
Package rpc contains the API that can be used to serve Sentinel plugins over an RPC interface.
|
Package rpc contains the API that can be used to serve Sentinel plugins over an RPC interface. |
Package testing provides support for automated testing for import plugins.
|
Package testing provides support for automated testing for import plugins. |
testimport
Package testimport contains a test import that the testing package uses for unit tests.
|
Package testimport contains a test import that the testing package uses for unit tests. |