Decision
type Decision
Decision represents details about a successful policy evaluation.
type Result struct { DecisionId string Result string Error string DecisionEvalDuration int}| Field | Type | Description |
|---|---|---|
DecisionId | string | An ID for the decision returned by the policy engine. |
Result | string | A string that contains the result of a policy evaluation. This represents a valid JSON string. |
Error | string | A string that contains the error of of a policy evaluation. |
DecisionEvalDuration | int64 | An 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}| Field | Type | Description |
|---|---|---|
ErrorCode | int | The specific category of error returned by the library. |
Message | string | An 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 Parameter | Type | Description |
|---|---|---|
packageNamespace | string | The namespace of the package containing the rule(s) to evaluate. |
rule | string | The optional name of the rule to evaluate. Omitting this value using an empty string will evaluate all rules in the package. |
input | string | An 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", }}