operations
Creates, updates, deletes, gets or lists an operations
resource.
Overview
Name | operations |
Type | Resource |
Id | google.apihub.operations |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the operation. Format: projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation} |
attributes | object | Optional. 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. |
createTime | string (google-datetime) | Output only. The time at which the operation was created. |
details | object | Optional. 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) |
sourceMetadata | array | Output only. The list of sources and metadata from the sources of the API operation. |
spec | string | Output 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. |
updateTime | string (google-datetime) | Output only. The time at which the operation was last updated. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the operation. Format: projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation} |
attributes | object | Optional. 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. |
createTime | string (google-datetime) | Output only. The time at which the operation was created. |
details | object | Optional. 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) |
sourceMetadata | array | Output only. The list of sources and metadata from the sources of the API operation. |
spec | string | Output 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. |
updateTime | string (google-datetime) | Output only. The time at which the operation was last updated. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , apisId , versionsId , operationsId | Get details about a particular operation in API version. | |
list | select | projectsId , locationsId , apisId , versionsId | filter , pageSize , pageToken | List operations in an API version. |
create | insert | projectsId , locationsId , apisId , versionsId | apiOperationId | 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. |
patch | update | projectsId , locationsId , apisId , versionsId , operationsId | updateMask | 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. |
delete | delete | projectsId , locationsId , apisId , versionsId , operationsId | 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. | |
cancel | exec | projectsId , locationsId , operationsId | 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 . |
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.
Name | Datatype | Description |
---|---|---|
apisId | string | |
locationsId | string | |
operationsId | string | |
projectsId | string | |
versionsId | string | |
apiOperationId | string | |
filter | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
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;
List operations in an 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 filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: operations
props:
- name: projectsId
value: string
description: Required parameter for the operations resource.
- name: locationsId
value: string
description: Required parameter for the operations resource.
- name: apisId
value: string
description: Required parameter for the operations resource.
- name: versionsId
value: string
description: Required parameter for the operations resource.
- name: name
value: string
description: >
Identifier. The name of the operation. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
- name: details
value: object
description: >
Optional. Operation details. Note: Even though this field is optional, it is required for CreateApiOperation API and we will fail the request if not provided.
- name: attributes
value: object
description: >
Optional. 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.
- name: apiOperationId
value: string
UPDATE
examples
- patch
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
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
- cancel
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;