Documentation ¶
Index ¶
- func Bool(b bool) *bool
- func Int(i int) *int
- func IsNotFoundErr(e error) bool
- func String(s string) *string
- func StringSlice(elements ...string) []*string
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)
- func (c *Client) Health(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) NewFile(body string) (*os.File, error)
- func (c *Client) NewFormEncodedRequest(method, endpoint string, qs interface{}, reader io.Reader) (*http.Request, error)
- func (c *Client) NewJSONRequest(method, endpoint string, qs interface{}, body interface{}) (*http.Request, error)
- func (c *Client) Root(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) SetDebugMode(enableDebug bool)
- func (c *Client) SetLogger(w io.Writer)
- func (c *Client) Status(ctx context.Context) (*Status, error)
- type Configuration
- type ListOpt
- type Policy
- type PolicyService
- func (s *PolicyService) Create(ctx context.Context, policy *Policy) (*Policy, error)
- func (s *PolicyService) Delete(ctx context.Context, usernameOrID *string) error
- func (s *PolicyService) Get(ctx context.Context, usernameOrID *string) (*Policy, error)
- func (s *PolicyService) GetByCustomID(ctx context.Context, customID *string) (*Policy, error)
- func (s *PolicyService) List(ctx context.Context, opt *ListOpt) ([]*Policy, *ListOpt, error)
- func (s *PolicyService) ListAll(ctx context.Context) ([]*Policy, error)
- func (s *PolicyService) Update(ctx context.Context, policy *Policy) (*Policy, error)
- type Response
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFoundErr ¶
IsNotFoundErr returns true if the error or it's cause is a 404 response from Opa.
func StringSlice ¶
StringSlice converts a slice of string to a slice of *string
Types ¶
type Client ¶
type Client struct { Policies *PolicyService custom.Registry // contains filtered or unexported fields }
Client talks to the Admin API or control plane of a Opa cluster
func (*Client) NewFile ¶
NewFile creates a request based on the inputs. endpoint should be relative to the baseURL specified during client creation. body is always marshaled into JSON.
func (*Client) NewFormEncodedRequest ¶
func (c *Client) NewFormEncodedRequest(method, endpoint string, qs interface{}, reader io.Reader) (*http.Request, error)
NewFormEncodedRequest creates a request based on the inputs. endpoint should be relative to the baseURL specified during client creation.
func (*Client) NewJSONRequest ¶
func (c *Client) NewJSONRequest(method, endpoint string, qs interface{}, body interface{}) (*http.Request, error)
NewJSONRequest creates a request based on the inputs. endpoint should be relative to the baseURL specified during client creation. body is always marshaled into JSON.
func (*Client) SetDebugMode ¶
SetDebugMode enables or disables logging of the request to the logger set by SetLogger(). By default, debug logging is disabled.
type Configuration ¶
type Configuration map[string]interface{}
Configuration represents a config of a plugin in Opa.
type ListOpt ¶
type ListOpt struct {
Pretty bool
}
ListOpt aids in paginating through list endpoints
type Policy ¶
type Policy struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` Raw *string `json:"raw,omitempty" yaml:"raw,omitempty"` }
Policy represents a Policy in Opa. +k8s:deepcopy-gen=true
func (*Policy) DeepCopyInto ¶
DeepCopyInto copies the receiver, writing into out. in must be non-nil.
type PolicyService ¶
type PolicyService service
PolicyService handles Policies in Opa.
func (*PolicyService) Create ¶
Create creates a Policy in Opa. If an ID is specified, it will be used to create a policy in Opa, otherwise an ID is auto-generated.
func (*PolicyService) Delete ¶
func (s *PolicyService) Delete(ctx context.Context, usernameOrID *string) error
Delete deletes a Policy in Opa
func (*PolicyService) GetByCustomID ¶
GetByCustomID fetches a Policy in Opa.
func (*PolicyService) List ¶
List fetches a list of Policies in Opa. opt can be used to control pagination.
type Status ¶
type Status struct { Database struct { Reachable bool `json:"reachable"` } `json:"database"` Server struct { ConnectionsAccepted int `json:"connections_accepted"` ConnectionsActive int `json:"connections_active"` ConnectionsHandled int `json:"connections_handled"` ConnectionsReading int `json:"connections_reading"` ConnectionsWaiting int `json:"connections_waiting"` ConnectionsWriting int `json:"connections_writing"` TotalRequests int `json:"total_requests"` } `json:"server"` }
Status respresents current status of a Opa node.