Skip to content

Decision

type Decision

Decision represents details about a successful policy evaluation.

type Result struct {
DecisionId string
Result string
Error string
DecisionEvalDuration int
}
FieldTypeDescription
DecisionIdstringAn ID for the decision returned by the policy engine.
ResultstringA string that contains the result of a policy evaluation. This represents a valid JSON string.
ErrorstringA string that contains the error of of a policy evaluation.
DecisionEvalDurationint64An int containing the duration for Evaluation in nanoseconds.

type DecisionError

DecisionError represents details about an error returned from a policy decision.

type DecisionError struct {
ErrorCode int
Message string
}
FieldTypeDescription
ErrorCodeintThe specific category of error returned by the library.
MessagestringAn string that represents any additional information about the error, e.g. error site in the policy file, or an error returned by a remote data call during policy evaluation.

type SDK

The SDK interface provides functions for interacting with Trimble Access Management.

type SDK interface {
Evaluate(packageNamespace string, rule string, input string) (*DecisionResult, error)
}

Evaluate

Calls an appliance to evaluate a policy decision.

Input ParameterTypeDescription
packageNamespacestringThe namespace of the package containing the rule(s) to evaluate.
rulestringThe optional name of the rule to evaluate. Omitting this value using an empty string will evaluate all rules in the package.
inputstringAn object that will be marshaled as JSON and sent as input to the appliance’s decision endpoint.

Note

The authorization token can be passed for policy evaluation by setting “applianceAuth” or “callerAuth” in the input JSON based on how the http caller is configured in the policy. The token is passed as a string value with Bearer prefixed. Both values are optional, if povided it has been a valid token.

{
"namespace": "namespace",
"rule": "rule",
"input": {
"applianceAuth":"Bearer token",
"callerAuth":"Bearer token",
}
}