Skip to main content

operations

Creates, updates, deletes, gets or lists an operations resource.

Overview

Nameoperations
TypeResource
Idgoogle.apihub.operations

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The name of the operation. Format: projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}
attributesobjectOptional. The list of user defined attributes associated with the API operation resource. The key is the attribute name. It will be of the format: projects/{project}/locations/{location}/attributes/{attribute}. The value is the attribute values associated with the resource.
createTimestring (google-datetime)Output only. The time at which the operation was created.
detailsobjectOptional. Operation details. Note: Even though this field is optional, it is required for CreateApiOperation API and we will fail the request if not provided. (id: GoogleCloudApihubV1OperationDetails)
sourceMetadataarrayOutput only. The list of sources and metadata from the sources of the API operation.
specstringOutput only. The name of the spec will be of the format: projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec} Note:The name of the spec will be empty if the operation is created via CreateApiOperation API.
updateTimestring (google-datetime)Output only. The time at which the operation was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, apisId, versionsId, operationsIdGet details about a particular operation in API version.
listselectprojectsId, locationsId, apisId, versionsIdfilter, pageSize, pageTokenList operations in an API version.
createinsertprojectsId, locationsId, apisId, versionsIdapiOperationIdCreate an apiOperation in an API version. An apiOperation can be created only if the version has no apiOperations which were created by parsing a spec.
patchupdateprojectsId, locationsId, apisId, versionsId, operationsIdupdateMaskUpdate an operation in an API version. The following fields in the ApiOperation resource can be updated: * details.description * details.documentation * details.http_operation.path * details.http_operation.method * details.deprecated * attributes The update_mask should be used to specify the fields being updated. An operation can be updated only if the operation was created via CreateApiOperation API. If the operation was created by parsing the spec, then it can be edited by updating the spec.
deletedeleteprojectsId, locationsId, apisId, versionsId, operationsIdDelete an operation in an API version and we can delete only the operations created via create API. If the operation was created by parsing the spec, then it can be deleted by editing or deleting the spec.
cancelexecprojectsId, locationsId, operationsIdStarts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

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
apisIdstring
locationsIdstring
operationsIdstring
projectsIdstring
versionsIdstring
apiOperationIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Get details about a particular operation in API version.

SELECT
name,
attributes,
createTime,
details,
sourceMetadata,
spec,
updateTime
FROM google.apihub.operations
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND apisId = '{{ apisId }}' -- required
AND versionsId = '{{ versionsId }}' -- required
AND operationsId = '{{ operationsId }}' -- required;

INSERT examples

Create an apiOperation in an API version. An apiOperation can be created only if the version has no apiOperations which were created by parsing a spec.

INSERT INTO google.apihub.operations (
data__name,
data__details,
data__attributes,
projectsId,
locationsId,
apisId,
versionsId,
apiOperationId
)
SELECT
'{{ name }}',
'{{ details }}',
'{{ attributes }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ apisId }}',
'{{ versionsId }}',
'{{ apiOperationId }}'
RETURNING
name,
attributes,
createTime,
details,
sourceMetadata,
spec,
updateTime
;

UPDATE examples

Update an operation in an API version. The following fields in the ApiOperation resource can be updated: * details.description * details.documentation * details.http_operation.path * details.http_operation.method * details.deprecated * attributes The update_mask should be used to specify the fields being updated. An operation can be updated only if the operation was created via CreateApiOperation API. If the operation was created by parsing the spec, then it can be edited by updating the spec.

UPDATE google.apihub.operations
SET
data__name = '{{ name }}',
data__details = '{{ details }}',
data__attributes = '{{ attributes }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND apisId = '{{ apisId }}' --required
AND versionsId = '{{ versionsId }}' --required
AND operationsId = '{{ operationsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
attributes,
createTime,
details,
sourceMetadata,
spec,
updateTime;

DELETE examples

Delete an operation in an API version and we can delete only the operations created via create API. If the operation was created by parsing the spec, then it can be deleted by editing or deleting the spec.

DELETE FROM google.apihub.operations
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND apisId = '{{ apisId }}' --required
AND versionsId = '{{ versionsId }}' --required
AND operationsId = '{{ operationsId }}' --required;

Lifecycle Methods

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

EXEC google.apihub.operations.cancel 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@operationsId='{{ operationsId }}' --required;