forked from kai-ten/go-csf-schemas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactor.go
23 lines (19 loc) · 852 Bytes
/
actor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// https://schema.ocsf.io/objects/actor
package gcs
import "github.com/go-playground/validator/v10"
type Actor struct {
AuthorizationInformation *[]AuthorizationInformation `json:"authorizations" validate:"omitempty"`
IdentityProvider *IdentityProvider `json:"idp" validate:"omitempty"`
InvokedBy string `json:"invoked_by" validate:"omitempty"`
Process *Process `json:"process" validate:"omitempty"`
User *User `json:"user" validate:"omitempty"`
UserSession *Session `json:"session" validate:"omitempty"`
}
func ValidateActor(actor *Actor) (*Actor, error) {
err := validator.New().Struct(actor)
if err != nil {
ValidatorErrLog(err)
return nil, err
}
return actor, nil
}