pdpcc

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package pdpcc implements gRPC client to control Policy Decision Point (PDP) server. It wraps control part of golang gRPC protocol implementation for PDP. The protocol is defined by github.com/infobloxopen/themis/proto/control.proto. Its golang implementation can be found at github.com/infobloxopen/themis/pdp-control.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client structure represents client side of PDP control protocol. It's responsible for establishing connection and uploading data to PDP server.

func NewClient

func NewClient(addr string, chunkSize int) *Client

NewClient function creates new instance of Client structure.

func (*Client) Apply

func (c *Client) Apply(id int32) error

Apply requests server to switch to recently apploaded policies or content. Its id argument should be upload id obtained on previous Upload call.

func (*Client) Close

func (c *Client) Close()

Close terminates established connection. It does nothing if there is no connection.

func (*Client) Connect

func (c *Client) Connect(timeout time.Duration) error

Connect establishes connection to PDP server.

func (*Client) NotifyReady

func (c *Client) NotifyReady() error

NotifyReady set server to 'ready' state - after that server will open service port for serve decision requests

func (*Client) RequestContentUpload

func (c *Client) RequestContentUpload(id, fromTag, toTag string) (int32, error)

RequestContentUpload requests content upload. The method returns request's id which should be used on upload call. Argument id is content identifier. It must be equal to id field of full content representation. As for policies fromTag and toTag should be valid text representaion of UUID or empty string. If fromTag is emply server expects full content on upload otherwise it expects update. If toTag is empty content becomes not tagged and can't be updated incrementally. TagError is returned to indicate that fromTag doesn't match to current server's content with the same content id.

func (*Client) RequestPoliciesUpload

func (c *Client) RequestPoliciesUpload(fromTag, toTag string) (int32, error)

RequestPoliciesUpload makes request to upload policies. On success returns id of the request. The id should be used to make actual upload. Arguments fromTag and toTag should be valid text representaions of UUID or empty strings. If fromTag is emply, server expects full policy on upload otherwise it expects update. If toTag is empty, policy becomes not tagged and can't be updated incrementally. If incremental update is not possible because fromTag doesn't match to current server policies tag, the method returns TagError.

func (*Client) Upload

func (c *Client) Upload(id int32, r io.Reader) (int32, error)

Upload implements actual data transfer to PDP server. It streams all data from given reader. Argument id should be valid request id obtained previously from RequestPoliciesUpload or RequestContentUpload call. On success Upload method returns upload id (which is not equal to request id). Obtained id shuld be used in next Apply call.

type TagError

type TagError struct {
	// contains filtered or unexported fields
}

TagError is the error returned by upload request if policies or content update tag doesn't match to the tag PDP server has.

func (*TagError) Error

func (e *TagError) Error() string

Error implements method of error interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL