Skip to main content

hooks

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

Overview​

Namehooks
TypeResource
Idgoogle.securesourcemanager.hooks

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringIdentifier. A unique identifier for a Hook. The name should be of the format: projects/{project}/locations/{location_id}/repositories/{repository_id}/hooks/{hook_id}
createTimestring (google-datetime)Output only. Create timestamp.
disabledbooleanOptional. Determines if the hook disabled or not. Set to true to stop sending traffic.
eventsarrayOptional. The events that trigger hook on.
pushOptionobjectOptional. The trigger option for push events. (id: PushOption)
sensitiveQueryStringstringOptional. The sensitive query string to be appended to the target URI.
targetUristringRequired. The target URI to which the payloads will be delivered.
uidstringOutput only. Unique identifier of the hook.
updateTimestring (google-datetime)Output only. Update timestamp.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, repositoriesId, hooksIdGets metadata of a hook.
listselectprojectsId, locationsId, repositoriesIdpageSize, pageTokenLists hooks in a given repository.
createinsertprojectsId, locationsId, repositoriesIdhookIdCreates a new hook in a given repository.
patchupdateprojectsId, locationsId, repositoriesId, hooksIdupdateMaskUpdates the metadata of a hook.
deletedeleteprojectsId, locationsId, repositoriesId, hooksIdDeletes a Hook.

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
hooksIdstring
locationsIdstring
projectsIdstring
repositoriesIdstring
hookIdstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples​

Gets metadata of a hook.

SELECT
name,
createTime,
disabled,
events,
pushOption,
sensitiveQueryString,
targetUri,
uid,
updateTime
FROM google.securesourcemanager.hooks
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND hooksId = '{{ hooksId }}' -- required
;

INSERT examples​

Creates a new hook in a given repository.

INSERT INTO google.securesourcemanager.hooks (
data__disabled,
data__events,
data__name,
data__pushOption,
data__sensitiveQueryString,
data__targetUri,
projectsId,
locationsId,
repositoriesId,
hookId
)
SELECT
{{ disabled }},
'{{ events }}',
'{{ name }}',
'{{ pushOption }}',
'{{ sensitiveQueryString }}',
'{{ targetUri }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoriesId }}',
'{{ hookId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples​

Updates the metadata of a hook.

UPDATE google.securesourcemanager.hooks
SET
data__disabled = {{ disabled }},
data__events = '{{ events }}',
data__name = '{{ name }}',
data__pushOption = '{{ pushOption }}',
data__sensitiveQueryString = '{{ sensitiveQueryString }}',
data__targetUri = '{{ targetUri }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND hooksId = '{{ hooksId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples​

Deletes a Hook.

DELETE FROM google.securesourcemanager.hooks
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND hooksId = '{{ hooksId }}' --required
;