...

Source file src/edge-infra.dev/pkg/edge/audit/options.go

Documentation: edge-infra.dev/pkg/edge/audit

     1  package audit
     2  
     3  // Option
     4  type Option func(s *Sink)
     5  
     6  // WithApp
     7  func WithApp(app string) Option {
     8  	return func(s *Sink) {
     9  		s.app = app
    10  	}
    11  }
    12  
    13  // WithUserIP
    14  func WithUserIP(ip string) Option {
    15  	return func(s *Sink) {
    16  		s.ip = ip
    17  	}
    18  }
    19  
    20  // WithTenant
    21  func WithTenant(tenant string) Option {
    22  	return func(s *Sink) {
    23  		s.tenant = tenant
    24  	}
    25  }
    26  
    27  // WithActor
    28  func WithActor(actionBy string) Option {
    29  	return func(s *Sink) {
    30  		s.actionBy = actionBy
    31  	}
    32  }
    33  
    34  // WithIdentifier
    35  func WithIdentifier(id string) Option {
    36  	return func(s *Sink) {
    37  		s.identifier = id
    38  	}
    39  }
    40  
    41  // WithAuthProvider
    42  func WithAuthProvider(authProvider string) Option {
    43  	return func(s *Sink) {
    44  		s.authProvider = authProvider
    45  	}
    46  }
    47  
    48  // WithRequestURL
    49  func WithRequestURL(requestURL string) Option {
    50  	return func(s *Sink) {
    51  		s.requestURL = requestURL
    52  	}
    53  }
    54  
    55  // WithOperationName
    56  func WithOperationName(operationName string) Option {
    57  	return func(s *Sink) {
    58  		s.operationName = operationName
    59  	}
    60  }
    61  
    62  // WithUserAgent
    63  func WithUserAgent(userAgent string) Option {
    64  	return func(s *Sink) {
    65  		s.userAgent = userAgent
    66  	}
    67  }
    68  
    69  // WithMethod
    70  func WithMethod(method string) Option {
    71  	return func(s *Sink) {
    72  		s.method = method
    73  	}
    74  }
    75  
    76  // WithStatus
    77  func WithStatus(status string) Option {
    78  	return func(s *Sink) {
    79  		s.status = status
    80  	}
    81  }
    82  
    83  // WithParameters
    84  func WithParameters(parameters map[string]interface{}) Option {
    85  	return func(s *Sink) {
    86  		params := make([]interface{}, 0)
    87  		for k, v := range parameters {
    88  			params = append(params, k, v)
    89  		}
    90  		s.parameters = params
    91  	}
    92  }
    93  
    94  // WithInput
    95  func WithInput(input string) Option {
    96  	return func(s *Sink) {
    97  		s.input = input
    98  	}
    99  }
   100  

View as plain text