Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview

Namejobs
TypeResource
Idgoogle.storagebatchoperations.jobs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringIdentifier. The resource name of the job. Format: projects/{project_id}/locations/global/jobs/{job_id}. For example: projects/123456/locations/global/jobs/job01. job_id is unique in a given project.
bucketListobjectSpecifies a list of buckets and their objects to be transformed. (id: BucketList)
completeTimestring (google-datetime)Output only. The time that the job was completed.
countersobjectOutput only. Information about the progress of the job. (id: Counters)
createTimestring (google-datetime)Output only. The time that the job was created.
deleteObjectobjectDelete objects. (id: DeleteObject)
descriptionstringOptional. A user-provided description for the job. Maximum length: 1024 bytes when unicode-encoded.
dryRunbooleanOptional. If true, the job runs in dry run mode, returning the total object count and, if the object configuration is a prefix list, the bytes found from source. No transformations are performed.
errorSummariesarrayOutput only. Summarizes errors encountered with sample error log entries.
isMultiBucketJobbooleanOutput only. If true, this job operates on multiple buckets. Multi-bucket jobs are subject to different quota limits than single-bucket jobs.
loggingConfigobjectOptional. Logging configuration. (id: LoggingConfig)
projectSourceobjectSpecifies a project source and filters to identify objects to be transformed. (id: ProjectSource)
putMetadataobjectUpdates object metadata. Allows updating fixed-key and custom metadata. For example, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Type, Custom-Time, and Retention configuration. (id: PutMetadata)
putObjectHoldobjectChanges object hold status. (id: PutObjectHold)
rewriteObjectobjectRewrite the object and updates metadata like KMS key. (id: RewriteObject)
scheduleTimestring (google-datetime)Output only. The time that the job was scheduled.
setObjectAclsobjectUpdates object ACLs. (id: SetObjectAcls)
statestringOutput only. State of the job. (STATE_UNSPECIFIED, RUNNING, SUCCEEDED, CANCELED, FAILED, QUEUED)
updateObjectCustomContextobjectUpdate object custom context. (id: UpdateObjectCustomContext)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, jobsIdGets a batch job.
listselectprojectsId, locationsIdfilter, pageSize, orderBy, pageTokenLists Jobs in a given project.
createinsertprojectsId, locationsIdjobId, requestIdCreates a batch job.
deletedeleteprojectsId, locationsId, jobsIdrequestId, forceDeletes a batch job.
cancelexecprojectsId, locationsId, jobsIdCancels a batch job.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
jobsIdstring
locationsIdstring
projectsIdstring
filterstring
forceboolean
jobIdstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring

SELECT examples

Gets a batch job.

SELECT
name,
bucketList,
completeTime,
counters,
createTime,
deleteObject,
description,
dryRun,
errorSummaries,
isMultiBucketJob,
loggingConfig,
projectSource,
putMetadata,
putObjectHold,
rewriteObject,
scheduleTime,
setObjectAcls,
state,
updateObjectCustomContext
FROM google.storagebatchoperations.jobs
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND jobsId = '{{ jobsId }}' -- required
;

INSERT examples

Creates a batch job.

INSERT INTO google.storagebatchoperations.jobs (
data__updateObjectCustomContext,
data__setObjectAcls,
data__name,
data__putMetadata,
data__bucketList,
data__putObjectHold,
data__projectSource,
data__rewriteObject,
data__dryRun,
data__deleteObject,
data__description,
data__loggingConfig,
projectsId,
locationsId,
jobId,
requestId
)
SELECT
'{{ updateObjectCustomContext }}',
'{{ setObjectAcls }}',
'{{ name }}',
'{{ putMetadata }}',
'{{ bucketList }}',
'{{ putObjectHold }}',
'{{ projectSource }}',
'{{ rewriteObject }}',
{{ dryRun }},
'{{ deleteObject }}',
'{{ description }}',
'{{ loggingConfig }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ jobId }}',
'{{ requestId }}'
RETURNING
name,
done,
error,
metadata,
response
;

DELETE examples

Deletes a batch job.

DELETE FROM google.storagebatchoperations.jobs
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND jobsId = '{{ jobsId }}' --required
AND requestId = '{{ requestId }}'
AND force = '{{ force }}'
;

Lifecycle Methods

Cancels a batch job.

EXEC google.storagebatchoperations.jobs.cancel
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@jobsId='{{ jobsId }}' --required
@@json=
'{
"requestId": "{{ requestId }}"
}'
;