module

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright (c) 2022 Intel Corporation

Index

Constants

View Source
const MAX_DESCRIPTION_LEN int = 1024

It implements the interface for managing the ClusterProviders

View Source
const MAX_USERDATA_LEN int = 4096

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	WorkflowIntentClient *WorkflowIntentClient
}

Client for using the services in the ncm

func NewClient

func NewClient() *Client

NewClient creates a new client for using the services

type ClientDbInfo

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

type Metadata

type Metadata struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"-"`
	UserData1   string `json:"userData1" yaml:"-"`
	UserData2   string `json:"userData2" yaml:"-"`
}

type WfClientSpec

type WfClientSpec struct {
	WfClientEndpointName string `json:"clientEndpointName"`
	WfClientEndpointPort int    `json:"clientEndpointPort"`
}

WfClientSpec is the network endpoint at which the workflow client resides.

type WfTemporalCancelRequest

type WfTemporalCancelRequest struct {
	Metadata Metadata                    `json:"metadata,omitempty"`
	Spec     WfTemporalCancelRequestSpec `json:"spec"`
}

WfTemporalCancelRequest encapsulates a workflow cancel request. It is the body of the POST call to "/cancel" API. Only the spec field is of relevance, but emcoctl adds a 'metadata' field anyway.

func (WfTemporalCancelRequest) String

func (r WfTemporalCancelRequest) String() string

type WfTemporalCancelRequestSpec

type WfTemporalCancelRequestSpec struct {
	// The Temporal server's endpoint. E.g. "temporal.foo.com:7233". Required.
	TemporalServer string `json:"temporalServer"`
	// If WfID is specified, that overrides the one in the workflow intent.
	WfID  string `json:"workflowID,omitempty"`
	RunID string `json:"runID,omitempty"`
	// If Terminate == true, TerminateWorkflow() is called, else CancelWorkflow().
	Terminate bool          `json:"terminate,omitempty"`
	Reason    string        `json:"reason,omitempty"`
	Details   []interface{} `json:"details,omitempty"`
}

WfTemporalCancelRequestSpec is the set of parameters needed to invoke the CancelWorkflow/TerminateWorkflow APIs. Most fields, except the TemporalServer, are optional.

type WfTemporalStatusQuery

type WfTemporalStatusQuery struct {
	// The Temporal server's endpoint. E.g. "temporal.foo.com:7233"
	TemporalServer string `json:"temporalServer"`
	// Temporal workflow ID. TODO get this from workflow intent if not provided.
	WfID string `json:"workflowID"`
	// Temporal Run ID. If it is "", the open or latest closed wf run is used.
	RunID string `json:"runID,omitempty"`
	// WaitForResult=true: block till workflow completes.
	WaitForResult bool `json:"waitForResult,omitempty"`
	// If true, run the DescribeWorkflowExecution API.
	RunDescribeWfExec bool `json:"runDescribeWfExec,omitempty"`
	// If true, run the GetWorkflowHistory API.
	// If WaitForResult = true, this returns all history events, incl.
	// those yet to happen (using  a long poll). If false, it returns only
	// current events.
	// TODO There is an option to return just the last event; if
	// WaitForResult = true, this would be the last event which contains
	// the workflow execution end result. For now, we always return all
	// events, either till now or till the end.
	GetWfHistory bool `json:"getWfHistory,omitempty"`
	// See docs.temporal.io/docs/go/how-to-send-a-query-to-a-workflow-execution-in-go
	QueryType   string        `json:"queryType,omitempty"`
	QueryParams []interface{} `json:"queryParams,omitempty"`
}

WfTemporalStatusQuery encapsulates the data needed to check status of a Temporal workflow from EMCO. It includes various flags to indicate the types of status queries to be run.

func (WfTemporalStatusQuery) String

func (q WfTemporalStatusQuery) String() string

Implement Stringer interface for query/response structs, so they can be logged.

type WfTemporalStatusResponse

type WfTemporalStatusResponse struct {
	WfID  string `json:"workflowID"`
	RunID string `json:"runID,omitempty"`

	// TODO This is a dump from temporal. Needs polishing.
	WfExecDesc wfsvc.DescribeWorkflowExecutionResponse `json:"workflowExecutionDescription,omitempty"`

	WfHistory []history.HistoryEvent `json:"workflowHistory,omitempty"`
	// For WfResult to be logged, it must implement the Stringer interface.
	WfResult interface{} `json:"workflowResult,omitempty"`
	// For WfQueryResult to be logged, it must implement the Stringer interface.
	WfQueryResult interface{} `json:"workflowQueryResult,omitempty"`
}

WfTemporalStatusResponse is the aggregation of responses from various Temporal status APIs.

func (WfTemporalStatusResponse) String

func (r WfTemporalStatusResponse) String() string

type WorkflowIntent

type WorkflowIntent struct {
	Metadata Metadata           `json:"metadata"`
	Spec     WorkflowIntentSpec `json:"spec"`
}

WorkflowIntent contains the parameters needed for managing workflows

type WorkflowIntentClient

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

WorkflowIntentClient implements the Manager It will also be used to maintain some localized state

func NewWorkflowIntentClient

func NewWorkflowIntentClient() *WorkflowIntentClient

NewWorkflowIntentClient returns an instance of the WorkflowIntentClient which implements the Manager

func (*WorkflowIntentClient) CancelWorkflowIntent

func (v *WorkflowIntentClient) CancelWorkflowIntent(ctx context.Context, name,
	project, cApp, cAppVer, dig string, req *WfTemporalCancelRequest) error

Cancel/terminate the Workflow

func (*WorkflowIntentClient) CreateWorkflowIntent

func (v *WorkflowIntentClient) CreateWorkflowIntent(ctx context.Context, wfi WorkflowIntent,
	project, cApp, cAppVer, dig string, exists bool) (WorkflowIntent, error)

CreateWorkflowIntent - create a new WorkflowIntent

func (*WorkflowIntentClient) DeleteWorkflowIntent

func (v *WorkflowIntentClient) DeleteWorkflowIntent(ctx context.Context, name,
	project, cApp, cAppVer, dig string) error

Delete the WorkflowIntent from database

func (*WorkflowIntentClient) GetStatusWorkflowIntent

func (v *WorkflowIntentClient) GetStatusWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer,
	dig string, query *WfTemporalStatusQuery) (*WfTemporalStatusResponse, error)

GetStatusWorkflowIntent performs different types of Temporal workflow status queries depending on the flags specified in the status API call.

func (*WorkflowIntentClient) GetWorkflowIntent

func (v *WorkflowIntentClient) GetWorkflowIntent(ctx context.Context, name,
	project, cApp, cAppVer, dig string) (WorkflowIntent, error)

GetWorkflowIntent returns the named Workflow intent.

func (*WorkflowIntentClient) GetWorkflowIntents

func (v *WorkflowIntentClient) GetWorkflowIntents(ctx context.Context,
	project, cApp, cAppVer, dig string) ([]WorkflowIntent, error)

GetWorkflowIntents returns all WorkflowIntents for a DIG.

func (*WorkflowIntentClient) StartWorkflowIntent

func (v *WorkflowIntentClient) StartWorkflowIntent(ctx context.Context, name,
	project, cApp, cAppVer, dig string) error

Start the workflow

type WorkflowIntentKey

type WorkflowIntentKey struct {
	WorkflowIntent      string `json:"workflowIntent"`
	Project             string `json:"project"`
	CompositeApp        string `json:"compositeApp"`
	CompositeAppVersion string `json:"compositeAppVersion"`
	DigName             string `json:"deploymentIntentGroup"`
}

WorkflowIntentKey is the key structure that is used in the database

type WorkflowIntentManager

type WorkflowIntentManager interface {
	CreateWorkflowIntent(ctx context.Context, wfi WorkflowIntent, project, cApp, cAppVer, dig string, exists bool) (WorkflowIntent, error)
	GetWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer, dig string) (WorkflowIntent, error)
	GetWorkflowIntents(ctx context.Context, project, cApp, cAppVer, dig string) ([]WorkflowIntent, error)
	DeleteWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer, dig string) error
	StartWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer, dig string) error
	GetStatusWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer, dig string,
		query *WfTemporalStatusQuery) (*WfTemporalStatusResponse, error)
	CancelWorkflowIntent(ctx context.Context, name, project, cApp, cAppVer, dig string,
		req *WfTemporalCancelRequest) error
}

Manager is an interface exposing the WorkflowIntent functionality

type WorkflowIntentSpec

type WorkflowIntentSpec struct {
	// Network endpoint at which the workflow client resides.
	WfClientSpec WfClientSpec `json:"workflowClient"`
	// See emcotemporalapi package.
	WfTemporalSpec tmpl.WfTemporalSpec `json:"temporal"`
}

WorkflowIntentSpec is the specification of an EMCO workflow intemt,

Jump to

Keyboard shortcuts

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