Documentation ¶
Overview ¶
Package flow provides GRR flow object which handles associated API calls via an arbitrary transfer protocol.
Index ¶
- func PollPeriod(pollPeriod time.Duration) func(pollPeriodPtr *time.Duration)
- type Connector
- type Flow
- func (f *Flow) Cancel(ctx context.Context) error
- func (f *Flow) Get(ctx context.Context) error
- func (f *Flow) GetFilesArchive(ctx context.Context, format *afpb.ApiGetFlowFilesArchiveArgs_ArchiveFormat) (io.ReadCloser, error)
- func (f *Flow) ListResults(ctx context.Context, fn func(r *Result) error) (int64, error)
- func (f *Flow) Wait(ctx context.Context, options ...func(pollPeriodPtr *time.Duration)) (*State, error)
- type Result
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connector ¶
type Connector interface { GetFlowFilesArchive(ctx context.Context, args *afpb.ApiGetFlowFilesArchiveArgs) (io.ReadCloser, error) ListFlowResults(ctx context.Context, args *afpb.ApiListFlowResultsArgs, fn func(m *afpb.ApiFlowResult) error) (int64, error) CancelFlow(ctx context.Context, args *afpb.ApiCancelFlowArgs) error GetFlow(ctx context.Context, args *afpb.ApiGetFlowArgs) (*afpb.ApiFlow, error) }
Connector abstracts GRR communication protocols (i.e. HTTP, Stubby).
type Flow ¶
type Flow struct { ID string ClientID string Data *afpb.ApiFlow // contains filtered or unexported fields }
Flow object is a helper object to send requests to GRR server via an arbitrary transfer protocol.
func (*Flow) Get ¶
Get sends a request to GRR server to get information for a flow and fills it in Data field. If an error occurs, Data field will stay unchanged.
func (*Flow) GetFilesArchive ¶
func (f *Flow) GetFilesArchive(ctx context.Context, format *afpb.ApiGetFlowFilesArchiveArgs_ArchiveFormat) (io.ReadCloser, error)
GetFilesArchive sends a request to GRR server to get files archive of the flow.
func (*Flow) ListResults ¶
ListResults sends a request to GRR server to list results of the flow.
func (*Flow) Wait ¶
func (f *Flow) Wait(ctx context.Context, options ...func(pollPeriodPtr *time.Duration)) (*State, error)
Wait periodically pulls flow status from the server and returns when it's completed or context expires. It's users' responsibility to specify the WithDeadline/WithTimeout func for context. Example usage could look like this: ctx, cancel := context.WithTimeout(context.Background(), 10 * time.Minute) defer cancel() fs, err := flow.Wait(ctx)
type State ¶
type State struct { // an enum presenting the status of a flow. Name afpb.ApiFlow_State // a user-friendly status message. StatusText string }
State contains a flow state (e.g. "RUNNING") and the completion status string for humans.
func (*State) HasFailed ¶
HasFailed returns true if the flow somehow failed with a agent or server error.
func (*State) IsTerminated ¶
IsTerminated returns true if the flow has been completed and the actually performed on the agent.