protocol

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 25 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBearer

func AddBearer(header http.Header, token string)

func AddContentType

func AddContentType(header http.Header, apiversion string)

func AddHeaders

func AddHeaders(header http.Header)

Types

type ActionStep

type ActionStep struct {
	Type             string
	Reference        ActionStepDefinitionReference
	DisplayNameToken *TemplateToken
	ContextName      string
	Environment      *TemplateToken
	Inputs           *TemplateToken
	Condition        string
	ContinueOnError  *TemplateToken
	TimeoutInMinutes *TemplateToken
}

type ActionStepDefinitionReference

type ActionStepDefinitionReference struct {
	Type           string
	Image          string
	Name           string
	Ref            string
	RepositoryType string
	Path           string
}

type ActionsEnvironmentReference

type ActionsEnvironmentReference struct {
	Name *string `json:",omitempty"`
	URL  *string `json:",omitempty"`
}

type AgentJobRequestMessage

type AgentJobRequestMessage struct {
	MessageType          string
	Plan                 *TaskOrchestrationPlanReference
	Timeline             *TimeLineReference
	JobID                string
	JobDisplayName       string
	JobName              string
	JobContainer         *TemplateToken
	JobServiceContainers *TemplateToken
	JobOutputs           *TemplateToken
	RequestID            int64
	LockedUntil          string
	Resources            *JobResources
	ContextData          map[string]PipelineContextData
	Workspace            *WorkspaceOptions
	MaskHints            []MaskHint `json:"mask"`
	EnvironmentVariables []TemplateToken
	Defaults             []TemplateToken
	ActionsEnvironment   *ActionsEnvironmentReference
	Variables            map[string]VariableValue
	Steps                []ActionStep
	FileTable            []string
}

func (*AgentJobRequestMessage) GetConnection added in v0.3.0

func (jobreq *AgentJobRequestMessage) GetConnection(name string) (*VssConnection, map[string]string, error)

type AgentLabel

type AgentLabel struct {
	ID   int
	Name string
	Type string
}

type AgentMessageConnection

type AgentMessageConnection struct {
	VssConnection    *VssConnection
	TaskAgentSession *TaskAgentSession
	Block            cipher.Block
}

func (*AgentMessageConnection) Delete

func (session *AgentMessageConnection) Delete() error

func (*AgentMessageConnection) DeleteMessage

func (session *AgentMessageConnection) DeleteMessage(message *TaskAgentMessage) error

func (*AgentMessageConnection) GetNextMessage

func (session *AgentMessageConnection) GetNextMessage(ctx context.Context) (*TaskAgentMessage, error)

type BufferedLiveLogger added in v0.3.0

type BufferedLiveLogger struct {
	LiveLogger
	// contains filtered or unexported fields
}

func (*BufferedLiveLogger) Close added in v0.3.0

func (logger *BufferedLiveLogger) Close() error

func (*BufferedLiveLogger) SendLog added in v0.3.0

func (logger *BufferedLiveLogger) SendLog(wrapper *TimelineRecordFeedLinesWrapper) error

type ConnectionData

type ConnectionData struct {
	LocationServiceData LocationServiceData
}

func (*ConnectionData) GetServiceDefinition

func (connectionData *ConnectionData) GetServiceDefinition(id string) *ServiceDefinition

type DictionaryContextDataPair

type DictionaryContextDataPair struct {
	Key   string              `json:"k"`
	Value PipelineContextData `json:"v"`
}

type GitHubAuthResult

type GitHubAuthResult struct {
	TenantURL   string `json:"url"`
	TokenSchema string `json:"token_schema"`
	Token       string `json:"token"`
}

type GitHubRunnerRegisterToken

type GitHubRunnerRegisterToken struct {
	Token     string `json:"token"`
	ExpiresAt string `json:"expires_at"`
}

type Issue

type Issue struct {
	Type                  string // notice, error or warning
	Category              string
	Message               string
	IsInfrastructureIssue *bool
	Data                  map[string]string
}

type JobAuthorization

type JobAuthorization struct {
	Parameters map[string]string
	Scheme     string
}

type JobEndpoint

type JobEndpoint struct {
	Data          map[string]string
	Name          string
	URL           string
	Authorization JobAuthorization
	IsShared      bool
	IsReady       bool
}

type JobEvent

type JobEvent struct {
	Name               string
	JobID              string
	RequestID          int64
	Result             string
	Outputs            *map[string]VariableValue    `json:",omitempty"`
	ActionsEnvironment *ActionsEnvironmentReference `json:",omitempty"`
}

type JobLogger added in v0.3.0

type JobLogger struct {
	JobRequest      *AgentJobRequestMessage
	Connection      *VssConnection
	TimelineRecords *TimelineRecordWrapper
	CurrentRecord   int64
	CurrentLine     int64
	JobBuffer       bytes.Buffer
	CurrentBuffer   bytes.Buffer

	Logger LiveLogger
	// contains filtered or unexported fields
}

func (*JobLogger) Append added in v0.3.0

func (logger *JobLogger) Append(record TimelineRecord) *TimelineRecord

func (*JobLogger) Current added in v0.3.0

func (logger *JobLogger) Current() *TimelineRecord

func (*JobLogger) Finish added in v0.3.0

func (logger *JobLogger) Finish()

func (*JobLogger) Insert added in v0.3.0

func (logger *JobLogger) Insert(record TimelineRecord) *TimelineRecord

func (*JobLogger) Log added in v0.3.0

func (logger *JobLogger) Log(lines string)

func (*JobLogger) MoveNext added in v0.3.0

func (logger *JobLogger) MoveNext() *TimelineRecord

func (*JobLogger) Update added in v0.3.0

func (logger *JobLogger) Update() error

func (*JobLogger) Write added in v0.3.0

func (logger *JobLogger) Write(p []byte) (n int, err error)

type JobResources

type JobResources struct {
	Endpoints []JobEndpoint
}

type LiveLogger added in v0.3.0

type LiveLogger interface {
	io.Closer
	SendLog(lines *TimelineRecordFeedLinesWrapper) error
}

type LocationServiceData

type LocationServiceData struct {
	ServiceDefinitions []ServiceDefinition
}

type MapEntry

type MapEntry struct {
	Key   *TemplateToken
	Value *TemplateToken
}

type MaskHint

type MaskHint struct {
	Type  string
	Value string
}

type PipelineContextData

type PipelineContextData struct {
	Type            *int32                       `json:"t,omitempty"`
	BoolValue       *bool                        `json:"b,omitempty"`
	NumberValue     *float64                     `json:"n,omitempty"`
	StringValue     *string                      `json:"s,omitempty"`
	ArrayValue      *[]PipelineContextData       `json:"a,omitempty"`
	DictionaryValue *[]DictionaryContextDataPair `json:"d,omitempty"`
}

func (PipelineContextData) ToRawObject

func (ctx PipelineContextData) ToRawObject() interface{}

func (*PipelineContextData) UnmarshalJSON

func (ctx *PipelineContextData) UnmarshalJSON(data []byte) error

type RenewAgent

type RenewAgent struct {
	RequestID int64
}

type RunnerAddRemove

type RunnerAddRemove struct {
	URL         string `json:"url"`
	RunnerEvent string `json:"runner_event"`
}

type ServiceDefinition

type ServiceDefinition struct {
	ServiceType       string
	Identifier        string
	DisplayName       string
	RelativeToSetting string
	RelativePath      string
	Description       string
	ServiceOwner      string
	ResourceVersion   int
}

type TaskAgent

type TaskAgent struct {
	Authorization     TaskAgentAuthorization
	Labels            []AgentLabel
	MaxParallelism    int
	ID                int
	Name              string
	Version           string
	OSDescription     string
	Enabled           *bool `json:",omitempty"`
	ProvisioningState string
	AccessPoint       string `json:",omitempty"`
	CreatedOn         string
	Ephemeral         bool `json:",omitempty"`
}

func (*TaskAgent) Authorize

func (taskAgent *TaskAgent) Authorize(c *http.Client, key interface{}) (*VssOAuthTokenResponse, error)

type TaskAgentAuthorization

type TaskAgentAuthorization struct {
	AuthorizationURL string `json:",omitempty"`
	ClientID         string `json:",omitempty"`
	PublicKey        TaskAgentPublicKey
}

type TaskAgentMessage

type TaskAgentMessage struct {
	MessageID   int64
	MessageType string
	IV          string
	Body        string
}

func (*TaskAgentMessage) Decrypt added in v0.3.0

func (message *TaskAgentMessage) Decrypt(block cipher.Block) ([]byte, error)

type TaskAgentPool

type TaskAgentPool struct {
	TaskAgentPoolReference
}

type TaskAgentPoolReference

type TaskAgentPoolReference struct {
	ID    int64
	Scope string
	// PoolType   int
	Name       string
	IsHosted   bool
	IsInternal bool
	Size       int64
}

type TaskAgentPools

type TaskAgentPools struct {
	Count int64
	Value []TaskAgentPool
}

type TaskAgentPublicKey

type TaskAgentPublicKey struct {
	Exponent string
	Modulus  string
}

type TaskAgentSession

type TaskAgentSession struct {
	SessionID         string `json:",omitempty"`
	EncryptionKey     TaskAgentSessionKey
	OwnerName         string
	Agent             TaskAgent
	UseFipsEncryption bool
}

func (*TaskAgentSession) GetSessionKey

func (session *TaskAgentSession) GetSessionKey(key *rsa.PrivateKey) (cipher.Block, error)

type TaskAgentSessionKey

type TaskAgentSessionKey struct {
	Encrypted bool
	Value     string
}

type TaskAgents

type TaskAgents struct {
	Count int64
	Value []TaskAgent
}

type TaskLog

type TaskLog struct {
	TaskLogReference
	IndexLocation *string `json:",omitempty"`
	Path          *string `json:",omitempty"`
	LineCount     *int64  `json:",omitempty"`
	CreatedOn     string
	LastChangedOn string
}

type TaskLogReference

type TaskLogReference struct {
	ID       int
	Location *string
}

type TaskOrchestrationPlanReference

type TaskOrchestrationPlanReference struct {
	ScopeIdentifier string
	PlanID          string
	PlanType        string
}

type TemplateToken

type TemplateToken struct {
	FileID    *int32
	Line      *int32
	Column    *int32
	Type      int32
	Bool      *bool
	Num       *float64
	Lit       *string
	Expr      *string
	Directive *string
	Seq       *[]TemplateToken
	Map       *[]MapEntry
}

func (*TemplateToken) FromRawObject

func (token *TemplateToken) FromRawObject(value interface{})

func (*TemplateToken) ToJSONRawObject added in v0.3.0

func (token *TemplateToken) ToJSONRawObject() interface{}

func (*TemplateToken) ToRawObject

func (token *TemplateToken) ToRawObject() interface{}

func (*TemplateToken) ToYamlNode

func (token *TemplateToken) ToYamlNode() *yaml.Node

func (*TemplateToken) UnmarshalJSON

func (token *TemplateToken) UnmarshalJSON(data []byte) error

type TimeLineReference

type TimeLineReference struct {
	ID       string
	ChangeID int
	Location *interface{}
}

type TimelineAttempt

type TimelineAttempt struct {
}

type TimelineRecord

type TimelineRecord struct {
	ID               string
	TimelineID       string
	ParentID         string
	Type             string
	Name             string
	StartTime        string
	FinishTime       *string
	CurrentOperation *string
	PercentComplete  int32
	State            string
	Result           *string
	ResultCode       *string
	ChangeID         int32
	LastModified     string
	WorkerName       string
	Order            int32
	RefName          string
	Log              *TaskLogReference
	Details          *TimeLineReference
	ErrorCount       int
	WarningCount     int
	Issues           []Issue
	Location         string
	Attempt          int32
	Identifier       *string
	AgentPlatform    string
	PreviousAttempts []TimelineAttempt
	Variables        map[string]VariableValue
}

func CreateTimelineEntry

func CreateTimelineEntry(parent string, refname string, name string) TimelineRecord

func (*TimelineRecord) Complete

func (rec *TimelineRecord) Complete(res string)

func (*TimelineRecord) Start

func (rec *TimelineRecord) Start()

type TimelineRecordFeedLinesWrapper

type TimelineRecordFeedLinesWrapper struct {
	Count     int64
	Value     []string
	StepID    string
	StartLine *int64
}

type TimelineRecordWrapper

type TimelineRecordWrapper struct {
	Count int64
	Value []*TimelineRecord
}

type VariableValue

type VariableValue struct {
	Value    string
	IsSecret bool
}

type VssConnection

type VssConnection struct {
	Client    *http.Client
	TenantURL string

	Token     string
	PoolID    int64
	TaskAgent *TaskAgent
	Key       *rsa.PrivateKey
	Trace     bool
	// contains filtered or unexported fields
}

func (*VssConnection) BuildURL added in v0.3.0

func (vssConnection *VssConnection) BuildURL(relativePath string, ppath map[string]string, query map[string]string) (string, error)

func (*VssConnection) CreateSession

func (vssConnection *VssConnection) CreateSession() (*AgentMessageConnection, error)

func (*VssConnection) DeleteAgent

func (vssConnection *VssConnection) DeleteAgent(taskAgent *TaskAgent) error

func (*VssConnection) FinishJob

func (vssConnection *VssConnection) FinishJob(e *JobEvent, plan *TaskOrchestrationPlanReference) error

func (*VssConnection) GetAgentPools

func (vssConnection *VssConnection) GetAgentPools() (*TaskAgentPools, error)

func (*VssConnection) GetConnectionData

func (vssConnection *VssConnection) GetConnectionData() *ConnectionData

func (*VssConnection) GetServiceURL added in v0.3.0

func (vssConnection *VssConnection) GetServiceURL(ctx context.Context, serviceID string, urlParameter map[string]string, queryParameter map[string]string) (string, error)

func (*VssConnection) LoadSession

func (vssConnection *VssConnection) LoadSession(session *TaskAgentSession) (*AgentMessageConnection, error)

func (*VssConnection) Request

func (vssConnection *VssConnection) Request(serviceID string, protocol string, method string, urlParameter map[string]string, queryParameter map[string]string, requestBody interface{}, responseBody interface{}) error

func (*VssConnection) RequestWithContext

func (vssConnection *VssConnection) RequestWithContext(ctx context.Context, serviceID string, protocol string, method string, urlParameter map[string]string, queryParameter map[string]string, requestBody interface{}, responseBody interface{}) error

func (*VssConnection) RequestWithContext2 added in v0.3.0

func (vssConnection *VssConnection) RequestWithContext2(ctx context.Context, method string, url string, protocol string, requestBody interface{}, responseBody interface{}) error

func (*VssConnection) SendLogLines added in v0.3.0

func (vssConnection *VssConnection) SendLogLines(plan *TaskOrchestrationPlanReference, timelineID string, lines *TimelineRecordFeedLinesWrapper) error

func (*VssConnection) UpdateTimeLine

func (vssConnection *VssConnection) UpdateTimeLine(timelineID string, jobreq *AgentJobRequestMessage, wrap *TimelineRecordWrapper) error

func (*VssConnection) UploadLogFile

func (vssConnection *VssConnection) UploadLogFile(timelineID string, jobreq *AgentJobRequestMessage, logContent string) (int, error)

type VssLiveLogger added in v0.3.0

type VssLiveLogger struct {
	JobRequest *AgentJobRequestMessage
	Connection *VssConnection
}

func (*VssLiveLogger) Close added in v0.3.0

func (*VssLiveLogger) Close() error

func (*VssLiveLogger) SendLog added in v0.3.0

func (logger *VssLiveLogger) SendLog(wrapper *TimelineRecordFeedLinesWrapper) error

type VssOAuthTokenResponse

type VssOAuthTokenResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type WebsocketLivelogger added in v0.3.0

type WebsocketLivelogger struct {
	JobRequest *AgentJobRequestMessage
	Connection *VssConnection

	FeedStreamUrl string
	// contains filtered or unexported fields
}

func (*WebsocketLivelogger) Close added in v0.3.0

func (logger *WebsocketLivelogger) Close() error

func (*WebsocketLivelogger) Connect added in v0.3.0

func (logger *WebsocketLivelogger) Connect() error

func (*WebsocketLivelogger) SendLog added in v0.3.0

type WebsocketLiveloggerWithFallback added in v0.3.0

type WebsocketLiveloggerWithFallback struct {
	JobRequest *AgentJobRequestMessage
	Connection *VssConnection

	FeedStreamUrl string
	// contains filtered or unexported fields
}

func (*WebsocketLiveloggerWithFallback) Close added in v0.3.0

func (logger *WebsocketLiveloggerWithFallback) Close() error

func (*WebsocketLiveloggerWithFallback) Initialize added in v0.3.0

func (logger *WebsocketLiveloggerWithFallback) Initialize()

func (*WebsocketLiveloggerWithFallback) InitializeVssLogger added in v0.3.0

func (logger *WebsocketLiveloggerWithFallback) InitializeVssLogger()

func (*WebsocketLiveloggerWithFallback) SendLog added in v0.3.0

type WorkspaceOptions

type WorkspaceOptions struct {
	Clean *string `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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