flows

package
v3.65.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

Package flows provides a client for interacting with the Globus Flows service.

STABILITY: BETA

This package is approaching stability but may still undergo minor changes. Components listed below are considered relatively stable, but may have minor signature changes before the package is marked as stable:

  • Client interface and implementation
  • Flow management methods (ListFlows, GetFlow, CreateFlow, etc.)
  • Flow execution methods (RunFlow, GetRun, ListRuns, etc.)
  • Core model types (Flow, Run, ActionProvider, etc.)
  • Pagination support and iterators
  • Client configuration options

The following components are less stable and more likely to evolve:

  • Error handling patterns
  • Batch operations
  • Polling mechanisms (WaitForRun)
  • Action provider interactions

Compatibility Notes

For beta packages:

  • Minor backward-incompatible changes may still occur in minor releases
  • Significant efforts will be made to maintain backward compatibility
  • Changes will be clearly documented in the CHANGELOG
  • Deprecated functionality will be marked with appropriate notices
  • Migration paths will be provided for any breaking changes

This package is expected to reach stable status in version v1.0.0. Until then, users should review the CHANGELOG when upgrading.

Basic Usage

Create a new flows client:

flowsClient := flows.NewClient(
	flows.WithAuthorizer(authorizer),
)

Flow Management:

// List flows
flowsIterator, err := flowsClient.ListFlows(ctx, nil)
if err != nil {
	// Handle error
}

for flowsIterator.HasNext() {
	flow, err := flowsIterator.Flow()
	if err != nil {
		// Handle error
	}
	fmt.Printf("Flow ID: %s, Title: %s\n", flow.ID, flow.Title)
}

// Get a specific flow
flow, err := flowsClient.GetFlow(ctx, "flow_id")
if err != nil {
	// Handle error
}

fmt.Printf("Flow: %s (%s)\n", flow.Title, flow.Definition.Description)

// Create a flow
newFlow := &flows.Flow{
	Title:       "My New Flow",
	Description: "A flow for my workflow",
	Definition: &flows.FlowDefinition{
		// Flow definition...
	},
}

created, err := flowsClient.CreateFlow(ctx, newFlow)
if err != nil {
	// Handle error
}

fmt.Printf("Created flow with ID: %s\n", created.ID)

// Update a flow
update := &flows.FlowUpdate{
	Title: "Updated Flow Title",
	Definition: &flows.FlowDefinition{
		// Updated flow definition...
	},
}

updated, err := flowsClient.UpdateFlow(ctx, "flow_id", update)
if err != nil {
	// Handle error
}

fmt.Printf("Updated flow: %s\n", updated.Title)

// Delete a flow
err = flowsClient.DeleteFlow(ctx, "flow_id")
if err != nil {
	// Handle error
}

Flow Execution:

// Run a flow
input := map[string]interface{}{
	"input_key": "input_value",
}

runID, err := flowsClient.RunFlow(ctx, "flow_id", input)
if err != nil {
	// Handle error
}

fmt.Printf("Started flow run with ID: %s\n", runID)

// Get run status
run, err := flowsClient.GetRun(ctx, "flow_id", runID)
if err != nil {
	// Handle error
}

fmt.Printf("Run status: %s\n", run.Status)

// Wait for run completion
run, err = flowsClient.WaitForRun(ctx, "flow_id", runID)
if err != nil {
	// Handle error
}

if run.Status == "SUCCEEDED" {
	fmt.Println("Flow run completed successfully!")
} else {
	fmt.Printf("Flow run failed: %s\n", run.Status)
}

// Cancel a run
err = flowsClient.CancelRun(ctx, "flow_id", runID)
if err != nil {
	// Handle error
}

Batch Operations:

// Run multiple flows
batch := flows.NewRunBatch()
batch.AddRun("flow_id_1", map[string]interface{}{"key1": "value1"})
batch.AddRun("flow_id_2", map[string]interface{}{"key2": "value2"})

results, err := flowsClient.BatchRunFlows(ctx, batch)
if err != nil {
	// Handle error
}

for flowID, result := range results.Results {
	fmt.Printf("Flow %s run ID: %s\n", flowID, result.RunID)
}

// Get multiple run statuses
runBatch := flows.NewRunIDBatch()
runBatch.AddRun("flow_id_1", "run_id_1")
runBatch.AddRun("flow_id_2", "run_id_2")

runResults, err := flowsClient.BatchGetRuns(ctx, runBatch)
if err != nil {
	// Handle error
}

for _, run := range runResults.Results {
	fmt.Printf("Run %s status: %s\n", run.ID, run.Status)
}

Action Providers:

// List action providers
providers, err := flowsClient.ListActionProviders(ctx)
if err != nil {
	// Handle error
}

for _, provider := range providers {
	fmt.Printf("Provider: %s (%s)\n", provider.Name, provider.ID)
}

// Get action provider details
provider, err := flowsClient.GetActionProvider(ctx, "provider_id")
if err != nil {
	// Handle error
}

fmt.Printf("Provider: %s\n", provider.Name)

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 Scott Friedman and Project Contributors

SPDX-License-Identifier: Apache-2.0 Copyright (c) 2025 Scott Friedman and Project Contributors

Index

Constants

View Source
const (
	DefaultBaseURL = "https://flows.globus.org/v1/"
	FlowsScope     = "https://auth.globus.org/scopes/eec9b274-0c81-4334-bdc2-54e90e689b9a/manage_flows"
)

Constants for Globus Flows

Variables

This section is empty.

Functions

func IsActionProviderNotFoundError

func IsActionProviderNotFoundError(err error) bool

IsActionProviderNotFoundError checks if an error is an ActionProviderNotFoundError.

func IsActionRoleNotFoundError

func IsActionRoleNotFoundError(err error) bool

IsActionRoleNotFoundError checks if an error is an ActionRoleNotFoundError.

func IsFlowNotFoundError

func IsFlowNotFoundError(err error) bool

IsFlowNotFoundError checks if an error is a FlowNotFoundError.

func IsForbiddenError

func IsForbiddenError(err error) bool

IsForbiddenError checks if an error is a ForbiddenError.

func IsRunNotFoundError

func IsRunNotFoundError(err error) bool

IsRunNotFoundError checks if an error is a RunNotFoundError.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError checks if an error is a ValidationError.

func ParseErrorResponse

func ParseErrorResponse(body []byte, statusCode int, resourceID string, resourceType string) error

ParseErrorResponse attempts to parse an HTTP response body into an ErrorResponse.

Types

type ActionProvider

type ActionProvider struct {
	ID          string    `json:"id"`
	DisplayName string    `json:"display_name"`
	Description string    `json:"description,omitempty"`
	Owner       string    `json:"owner"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Type        string    `json:"type"`
	Globus      bool      `json:"globus"`
	Visible     bool      `json:"visible"`
}

ActionProvider represents a Flow action provider

type ActionProviderIterator

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

ActionProviderIterator provides an iterator for action providers that handles pagination automatically.

func NewActionProviderIterator

func NewActionProviderIterator(client *Client, options *ListActionProvidersOptions) *ActionProviderIterator

NewActionProviderIterator creates a new iterator for action providers.

func (*ActionProviderIterator) ActionProvider

func (i *ActionProviderIterator) ActionProvider() *ActionProvider

ActionProvider returns the current action provider in the iterator.

func (*ActionProviderIterator) Err

func (i *ActionProviderIterator) Err() error

Err returns any error that occurred during iteration.

func (*ActionProviderIterator) Next

Next fetches the next action provider in the iterator. Returns false when there are no more providers or an error occurred.

type ActionProviderList

type ActionProviderList struct {
	ActionProviders []ActionProvider `json:"action_providers"`
	Total           int              `json:"total"`
	HadMore         bool             `json:"had_more"`
	Offset          int              `json:"offset"`
	Limit           int              `json:"limit"`
}

ActionProviderList represents a list of Flow action providers

type ActionProviderNotFoundError

type ActionProviderNotFoundError struct {
	ProviderID string
	*ErrorResponse
}

ActionProviderNotFoundError indicates that a requested action provider was not found.

func (*ActionProviderNotFoundError) Error

Error implements the error interface for ActionProviderNotFoundError.

type ActionRole

type ActionRole struct {
	ID           string                 `json:"id"`
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	ActionFields map[string]interface{} `json:"action_fields,omitempty"`
	InputSchema  map[string]interface{} `json:"input_schema,omitempty"`
	Visible      bool                   `json:"visible"`
}

ActionRole represents a role in a Flow action

type ActionRoleIterator

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

ActionRoleIterator provides an iterator for action roles that handles pagination automatically.

func NewActionRoleIterator

func NewActionRoleIterator(client *Client, providerID string, limit int) *ActionRoleIterator

NewActionRoleIterator creates a new iterator for action roles.

func (*ActionRoleIterator) ActionRole

func (i *ActionRoleIterator) ActionRole() *ActionRole

ActionRole returns the current action role in the iterator.

func (*ActionRoleIterator) Err

func (i *ActionRoleIterator) Err() error

Err returns any error that occurred during iteration.

func (*ActionRoleIterator) Next

func (i *ActionRoleIterator) Next(ctx context.Context) bool

Next fetches the next action role in the iterator. Returns false when there are no more roles or an error occurred.

type ActionRoleList

type ActionRoleList struct {
	ActionRoles []ActionRole `json:"action_roles"`
	Total       int          `json:"total"`
	HadMore     bool         `json:"had_more"`
	Offset      int          `json:"offset"`
	Limit       int          `json:"limit"`
}

ActionRoleList represents a list of Flow action roles

type ActionRoleNotFoundError

type ActionRoleNotFoundError struct {
	ProviderID string
	RoleID     string
	*ErrorResponse
}

ActionRoleNotFoundError indicates that a requested action role was not found.

func (*ActionRoleNotFoundError) Error

func (e *ActionRoleNotFoundError) Error() string

Error implements the error interface for ActionRoleNotFoundError.

type BatchActionRoleRequest

type BatchActionRoleRequest struct {
	ProviderID string
	RoleIDs    []string
	Options    *BatchOptions
}

BatchActionRoleRequest represents a request to retrieve action roles in batch.

type BatchActionRoleResponse

type BatchActionRoleResponse struct {
	Responses []*BatchActionRoleResult
}

BatchActionRoleResponse represents the results of a batch action role operation.

type BatchActionRoleResult

type BatchActionRoleResult struct {
	Role  *ActionRole
	Error error
	Index int
}

BatchActionRoleResult represents the result of a single action role retrieval in a batch.

type BatchCancelRunResult

type BatchCancelRunResult struct {
	RunID string
	Error error
	Index int
}

BatchCancelRunResult represents the result of a single flow run cancellation in a batch.

type BatchCancelRunsRequest

type BatchCancelRunsRequest struct {
	RunIDs  []string
	Options *BatchOptions
}

BatchCancelRunsRequest represents a request to cancel multiple flow runs.

type BatchCancelRunsResponse

type BatchCancelRunsResponse struct {
	Responses []*BatchCancelRunResult
}

BatchCancelRunsResponse represents the results of a batch run cancellation operation.

type BatchFlowResult

type BatchFlowResult struct {
	Flow  *Flow
	Error error
	Index int
}

BatchFlowResult represents the result of a single flow retrieval in a batch.

type BatchFlowsRequest

type BatchFlowsRequest struct {
	FlowIDs []string
	Options *BatchOptions
}

BatchFlowsRequest represents a request to retrieve flows in batch.

type BatchFlowsResponse

type BatchFlowsResponse struct {
	Responses []*BatchFlowResult
}

BatchFlowsResponse represents the results of a batch flow retrieval operation.

type BatchOptions

type BatchOptions struct {
	// Concurrency is the maximum number of concurrent operations.
	// If <= 0, a default of 10 will be used.
	Concurrency int
}

BatchOptions configures behavior for batch operations.

type BatchRunFlowResult

type BatchRunFlowResult struct {
	Response *RunResponse
	Error    error
	Index    int
}

BatchRunFlowResult represents the result of a single flow run in a batch.

type BatchRunFlowsRequest

type BatchRunFlowsRequest struct {
	Requests []*RunRequest
	Options  *BatchOptions
}

BatchRunFlowsRequest represents a batch of flow run requests.

type BatchRunFlowsResponse

type BatchRunFlowsResponse struct {
	Responses []*BatchRunFlowResult
}

BatchRunFlowsResponse represents the results of a batch flow run operation.

type BatchRunResult

type BatchRunResult struct {
	Run   *RunResponse
	Error error
	Index int
}

BatchRunResult represents the result of a single flow run retrieval in a batch.

type BatchRunsRequest

type BatchRunsRequest struct {
	RunIDs  []string
	Options *BatchOptions
}

BatchRunsRequest represents a request to retrieve flow runs in batch.

type BatchRunsResponse

type BatchRunsResponse struct {
	Responses []*BatchRunResult
}

BatchRunsResponse represents the results of a batch flow run retrieval operation.

type Client

type Client struct {
	Client *core.Client
}

Client provides methods for interacting with Globus Flows

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

NewClient creates a new Flows client

func (*Client) BatchCancelRuns

func (c *Client) BatchCancelRuns(ctx context.Context, batch *BatchCancelRunsRequest) *BatchCancelRunsResponse

BatchCancelRuns cancels multiple flow runs concurrently.

func (*Client) BatchGetActionRoles

func (c *Client) BatchGetActionRoles(ctx context.Context, batch *BatchActionRoleRequest) *BatchActionRoleResponse

BatchGetActionRoles retrieves multiple action roles concurrently.

func (*Client) BatchGetFlows

func (c *Client) BatchGetFlows(ctx context.Context, batch *BatchFlowsRequest) *BatchFlowsResponse

BatchGetFlows retrieves multiple flows concurrently.

func (*Client) BatchGetRuns

func (c *Client) BatchGetRuns(ctx context.Context, batch *BatchRunsRequest) *BatchRunsResponse

BatchGetRuns retrieves multiple flow runs concurrently.

func (*Client) BatchRunFlows

func (c *Client) BatchRunFlows(ctx context.Context, batch *BatchRunFlowsRequest) *BatchRunFlowsResponse

BatchRunFlows executes multiple flow runs concurrently.

func (*Client) CancelRun

func (c *Client) CancelRun(ctx context.Context, runID string) error

CancelRun cancels a flow run

func (*Client) CreateFlow

func (c *Client) CreateFlow(ctx context.Context, request *FlowCreateRequest) (*Flow, error)

CreateFlow creates a new flow

func (*Client) DeleteFlow

func (c *Client) DeleteFlow(ctx context.Context, flowID string) error

DeleteFlow deletes a flow

func (*Client) GetActionProvider

func (c *Client) GetActionProvider(ctx context.Context, providerID string) (*ActionProvider, error)

GetActionProvider retrieves a specific action provider by ID

func (*Client) GetActionProvidersIterator

func (c *Client) GetActionProvidersIterator(options *ListActionProvidersOptions) *ActionProviderIterator

GetActionProvidersIterator returns an iterator for listing action providers with pagination.

func (*Client) GetActionRole

func (c *Client) GetActionRole(ctx context.Context, providerID, roleID string) (*ActionRole, error)

GetActionRole retrieves a specific action role by ID

func (*Client) GetActionRolesIterator

func (c *Client) GetActionRolesIterator(providerID string, limit int) *ActionRoleIterator

GetActionRolesIterator returns an iterator for listing action roles with pagination.

func (*Client) GetFlow

func (c *Client) GetFlow(ctx context.Context, flowID string) (*Flow, error)

GetFlow retrieves a specific flow by ID

func (*Client) GetFlowsIterator

func (c *Client) GetFlowsIterator(options *ListFlowsOptions) *FlowIterator

GetFlowsIterator returns an iterator for listing flows with pagination.

func (*Client) GetRun

func (c *Client) GetRun(ctx context.Context, runID string) (*RunResponse, error)

GetRun retrieves a specific flow run by ID

func (*Client) GetRunLogs

func (c *Client) GetRunLogs(ctx context.Context, runID string, limit, offset int) (*RunLogList, error)

GetRunLogs retrieves logs for a specific run

func (*Client) GetRunLogsIterator

func (c *Client) GetRunLogsIterator(runID string, limit int) *RunLogIterator

GetRunLogsIterator returns an iterator for listing run logs with pagination.

func (*Client) GetRunsIterator

func (c *Client) GetRunsIterator(options *ListRunsOptions) *RunIterator

GetRunsIterator returns an iterator for listing flow runs with pagination.

func (*Client) ListActionProviders

func (c *Client) ListActionProviders(ctx context.Context, options *ListActionProvidersOptions) (*ActionProviderList, error)

ListActionProviders lists all action providers

func (*Client) ListActionRoles

func (c *Client) ListActionRoles(ctx context.Context, providerID string, limit, offset int) (*ActionRoleList, error)

ListActionRoles lists all action roles for a provider

func (*Client) ListAllActionProviders

func (c *Client) ListAllActionProviders(ctx context.Context, options *ListActionProvidersOptions) ([]ActionProvider, error)

ListAllActionProviders lists all action providers using pagination, collecting all results. This is a convenience method that uses the ActionProviderIterator internally.

func (*Client) ListAllActionRoles

func (c *Client) ListAllActionRoles(ctx context.Context, providerID string) ([]ActionRole, error)

ListAllActionRoles lists all action roles for a provider using pagination, collecting all results. This is a convenience method that uses the ActionRoleIterator internally.

func (*Client) ListAllFlows

func (c *Client) ListAllFlows(ctx context.Context, options *ListFlowsOptions) ([]Flow, error)

ListAllFlows lists all flows using pagination, collecting all results. This is a convenience method that uses the FlowIterator internally.

func (*Client) ListAllRunLogs

func (c *Client) ListAllRunLogs(ctx context.Context, runID string) ([]RunLogEntry, error)

ListAllRunLogs lists all logs for a run using pagination, collecting all results. This is a convenience method that uses the RunLogIterator internally.

func (*Client) ListAllRuns

func (c *Client) ListAllRuns(ctx context.Context, options *ListRunsOptions) ([]RunResponse, error)

ListAllRuns lists all runs using pagination, collecting all results. This is a convenience method that uses the RunIterator internally.

func (*Client) ListFlows

func (c *Client) ListFlows(ctx context.Context, options *ListFlowsOptions) (*FlowList, error)

ListFlows lists all flows the user has access to

func (*Client) ListFlowsV2

func (c *Client) ListFlowsV2(ctx context.Context, options *ListFlowsOptions) (*response.FlowsResponse[FlowList], error)

ListFlowsV2 retrieves flows with unified response system

func (*Client) ListRuns

func (c *Client) ListRuns(ctx context.Context, options *ListRunsOptions) (*RunList, error)

ListRuns lists all flow runs the user has access to

func (*Client) RunFlow

func (c *Client) RunFlow(ctx context.Context, request *RunRequest) (*RunResponse, error)

RunFlow starts a new flow run

func (*Client) UpdateFlow

func (c *Client) UpdateFlow(ctx context.Context, flowID string, request *FlowUpdateRequest) (*Flow, error)

UpdateFlow updates an existing flow

func (*Client) UpdateRun

func (c *Client) UpdateRun(ctx context.Context, runID string, request *RunUpdateRequest) (*RunResponse, error)

UpdateRun updates a flow run's metadata

func (*Client) WaitForRun

func (c *Client) WaitForRun(ctx context.Context, runID string, pollInterval time.Duration) (*RunResponse, error)

WaitForRun waits for a flow run to complete or reach a terminal state. It returns the final run state or an error if the context is canceled or the polling fails.

type ClientOption

type ClientOption func(*clientOptions)

ClientOption configures a Flows client

func WithAccessToken

func WithAccessToken(accessToken string) ClientOption

WithAccessToken sets the access token for authorization

func WithAuthorizer

func WithAuthorizer(authorizer auth.Authorizer) ClientOption

WithAuthorizer sets the authorizer for the client

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL sets the base URL for the client

func WithCoreOption

func WithCoreOption(option core.ClientOption) ClientOption

WithCoreOption adds a core option

func WithHTTPDebugging

func WithHTTPDebugging(enable bool) ClientOption

WithHTTPDebugging enables HTTP debugging

func WithHTTPTracing

func WithHTTPTracing(enable bool) ClientOption

WithHTTPTracing enables HTTP tracing

type ErrInvalidFlowTimer

type ErrInvalidFlowTimer struct {
	Field   string
	Message string
}

ErrInvalidFlowTimer is returned when a FlowTimer is invalid

func (ErrInvalidFlowTimer) Error

func (e ErrInvalidFlowTimer) Error() string

type ErrorResponse

type ErrorResponse struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	RequestID string `json:"request_id,omitempty"`
	Resource  string `json:"resource,omitempty"`
}

ErrorResponse represents an error response from the Globus Flows API.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error implements the error interface for ErrorResponse.

type Flow

type Flow struct {
	ID            string                 `json:"id,omitempty"`
	UserID        string                 `json:"user_id,omitempty"`
	Title         string                 `json:"title"`
	Description   string                 `json:"description,omitempty"`
	FlowOwner     string                 `json:"flow_owner,omitempty"`
	SubsID        string                 `json:"subscription_id,omitempty"`
	CreatedAt     time.Time              `json:"created_at,omitempty"`
	UpdatedAt     time.Time              `json:"updated_at,omitempty"`
	Definition    map[string]interface{} `json:"definition"`
	InputSchema   map[string]interface{} `json:"input_schema,omitempty"`
	Keywords      []string               `json:"keywords,omitempty"`
	RunCount      int                    `json:"run_count,omitempty"`
	Public        bool                   `json:"public,omitempty"`
	Managed       bool                   `json:"managed,omitempty"`
	AdminOnly     bool                   `json:"admin_only,omitempty"`
	RunsRequired  bool                   `json:"runs_required,omitempty"`
	RunAsApprover bool                   `json:"run_as_approver,omitempty"`
}

Flow represents a Globus Flow definition

type FlowCreateRequest

type FlowCreateRequest struct {
	Title         string                 `json:"title"`
	Description   string                 `json:"description,omitempty"`
	Definition    map[string]interface{} `json:"definition"`
	InputSchema   map[string]interface{} `json:"input_schema,omitempty"`
	Keywords      []string               `json:"keywords,omitempty"`
	Public        bool                   `json:"public,omitempty"`
	Managed       bool                   `json:"managed,omitempty"`
	AdminOnly     bool                   `json:"admin_only,omitempty"`
	RunsRequired  bool                   `json:"runs_required,omitempty"`
	RunAsApprover bool                   `json:"run_as_approver,omitempty"`
}

FlowCreateRequest represents a request to create a new Flow

type FlowIterator

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

FlowIterator provides an iterator for flows that handles pagination automatically.

func NewFlowIterator

func NewFlowIterator(client *Client, options *ListFlowsOptions) *FlowIterator

NewFlowIterator creates a new iterator for flows.

func (*FlowIterator) Err

func (i *FlowIterator) Err() error

Err returns any error that occurred during iteration.

func (*FlowIterator) Flow

func (i *FlowIterator) Flow() *Flow

Flow returns the current flow in the iterator.

func (*FlowIterator) Next

func (i *FlowIterator) Next(ctx context.Context) bool

Next fetches the next flow in the iterator. Returns false when there are no more flows or an error occurred.

type FlowList

type FlowList struct {
	Flows   []Flow `json:"flows"`
	Total   int    `json:"total"`
	HadMore bool   `json:"had_more"`
	Offset  int    `json:"offset"`
	Limit   int    `json:"limit"`
}

FlowList represents a list of Flows

type FlowNotFoundError

type FlowNotFoundError struct {
	FlowID string
	*ErrorResponse
}

FlowNotFoundError indicates that a requested flow was not found.

func (*FlowNotFoundError) Error

func (e *FlowNotFoundError) Error() string

Error implements the error interface for FlowNotFoundError.

type FlowTimer

type FlowTimer struct {
	// Name is a human-readable name for the timer
	Name string `json:"name"`

	// FlowID is the UUID of the flow to execute
	FlowID string `json:"flow_id"`

	// FlowInput is the input data to pass to the flow when it executes
	FlowInput map[string]interface{} `json:"flow_input"`

	// Schedule defines when the flow should be triggered
	Schedule TimerSchedule `json:"schedule"`

	// CallbackURL is an optional URL to call when the flow completes
	// If provided, the Globus Flows service will POST the flow result to this URL
	CallbackURL string `json:"callback_url,omitempty"`

	// FlowScope is the scope required to run the flow
	// If not specified, defaults to the flow's required scope
	FlowScope string `json:"flow_scope,omitempty"`

	// RunManagers are optional identity IDs that can manage flow runs
	RunManagers []string `json:"run_managers,omitempty"`

	// RunMonitors are optional identity IDs that can monitor flow runs
	RunMonitors []string `json:"run_monitors,omitempty"`
}

FlowTimer represents a timer payload for scheduled flow execution v3.65.0: Added FlowTimer payload class for integration with Globus Timers

FlowTimer provides a structured way to define scheduled flow executions using the Globus Timers service. This allows flows to be triggered automatically based on time-based schedules.

func NewFlowTimer

func NewFlowTimer(name, flowID string, flowInput map[string]interface{}, schedule TimerSchedule) *FlowTimer

NewFlowTimer creates a new FlowTimer with the specified parameters v3.65.0: Convenience constructor for FlowTimer

func (*FlowTimer) Validate

func (ft *FlowTimer) Validate() error

Validate checks if the FlowTimer is valid

func (*FlowTimer) WithCallbackURL

func (ft *FlowTimer) WithCallbackURL(url string) *FlowTimer

WithCallbackURL sets the callback URL for the FlowTimer

func (*FlowTimer) WithFlowScope

func (ft *FlowTimer) WithFlowScope(scope string) *FlowTimer

WithFlowScope sets the flow scope for the FlowTimer

func (*FlowTimer) WithRunManagers

func (ft *FlowTimer) WithRunManagers(managers []string) *FlowTimer

WithRunManagers sets the run managers for the FlowTimer

func (*FlowTimer) WithRunMonitors

func (ft *FlowTimer) WithRunMonitors(monitors []string) *FlowTimer

WithRunMonitors sets the run monitors for the FlowTimer

type FlowUpdateRequest

type FlowUpdateRequest struct {
	Title         string                 `json:"title,omitempty"`
	Description   string                 `json:"description,omitempty"`
	Definition    map[string]interface{} `json:"definition,omitempty"`
	InputSchema   map[string]interface{} `json:"input_schema,omitempty"`
	Keywords      []string               `json:"keywords,omitempty"`
	Public        *bool                  `json:"public,omitempty"`
	Managed       *bool                  `json:"managed,omitempty"`
	AdminOnly     *bool                  `json:"admin_only,omitempty"`
	RunsRequired  *bool                  `json:"runs_required,omitempty"`
	RunAsApprover *bool                  `json:"run_as_approver,omitempty"`
}

FlowUpdateRequest represents a request to update a Flow

type ForbiddenError

type ForbiddenError struct {
	*ErrorResponse
}

ForbiddenError indicates that the user does not have permission to perform the requested action.

func (*ForbiddenError) Error

func (e *ForbiddenError) Error() string

Error implements the error interface for ForbiddenError.

type ListActionProvidersOptions

type ListActionProvidersOptions struct {
	Limit        int    `url:"limit,omitempty"`
	Offset       int    `url:"offset,omitempty"`
	Marker       string `url:"marker,omitempty"`
	PerPage      int    `url:"per_page,omitempty"` // Alias for Limit
	OrderBy      string `url:"orderby,omitempty"`
	Q            string `url:"q,omitempty"`
	FilterOwner  string `url:"filter_owner,omitempty"`
	FilterType   string `url:"filter_type,omitempty"`
	FilterGlobus bool   `url:"filter_globus,omitempty"`
}

ListActionProvidersOptions represents options for listing action providers

type ListFlowsOptions

type ListFlowsOptions struct {
	Limit        int    `url:"limit,omitempty"`
	Offset       int    `url:"offset,omitempty"`
	Marker       string `url:"marker,omitempty"`
	PerPage      int    `url:"per_page,omitempty"` // Alias for Limit
	OrderBy      string `url:"orderby,omitempty"`
	Q            string `url:"q,omitempty"`
	FilterRoles  string `url:"filter_roles,omitempty"`
	FilterOwner  string `url:"filter_owner,omitempty"`
	FilterPublic bool   `url:"filter_public,omitempty"`
	RolesOnly    bool   `url:"roles_only,omitempty"`
}

ListFlowsOptions represents options for listing Flows

type ListRunsOptions

type ListRunsOptions struct {
	Limit    int    `url:"limit,omitempty"`
	Offset   int    `url:"offset,omitempty"`
	Marker   string `url:"marker,omitempty"`
	PerPage  int    `url:"per_page,omitempty"` // Alias for Limit
	OrderBy  string `url:"orderby,omitempty"`
	Q        string `url:"q,omitempty"`
	FlowID   string `url:"flow_id,omitempty"`
	Status   string `url:"status,omitempty"`
	RoleType string `url:"role_type,omitempty"`
	Label    string `url:"label,omitempty"`
}

ListRunsOptions represents options for listing Flow runs

type RunIterator

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

RunIterator provides an iterator for flow runs that handles pagination automatically.

func NewRunIterator

func NewRunIterator(client *Client, options *ListRunsOptions) *RunIterator

NewRunIterator creates a new iterator for flow runs.

func (*RunIterator) Err

func (i *RunIterator) Err() error

Err returns any error that occurred during iteration.

func (*RunIterator) Next

func (i *RunIterator) Next(ctx context.Context) bool

Next fetches the next run in the iterator. Returns false when there are no more runs or an error occurred.

func (*RunIterator) Run

func (i *RunIterator) Run() *RunResponse

Run returns the current run in the iterator.

type RunList

type RunList struct {
	Runs    []RunResponse `json:"runs"`
	Total   int           `json:"total"`
	HadMore bool          `json:"had_more"`
	Offset  int           `json:"offset"`
	Limit   int           `json:"limit"`
}

RunList represents a list of Flow runs

type RunLogEntry

type RunLogEntry struct {
	Code        string                 `json:"code"`
	RunID       string                 `json:"run_id"`
	CreatedAt   time.Time              `json:"created_at"`
	Details     map[string]interface{} `json:"details,omitempty"`
	Description string                 `json:"description"`
}

RunLogEntry represents an entry in a Flow run log

type RunLogIterator

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

RunLogIterator provides an iterator for run logs that handles pagination automatically.

func NewRunLogIterator

func NewRunLogIterator(client *Client, runID string, limit int) *RunLogIterator

NewRunLogIterator creates a new iterator for run logs.

func (*RunLogIterator) Err

func (i *RunLogIterator) Err() error

Err returns any error that occurred during iteration.

func (*RunLogIterator) LogEntry

func (i *RunLogIterator) LogEntry() *RunLogEntry

LogEntry returns the current log entry in the iterator.

func (*RunLogIterator) Next

func (i *RunLogIterator) Next(ctx context.Context) bool

Next fetches the next log entry in the iterator. Returns false when there are no more entries or an error occurred.

type RunLogList

type RunLogList struct {
	Entries []RunLogEntry `json:"entries"`
	Total   int           `json:"total"`
	HadMore bool          `json:"had_more"`
	Offset  int           `json:"offset"`
	Limit   int           `json:"limit"`
}

RunLogList represents a list of Flow run logs

type RunMutableFields

type RunMutableFields struct {
	Label       string   `json:"label,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	RunManagers []string `json:"run_managers,omitempty"`
	RunMonitors []string `json:"run_monitors,omitempty"`
}

RunMutableFields contains the fields that can be modified on a Flow run

type RunNotFoundError

type RunNotFoundError struct {
	RunID string
	*ErrorResponse
}

RunNotFoundError indicates that a requested run was not found.

func (*RunNotFoundError) Error

func (e *RunNotFoundError) Error() string

Error implements the error interface for RunNotFoundError.

type RunRequest

type RunRequest struct {
	FlowID        string                 `json:"flow_id"`
	FlowTitle     string                 `json:"flow_title,omitempty"`
	FlowScope     string                 `json:"flow_scope,omitempty"`
	Label         string                 `json:"label,omitempty"`
	Tags          []string               `json:"tags,omitempty"`
	RunManagers   []string               `json:"run_managers,omitempty"`
	RunMonitors   []string               `json:"run_monitors,omitempty"`
	RunManagersRW bool                   `json:"run_managers_rw,omitempty"`
	Input         map[string]interface{} `json:"input"`
	ManageBy      string                 `json:"manage_by,omitempty"`
	MonitorBy     string                 `json:"monitor_by,omitempty"`
}

RunRequest represents a request to run a Flow

type RunResponse

type RunResponse struct {
	RunID       string                 `json:"run_id"`
	FlowID      string                 `json:"flow_id"`
	Status      string                 `json:"status"`
	CreatedAt   time.Time              `json:"created_at"`
	StartedAt   time.Time              `json:"started_at,omitempty"`
	CompletedAt time.Time              `json:"completed_at,omitempty"`
	Label       string                 `json:"label,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	UserID      string                 `json:"user_id"`
	RunOwner    string                 `json:"run_owner"`
	RunManagers []string               `json:"run_managers,omitempty"`
	RunMonitors []string               `json:"run_monitors,omitempty"`
	Input       map[string]interface{} `json:"input,omitempty"`
	Output      map[string]interface{} `json:"output,omitempty"`
	FlowTitle   string                 `json:"flow_title,omitempty"`
	FlowScope   string                 `json:"flow_scope,omitempty"`
}

RunResponse represents a Flow run

type RunUpdateRequest

type RunUpdateRequest struct {
	Label       string   `json:"label,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	RunManagers []string `json:"run_managers,omitempty"`
	RunMonitors []string `json:"run_monitors,omitempty"`
}

RunUpdateRequest represents a request to update a Flow run

type TimerSchedule

type TimerSchedule struct {
	// Type is the schedule type: "cron", "interval", or "once"
	Type string `json:"type"`

	// Value is the schedule value
	// - For "cron": a cron expression (e.g., "0 0 * * *" for daily at midnight)
	// - For "interval": an ISO 8601 duration (e.g., "PT1H" for every hour)
	// - For "once": an ISO 8601 timestamp (e.g., "2025-01-01T00:00:00Z")
	Value string `json:"value"`

	// Timezone is the IANA timezone name (e.g., "America/New_York")
	// Only applicable for "cron" schedules
	// Defaults to UTC if not specified
	Timezone string `json:"timezone,omitempty"`

	// StartTime is an optional start time for the schedule (ISO 8601 timestamp)
	// The timer will not trigger before this time
	StartTime string `json:"start_time,omitempty"`

	// EndTime is an optional end time for the schedule (ISO 8601 timestamp)
	// The timer will not trigger after this time
	EndTime string `json:"end_time,omitempty"`
}

TimerSchedule defines when a flow should be executed v3.65.0: Schedule definition for FlowTimer

func NewCronSchedule

func NewCronSchedule(cronExpression, timezone string) TimerSchedule

NewCronSchedule creates a cron-based schedule v3.65.0: Convenience constructor for cron schedules

Example: NewCronSchedule("0 0 * * *", "America/New_York") // Daily at midnight EST

func NewIntervalSchedule

func NewIntervalSchedule(duration string) TimerSchedule

NewIntervalSchedule creates an interval-based schedule v3.65.0: Convenience constructor for interval schedules

Example: NewIntervalSchedule("PT1H") // Every hour

func NewOnceSchedule

func NewOnceSchedule(when time.Time) TimerSchedule

NewOnceSchedule creates a one-time schedule v3.65.0: Convenience constructor for one-time schedules

Example: NewOnceSchedule(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC))

func (*TimerSchedule) WithEndTime

func (ts *TimerSchedule) WithEndTime(t time.Time) *TimerSchedule

WithEndTime sets the end time for the schedule

func (*TimerSchedule) WithStartTime

func (ts *TimerSchedule) WithStartTime(t time.Time) *TimerSchedule

WithStartTime sets the start time for the schedule

type ValidationError

type ValidationError struct {
	*ErrorResponse
}

ValidationError indicates that the request failed validation.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface for ValidationError.

Jump to

Keyboard shortcuts

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