jobs

package
v0.0.0-...-8a984d7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

These contents are copied and slightly modified from aws-sdk-go-v2 https://github.com/aws/aws-sdk-go-v2/tree/main/service/iotjobsdataplane SPDX-License-Identifier: Apache-2.0

These contents are copied and slightly modified from aws-sdk-go-v2 https://github.com/aws/aws-sdk-go-v2/tree/main/service/iotjobsdataplane SPDX-License-Identifier: Apache-2.0

These contents are copied and slightly modified from aws-sdk-go-v2 https://github.com/aws/aws-sdk-go-v2/tree/main/service/iotjobsdataplane SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(payload []byte) error

Types

type Client

type Client struct {
	Timeouts time.Duration
	// contains filtered or unexported fields
}

func NewClient

func NewClient(mc mqtt.Client) (*Client, error)

func (*Client) DescribeJobExecution

func (client *Client) DescribeJobExecution(ctx context.Context, thingName string, jobId string, req DescribeJobExecutionInput) (ret DescribeJobExecutionOutput, err error)

DescribeJobExecution gets detailed information about a job execution.

func (*Client) GetPendingJobExecutions

func (client *Client) GetPendingJobExecutions(ctx context.Context, thingName string, req iotjobsdataplane.GetPendingJobExecutionsInput) (ret iotjobsdataplane.GetPendingJobExecutionsOutput, err error)

GetPendingJobExecutions gets detailed information about a job execution.

func (*Client) JobExecutionsChanged

func (client *Client) JobExecutionsChanged(ctx context.Context, thingName string, handler JobExecutionsChangedHandler)

JobExecutionsChanged sent whenever a job execution is added to or removed from the list of pending job executions for a thing.

func (*Client) NextJobExecutionChanged

func (client *Client) NextJobExecutionChanged(ctx context.Context, thingName string, handler NextJobExecutionChangedHandler)

NextJobExecutionChanged sent whenever there is a change to which job execution is next on the list of pending job executions for a thing

func (*Client) SetTimeout

func (client *Client) SetTimeout(dur time.Duration)

SetTimeout sets the timeout before a response is returned for an accepted or rejected topic. The default is 1 second. In a slow connection environment, it is recommended to set a longer time.

func (*Client) StartNextPendingJobExecution

func (client *Client) StartNextPendingJobExecution(ctx context.Context, thingName string, req iotjobsdataplane.StartNextPendingJobExecutionInput) (ret StartNextPendingJobExecutionOutput, err error)

StartNextPendingJobExecution gets and starts the next pending job execution for a thing

func (*Client) UpdateJobExecution

func (client *Client) UpdateJobExecution(ctx context.Context, thingName string, jobId string, req UpdateJobExecutionInput) (ret iotjobsdataplane.UpdateJobExecutionOutput, err error)

UpdateJobExecution updates the status of a job execution.

type DescribeJobExecutionInput

type DescribeJobExecutionInput struct {
	// Optional. A number that identifies a particular job execution on a particular
	// device. If not specified, the latest job execution is returned.
	ExecutionNumber *int64 `json:"executionNumber,omitempty"`

	// Optional. When set to true, the response contains the job document. The default
	// is false.
	IncludeJobDocument *bool `json:"includeJobDocument,omitempty"`

	ClientToken string `json:"clientToken,omitempty"`
}

type DescribeJobExecutionOutput

type DescribeJobExecutionOutput struct {
	// Contains data about a job execution.
	Execution *JobExecution `json:"execution"`

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	ClientToken string `json:"clientToken"`
	Timestamp   int    `json:"timestamp"`
}

type ErrorMessage

type ErrorMessage struct {
	ClientToken string `json:"clientToken"`
	Timestamp   int    `json:"timestamp"`
	Code        string `json:"code"`
	Message     string `json:"message"`
}

ErrorMessage represents messages if request failed

type JobDocument

type JobDocument struct {
	Comment string `json:"_comment"`
	Version string `json:"version"`
	Steps   []struct {
		Action struct {
			Name  string `json:"name"`
			Type  string `json:"type"`
			Input struct {
				Handler string   `json:"handler"`
				Args    []string `json:"args"`
				Path    string   `json:"path"`
			} `json:"input"`
			RunAsUser string `json:"runAsUser"`
		} `json:"action"`
	} `json:"steps"`
	FinalStep struct {
		Action struct {
			Name  string `json:"name"`
			Type  string `json:"type"`
			Input struct {
				Handler string   `json:"handler"`
				Args    []string `json:"args"`
				Path    string   `json:"path"`
			} `json:"input"`
			RunAsUser string `json:"runAsUser"`
		} `json:"action"`
	} `json:"finalStep"`
}

JobDocument represents JobDocument based on this document. https://github.com/awslabs/aws-iot-device-client/tree/main/sample-job-docs

type JobExecution

type JobExecution struct {

	// The estimated number of seconds that remain before the job execution status will
	// be changed to TIMED_OUT.
	ApproximateSecondsBeforeTimedOut *int64

	// A number that identifies a particular job execution on a particular device. It
	// can be used later in commands that return or update job execution information.
	ExecutionNumber *int64 `json:"executionNumber"`

	// The content of the job document.
	JobDocument JobDocument `json:"jobDocument"`

	// The unique identifier you assigned to this job when it was created.
	JobId *string `json:"jobId"`

	// The time, in milliseconds since the epoch, when the job execution was last
	// updated.
	LastUpdatedAt int64 `json:"lastUpdatedAt"`

	// The time, in milliseconds since the epoch, when the job execution was enqueued.
	QueuedAt int64 `json:"queuedAt"`

	// The time, in milliseconds since the epoch, when the job execution was started.
	StartedAt *int64 `json:"startedAt"`

	// The status of the job execution. Can be one of: "QUEUED", "IN_PROGRESS",
	// "FAILED", "SUCCESS", "CANCELED", "REJECTED", or "REMOVED".
	Status JobExecutionStatus `json:"status"`

	// A collection of name/value pairs that describe the status of the job execution.
	StatusDetails map[string]string `json:"statusDetails"`

	// The name of the thing that is executing the job.
	ThingName *string `json:"thingName"`

	// The version of the job execution. Job execution versions are incremented each
	// time they are updated by a device.
	VersionNumber int64 `json:"versionNumber"`

	ClientToken string `json:"clientToken"`
	Timestamp   int    `json:"timestamp"`
}

Contains data about a job execution. https://docs.aws.amazon.com/iot/latest/developerguide/jobs-mqtt-https-api.html#jobs-mqtt-job-execution-data

type JobExecutionState

type JobExecutionState struct {

	// The status of the job execution. Can be one of: "QUEUED", "IN_PROGRESS",
	// "FAILED", "SUCCESS", "CANCELED", "REJECTED", or "REMOVED".
	Status JobExecutionStatus

	// A collection of name/value pairs that describe the status of the job execution.
	StatusDetails map[string]string

	// The version of the job execution. Job execution versions are incremented each
	// time they are updated by a device.
	VersionNumber int64
}

Contains data about the state of a job execution.

type JobExecutionStatus

type JobExecutionStatus string
const (
	JobExecutionStatusQueued     JobExecutionStatus = "QUEUED"
	JobExecutionStatusInProgress JobExecutionStatus = "IN_PROGRESS"
	JobExecutionStatusSucceeded  JobExecutionStatus = "SUCCEEDED"
	JobExecutionStatusFailed     JobExecutionStatus = "FAILED"
	JobExecutionStatusTimedOut   JobExecutionStatus = "TIMED_OUT"
	JobExecutionStatusRejected   JobExecutionStatus = "REJECTED"
	JobExecutionStatusRemoved    JobExecutionStatus = "REMOVED"
	JobExecutionStatusCanceled   JobExecutionStatus = "CANCELED"
)

Enum values for JobExecutionStatus

func (JobExecutionStatus) Values

Values returns all known values for JobExecutionStatus. Note that this can be expanded in the future, and so it is only as up to date as the client. The ordering of this slice is not guaranteed to be stable across updates.

type JobExecutionSummary

type JobExecutionSummary struct {

	// A number that identifies a particular job execution on a particular device.
	ExecutionNumber *int64 `json:"executionNumber"`

	// The unique identifier you assigned to this job when it was created.
	JobId *string `json:"jobId"`

	// The time, in milliseconds since the epoch, when the job execution was last
	// updated.
	LastUpdatedAt int64 `json:"lastUpdatedAt"`

	// The time, in milliseconds since the epoch, when the job execution was enqueued.
	QueuedAt int64 `json:"queuedAt"`

	// The time, in milliseconds since the epoch, when the job execution started.
	StartedAt *int64 `json:"startedAt"`

	// The version of the job execution. Job execution versions are incremented each
	// time AWS IoT Jobs receives an update from a device.
	VersionNumber int64 `json:"versionNumber"`
}

Contains a subset of information about a job execution.

type JobExecutions

type JobExecutions []JobExecution

type JobExecutionsChangedHandler

type JobExecutionsChangedHandler func(cli *Client, msg JobExecutionsChangedMessage) error

type JobExecutionsChangedMessage

type JobExecutionsChangedMessage struct {
	Timestamp int                                  `json:"timestamp"`
	Jobs      map[JobExecutionStatus]JobExecutions `json:"jobs"`
}

type NextJobExecutionChangedHandler

type NextJobExecutionChangedHandler func(cli *Client, msg NextJobExecutionChangedMessage) error

type NextJobExecutionChangedMessage

type NextJobExecutionChangedMessage struct {
	Timestamp int          `json:"timestamp"`
	Execution JobExecution `json:"execution"`
}

type StartNextPendingJobExecutionOutput

type StartNextPendingJobExecutionOutput struct {

	// A JobExecution object.
	Execution *JobExecution `json:"execution"`

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata `json:"-"`

	ClientToken string `json:"clientToken"`
	Timestamp   int    `json:"timestamp"`
}

type UpdateJobExecutionInput

type UpdateJobExecutionInput struct {
	// The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or
	// REJECTED). This must be specified on every update.
	//
	// This member is required.
	Status types.JobExecutionStatus `json:"status"`

	// Optional. A number that identifies a particular job execution on a particular
	// device.
	ExecutionNumber *int64 `json:"executionNumber"`

	// Optional. The expected current version of the job execution. Each time you
	// update the job execution, its version is incremented. If the version of the job
	// execution stored in Jobs does not match, the update is rejected with a
	// VersionMismatch error, and an ErrorResponse that contains the current job
	// execution status data is returned. (This makes it unnecessary to perform a
	// separate DescribeJobExecution request in order to obtain the job execution
	// status data.)
	ExpectedVersion *int64 `json:"expectedVersion"`

	// Optional. When set to true, the response contains the job document. The default
	// is false.
	IncludeJobDocument *bool `json:"includeJobDocument"`

	// Optional. When included and set to true, the response contains the
	// JobExecutionState data. The default is false.
	IncludeJobExecutionState *bool `json:"includeJobExecutionState"`

	// Optional. A collection of name/value pairs that describe the status of the job
	// execution. If not specified, the statusDetails are unchanged.
	StatusDetails map[string]string `json:"statusDetails"`

	// Specifies the amount of time this device has to finish execution of this job. If
	// the job execution status is not set to a terminal state before this timer
	// expires, or before the timer is reset (by again calling UpdateJobExecution,
	// setting the status to IN_PROGRESS and specifying a new timeout value in this
	// field) the job execution status will be automatically set to TIMED_OUT. Note
	// that setting or resetting this timeout has no effect on that job execution
	// timeout which may have been specified when the job was created (CreateJob using
	// field timeoutConfig).
	StepTimeoutInMinutes *int64 `json:"stepTimeoutInMinutes"`

	ClientToken string `json:"clientToken"`
	Timestamp   int    `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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