jobs

package
v0.0.0-...-837eb61 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package jobs is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Query_OrderType_name = map[int32]string{
		0: "ASC",
		1: "DESC",
	}
	Query_OrderType_value = map[string]int32{
		"ASC":  0,
		"DESC": 1,
	}
)

Enum value maps for Query_OrderType.

View Source
var File_external_compliance_scanner_jobs_jobs_proto protoreflect.FileDescriptor

Functions

func RegisterJobsServiceHandler

func RegisterJobsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterJobsServiceHandler registers the http handlers for service JobsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterJobsServiceHandlerClient

func RegisterJobsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client JobsServiceClient) error

RegisterJobsServiceHandlerClient registers the http handlers for service JobsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "JobsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "JobsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "JobsServiceClient" to call the correct interceptors.

func RegisterJobsServiceHandlerFromEndpoint

func RegisterJobsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterJobsServiceHandlerFromEndpoint is same as RegisterJobsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterJobsServiceHandlerServer

func RegisterJobsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server JobsServiceServer) error

RegisterJobsServiceHandlerServer registers the http handlers for service JobsService to "mux". UnaryRPC :call JobsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterJobsServiceServer

func RegisterJobsServiceServer(s *grpc.Server, srv JobsServiceServer)

Types

type Id

type Id struct {

	// Unique ID (UUID) assigned to object.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Name of object.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Id) Descriptor deprecated

func (*Id) Descriptor() ([]byte, []int)

Deprecated: Use Id.ProtoReflect.Descriptor instead.

func (*Id) GetId

func (x *Id) GetId() string

func (*Id) GetName

func (x *Id) GetName() string

func (*Id) ProtoMessage

func (*Id) ProtoMessage()

func (*Id) ProtoReflect

func (x *Id) ProtoReflect() protoreflect.Message

func (*Id) Reset

func (x *Id) Reset()

func (*Id) String

func (x *Id) String() string

type Job

type Job struct {

	// Unique ID (UUID) of the scan job.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// User-specified name of the scan job.
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// Determines the type of Chef InSpec run, `detect` or `exec`.
	Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// Desired timeout (in seconds) for the scan job execution. Default: 7200 for exec jobs, 600 for detect jobs.
	Timeout int32 `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// Tags to assign to the scan job.
	Tags []*query.Kv `protobuf:"bytes,20,rep,name=tags,proto3" json:"tags,omitempty"`
	// Start time of the scan job, assigned by the service.
	StartTime *timestamppb.Timestamp `protobuf:"bytes,21,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	// End time of the scan job, assigned by the service.
	EndTime *timestamppb.Timestamp `protobuf:"bytes,22,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// Status of the scan job, assigned by the service.
	Status string `protobuf:"bytes,23,opt,name=status,proto3" json:"status,omitempty"`
	// Number of times to retry the scan job. Default: 3.
	Retries int32 `protobuf:"varint,26,opt,name=retries,proto3" json:"retries,omitempty"`
	// Number of retries left, assigned by the service.
	RetriesLeft int32 `protobuf:"varint,27,opt,name=retries_left,json=retriesLeft,proto3" json:"retries_left,omitempty"`
	// Results of the scan job, including a report ID if one was generated.
	Results []*ResultsRow `protobuf:"bytes,28,rep,name=results,proto3" json:"results,omitempty"`
	// List of node IDs to associate with the scan job.
	Nodes []string `protobuf:"bytes,100,rep,name=nodes,proto3" json:"nodes,omitempty"`
	// List of profiles to execute as part of the scan job.
	Profiles []string `protobuf:"bytes,101,rep,name=profiles,proto3" json:"profiles,omitempty"`
	// Count of nodes to be scanned as part of the job, assigned by the service.
	NodeCount int32 `protobuf:"varint,102,opt,name=node_count,json=nodeCount,proto3" json:"node_count,omitempty"`
	// Count of profiles to be executed as part of the job.
	ProfileCount int32 `protobuf:"varint,103,opt,name=profile_count,json=profileCount,proto3" json:"profile_count,omitempty"`
	// Set of node manager IDs and filters to associate with the scan job.
	NodeSelectors []*ManagerFilter `protobuf:"bytes,104,rep,name=node_selectors,json=nodeSelectors,proto3" json:"node_selectors,omitempty"`
	// Next scheduled scan execution time.
	ScheduledTime *timestamppb.Timestamp `protobuf:"bytes,105,opt,name=scheduled_time,json=scheduledTime,proto3" json:"scheduled_time,omitempty"`
	// Recurrence schedule string for the job.
	Recurrence string `protobuf:"bytes,106,opt,name=recurrence,proto3" json:"recurrence,omitempty"`
	// ID of parent job to associate with the job, if any.
	ParentId string `protobuf:"bytes,107,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
	// Count of scans executed by the job.
	JobCount int32 `protobuf:"varint,108,opt,name=job_count,json=jobCount,proto3" json:"job_count,omitempty"`
	// Boolean used to denote the job has been marked as "deleted" by the user.
	Deleted bool `protobuf:"varint,109,opt,name=deleted,proto3" json:"deleted,omitempty"`
	// contains filtered or unexported fields
}

func (*Job) Descriptor deprecated

func (*Job) Descriptor() ([]byte, []int)

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetDeleted

func (x *Job) GetDeleted() bool

func (*Job) GetEndTime

func (x *Job) GetEndTime() *timestamppb.Timestamp

func (*Job) GetId

func (x *Job) GetId() string

func (*Job) GetJobCount

func (x *Job) GetJobCount() int32

func (*Job) GetName

func (x *Job) GetName() string

func (*Job) GetNodeCount

func (x *Job) GetNodeCount() int32

func (*Job) GetNodeSelectors

func (x *Job) GetNodeSelectors() []*ManagerFilter

func (*Job) GetNodes

func (x *Job) GetNodes() []string

func (*Job) GetParentId

func (x *Job) GetParentId() string

func (*Job) GetProfileCount

func (x *Job) GetProfileCount() int32

func (*Job) GetProfiles

func (x *Job) GetProfiles() []string

func (*Job) GetRecurrence

func (x *Job) GetRecurrence() string

func (*Job) GetResults

func (x *Job) GetResults() []*ResultsRow

func (*Job) GetRetries

func (x *Job) GetRetries() int32

func (*Job) GetRetriesLeft

func (x *Job) GetRetriesLeft() int32

func (*Job) GetScheduledTime

func (x *Job) GetScheduledTime() *timestamppb.Timestamp

func (*Job) GetStartTime

func (x *Job) GetStartTime() *timestamppb.Timestamp

func (*Job) GetStatus

func (x *Job) GetStatus() string

func (*Job) GetTags

func (x *Job) GetTags() []*query.Kv

func (*Job) GetTimeout

func (x *Job) GetTimeout() int32

func (*Job) GetType

func (x *Job) GetType() string

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) ProtoReflect

func (x *Job) ProtoReflect() protoreflect.Message

func (*Job) Reset

func (x *Job) Reset()

func (*Job) String

func (x *Job) String() string

type Jobs

type Jobs struct {

	// List of jobs.
	Jobs []*Job `protobuf:"bytes,1,rep,name=jobs,proto3" json:"jobs,omitempty"`
	// Total number of jobs in the system.
	Total int32 `protobuf:"varint,20,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*Jobs) Descriptor deprecated

func (*Jobs) Descriptor() ([]byte, []int)

Deprecated: Use Jobs.ProtoReflect.Descriptor instead.

func (*Jobs) GetJobs

func (x *Jobs) GetJobs() []*Job

func (*Jobs) GetTotal

func (x *Jobs) GetTotal() int32

func (*Jobs) ProtoMessage

func (*Jobs) ProtoMessage()

func (*Jobs) ProtoReflect

func (x *Jobs) ProtoReflect() protoreflect.Message

func (*Jobs) Reset

func (x *Jobs) Reset()

func (*Jobs) String

func (x *Jobs) String() string

type JobsServiceClient

type JobsServiceClient interface {
	// Create a scan job
	//
	// Creates a scan job. A scan job executes Chef InSpec against the specified nodes.
	// Requires a user-specified name. Type should be `detect` (checks if the node is reachable and reports the
	// platform information for the nodes) or `exec` (executes a set of profiles against the nodes).
	// Nodes to scan may be specified by including an array of node IDs to scan or a node manager ID along with some optional
	// filtering information.
	// Exec jobs require at least one profile to be used as part of the Chef InSpec scan.
	// Optional recurrence schedules enable regularly scheduled (repeating) scans.
	//
	// Example:
	// “`
	// {
	// "name": "my testjob",
	// "tags": [],
	// "type": "exec",
	// "nodes": ["i07uc612-7e97-43f2-9b19-256abh785820"],
	// "profiles": ["https://github.com/dev-sec/linux-baseline/archive/master.tar.gz", "compliance://admin/ssh-baseline#2.2.0"],
	// "retries": 1,
	// "node_selectors":[
	// {
	// "manager_id":"e69dc612-7e67-43f2-9b19-256afd385820",
	// "filters":[{"key":"name","values":["ins*"],"exclude":false}]
	// }
	// ],
	// "recurrence":"DTSTART=20191231T045100Z;FREQ=DAILY;INTERVAL=1"
	// }
	// “`
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:create
	Create(ctx context.Context, in *Job, opts ...grpc.CallOption) (*Id, error)
	// Read a scan job
	//
	// Read the details of a scan job given an ID.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:get
	Read(ctx context.Context, in *Id, opts ...grpc.CallOption) (*Job, error)
	// Update a job
	//
	// PUT operation to update the details for a scan job, such as the name, profiles, node set, or recurrence schedule.
	// Please note that this is a PUT operation, so all scan job details included in the create function
	// should be included in the PUT message to update.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:update
	Update(ctx context.Context, in *Job, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete a scan job
	//
	// Delete a scan job given an ID. Note this does not delete the report(s) generated by the scan job.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:delete
	Delete(ctx context.Context, in *Id, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// List of scan jobs
	//
	// Returns a list of scan jobs matching the query.
	// Supports filtering, sorting, and pagination.
	// Valid filtering fields: job_type, parent_job, status
	// Valid sorting fields: name, type, status, start_time, end_time
	//
	// Example:
	// “`
	// {
	// "filters":[
	// {"key":"job_type","values":["exec"]},
	// {"key":"parent_job","values":[""]}
	// ],
	// "page":1,
	// "per_page":100,
	// "sort":"end_time",
	// "order":"DESC"
	// }
	// “`
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:list
	List(ctx context.Context, in *Query, opts ...grpc.CallOption) (*Jobs, error)
	// Rerun a scan job
	//
	// Does not create a new job in the database. Reads the job info given the job ID
	// and runs a scan. The latest job information is then updated to reflect this latest run.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:rerun
	Rerun(ctx context.Context, in *Id, opts ...grpc.CallOption) (*RerunResponse, error)
}

JobsServiceClient is the client API for JobsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type JobsServiceServer

type JobsServiceServer interface {
	// Create a scan job
	//
	// Creates a scan job. A scan job executes Chef InSpec against the specified nodes.
	// Requires a user-specified name. Type should be `detect` (checks if the node is reachable and reports the
	// platform information for the nodes) or `exec` (executes a set of profiles against the nodes).
	// Nodes to scan may be specified by including an array of node IDs to scan or a node manager ID along with some optional
	// filtering information.
	// Exec jobs require at least one profile to be used as part of the Chef InSpec scan.
	// Optional recurrence schedules enable regularly scheduled (repeating) scans.
	//
	// Example:
	// “`
	// {
	// "name": "my testjob",
	// "tags": [],
	// "type": "exec",
	// "nodes": ["i07uc612-7e97-43f2-9b19-256abh785820"],
	// "profiles": ["https://github.com/dev-sec/linux-baseline/archive/master.tar.gz", "compliance://admin/ssh-baseline#2.2.0"],
	// "retries": 1,
	// "node_selectors":[
	// {
	// "manager_id":"e69dc612-7e67-43f2-9b19-256afd385820",
	// "filters":[{"key":"name","values":["ins*"],"exclude":false}]
	// }
	// ],
	// "recurrence":"DTSTART=20191231T045100Z;FREQ=DAILY;INTERVAL=1"
	// }
	// “`
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:create
	Create(context.Context, *Job) (*Id, error)
	// Read a scan job
	//
	// Read the details of a scan job given an ID.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:get
	Read(context.Context, *Id) (*Job, error)
	// Update a job
	//
	// PUT operation to update the details for a scan job, such as the name, profiles, node set, or recurrence schedule.
	// Please note that this is a PUT operation, so all scan job details included in the create function
	// should be included in the PUT message to update.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:update
	Update(context.Context, *Job) (*emptypb.Empty, error)
	// Delete a scan job
	//
	// Delete a scan job given an ID. Note this does not delete the report(s) generated by the scan job.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:delete
	Delete(context.Context, *Id) (*emptypb.Empty, error)
	// List of scan jobs
	//
	// Returns a list of scan jobs matching the query.
	// Supports filtering, sorting, and pagination.
	// Valid filtering fields: job_type, parent_job, status
	// Valid sorting fields: name, type, status, start_time, end_time
	//
	// Example:
	// “`
	// {
	// "filters":[
	// {"key":"job_type","values":["exec"]},
	// {"key":"parent_job","values":[""]}
	// ],
	// "page":1,
	// "per_page":100,
	// "sort":"end_time",
	// "order":"DESC"
	// }
	// “`
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:list
	List(context.Context, *Query) (*Jobs, error)
	// Rerun a scan job
	//
	// Does not create a new job in the database. Reads the job info given the job ID
	// and runs a scan. The latest job information is then updated to reflect this latest run.
	//
	// Authorization Action:
	//
	// “`
	// “`
	//
	//compliance:scannerJobs:rerun
	Rerun(context.Context, *Id) (*RerunResponse, error)
}

JobsServiceServer is the server API for JobsService service.

type ManagerFilter

type ManagerFilter struct {

	// Unique ID of a node manager.
	ManagerId string `protobuf:"bytes,1,opt,name=manager_id,json=managerId,proto3" json:"manager_id,omitempty"`
	// Use filters to limit the set of items returned.
	Filters []*query.Filter `protobuf:"bytes,2,rep,name=filters,proto3" json:"filters,omitempty"`
	// contains filtered or unexported fields
}

func (*ManagerFilter) Descriptor deprecated

func (*ManagerFilter) Descriptor() ([]byte, []int)

Deprecated: Use ManagerFilter.ProtoReflect.Descriptor instead.

func (*ManagerFilter) GetFilters

func (x *ManagerFilter) GetFilters() []*query.Filter

func (*ManagerFilter) GetManagerId

func (x *ManagerFilter) GetManagerId() string

func (*ManagerFilter) ProtoMessage

func (*ManagerFilter) ProtoMessage()

func (*ManagerFilter) ProtoReflect

func (x *ManagerFilter) ProtoReflect() protoreflect.Message

func (*ManagerFilter) Reset

func (x *ManagerFilter) Reset()

func (*ManagerFilter) String

func (x *ManagerFilter) String() string

type Query

type Query struct {

	// Use filters to limit the set of items returned.
	Filters []*query.Filter `protobuf:"bytes,20,rep,name=filters,proto3" json:"filters,omitempty"`
	Order   Query_OrderType `` /* 131-byte string literal not displayed */
	// Sort the results on a specific field.
	Sort string `protobuf:"bytes,22,opt,name=sort,proto3" json:"sort,omitempty"`
	// Starting page for the results.
	Page int32 `protobuf:"varint,23,opt,name=page,proto3" json:"page,omitempty"`
	// The number of results on each page.
	PerPage int32 `protobuf:"varint,24,opt,name=per_page,json=perPage,proto3" json:"per_page,omitempty"`
	// contains filtered or unexported fields
}

func (*Query) Descriptor deprecated

func (*Query) Descriptor() ([]byte, []int)

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetFilters

func (x *Query) GetFilters() []*query.Filter

func (*Query) GetOrder

func (x *Query) GetOrder() Query_OrderType

func (*Query) GetPage

func (x *Query) GetPage() int32

func (*Query) GetPerPage

func (x *Query) GetPerPage() int32

func (*Query) GetSort

func (x *Query) GetSort() string

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

type Query_OrderType

type Query_OrderType int32

Return the results in ascending or descending order.

const (
	Query_ASC  Query_OrderType = 0
	Query_DESC Query_OrderType = 1
)

func (Query_OrderType) Descriptor

func (Query_OrderType) Enum

func (x Query_OrderType) Enum() *Query_OrderType

func (Query_OrderType) EnumDescriptor deprecated

func (Query_OrderType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Query_OrderType.Descriptor instead.

func (Query_OrderType) Number

func (Query_OrderType) String

func (x Query_OrderType) String() string

func (Query_OrderType) Type

type RerunResponse

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

func (*RerunResponse) Descriptor deprecated

func (*RerunResponse) Descriptor() ([]byte, []int)

Deprecated: Use RerunResponse.ProtoReflect.Descriptor instead.

func (*RerunResponse) ProtoMessage

func (*RerunResponse) ProtoMessage()

func (*RerunResponse) ProtoReflect

func (x *RerunResponse) ProtoReflect() protoreflect.Message

func (*RerunResponse) Reset

func (x *RerunResponse) Reset()

func (*RerunResponse) String

func (x *RerunResponse) String() string

type ResultsRow

type ResultsRow struct {

	// ID of the scanned node.
	NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
	// ID of the report generated by the scan.
	ReportId string `protobuf:"bytes,2,opt,name=report_id,json=reportId,proto3" json:"report_id,omitempty"`
	// Status of the scan (completed, failed, aborted).
	Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	// Result error message for failed scans.
	Result string `protobuf:"bytes,4,opt,name=result,proto3" json:"result,omitempty"`
	// ID of the scan.
	JobId string `protobuf:"bytes,5,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// Start time of the scan.
	StartTime *timestamppb.Timestamp `protobuf:"bytes,20,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	// End time of the scan.
	EndTime *timestamppb.Timestamp `protobuf:"bytes,21,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	// contains filtered or unexported fields
}

func (*ResultsRow) Descriptor deprecated

func (*ResultsRow) Descriptor() ([]byte, []int)

Deprecated: Use ResultsRow.ProtoReflect.Descriptor instead.

func (*ResultsRow) GetEndTime

func (x *ResultsRow) GetEndTime() *timestamppb.Timestamp

func (*ResultsRow) GetJobId

func (x *ResultsRow) GetJobId() string

func (*ResultsRow) GetNodeId

func (x *ResultsRow) GetNodeId() string

func (*ResultsRow) GetReportId

func (x *ResultsRow) GetReportId() string

func (*ResultsRow) GetResult

func (x *ResultsRow) GetResult() string

func (*ResultsRow) GetStartTime

func (x *ResultsRow) GetStartTime() *timestamppb.Timestamp

func (*ResultsRow) GetStatus

func (x *ResultsRow) GetStatus() string

func (*ResultsRow) ProtoMessage

func (*ResultsRow) ProtoMessage()

func (*ResultsRow) ProtoReflect

func (x *ResultsRow) ProtoReflect() protoreflect.Message

func (*ResultsRow) Reset

func (x *ResultsRow) Reset()

func (*ResultsRow) String

func (x *ResultsRow) String() string

type UnimplementedJobsServiceServer

type UnimplementedJobsServiceServer struct {
}

UnimplementedJobsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedJobsServiceServer) Create

func (*UnimplementedJobsServiceServer) Delete

func (*UnimplementedJobsServiceServer) List

func (*UnimplementedJobsServiceServer) Read

func (*UnimplementedJobsServiceServer) Rerun

func (*UnimplementedJobsServiceServer) Update

Jump to

Keyboard shortcuts

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