Skip to main content

versions

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

Overview

Nameversions
TypeResource
Idgoogle.apihub.versions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The name of the version. Format: projects/{project}/locations/{location}/apis/{api}/versions/{version}
accreditationobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
apiOperationsarrayOutput only. The operations contained in the API version. These operations will be added to the version when a new spec is added or when an existing spec is updated. Format is projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}
attributesobjectOptional. The list of user defined attributes associated with the Version 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.
complianceobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
createTimestring (google-datetime)Output only. The time at which the version was created.
definitionsarrayOutput only. The definitions contained in the API version. These definitions will be added to the version when a new spec is added or when an existing spec is updated. Format is projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}
deploymentsarrayOptional. The deployments linked to this API version. Note: A particular API version could be deployed to multiple deployments (for dev deployment, UAT deployment, etc) Format is projects/{project}/locations/{location}/deployments/{deployment}
descriptionstringOptional. The description of the version.
displayNamestringRequired. The display name of the version.
documentationobjectOptional. The documentation of the version. (id: GoogleCloudApihubV1Documentation)
lifecycleobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
selectedDeploymentstringOptional. The selected deployment for a Version resource. This can be used when special handling is needed on client side for a particular deployment linked to the version. Format is projects/{project}/locations/{location}/deployments/{deployment}
sourceMetadataarrayOutput only. The list of sources and metadata from the sources of the version.
specsarrayOutput only. The specs associated with this version. Note that an API version can be associated with multiple specs. Format is projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}
updateTimestring (google-datetime)Output only. The time at which the version was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, apisId, versionsIdGet details about the API version of an API resource. This will include information about the specs and operations present in the API version as well as the deployments linked to it.
listselectprojectsId, locationsId, apisIdfilter, pageSize, pageTokenList API versions of an API resource in the API hub.
createinsertprojectsId, locationsId, apisIdversionIdCreate an API version for an API resource in the API hub.
patchupdateprojectsId, locationsId, apisId, versionsIdupdateMaskUpdate API version. The following fields in the version can be updated currently: * display_name * description * documentation * deployments * lifecycle * compliance * accreditation * attributes The update_mask should be used to specify the fields being updated.
deletedeleteprojectsId, locationsId, apisId, versionsIdforceDelete an API version. Version can only be deleted if all underlying specs, operations, definitions and linked deployments are deleted.

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
projectsIdstring
versionsIdstring
filterstring
forceboolean
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)
versionIdstring

SELECT examples

Get details about the API version of an API resource. This will include information about the specs and operations present in the API version as well as the deployments linked to it.

SELECT
name,
accreditation,
apiOperations,
attributes,
compliance,
createTime,
definitions,
deployments,
description,
displayName,
documentation,
lifecycle,
selectedDeployment,
sourceMetadata,
specs,
updateTime
FROM google.apihub.versions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND apisId = '{{ apisId }}' -- required
AND versionsId = '{{ versionsId }}' -- required;

INSERT examples

Create an API version for an API resource in the API hub.

INSERT INTO google.apihub.versions (
data__name,
data__displayName,
data__description,
data__documentation,
data__deployments,
data__lifecycle,
data__compliance,
data__accreditation,
data__attributes,
data__selectedDeployment,
projectsId,
locationsId,
apisId,
versionId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ description }}',
'{{ documentation }}',
'{{ deployments }}',
'{{ lifecycle }}',
'{{ compliance }}',
'{{ accreditation }}',
'{{ attributes }}',
'{{ selectedDeployment }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ apisId }}',
'{{ versionId }}'
RETURNING
name,
accreditation,
apiOperations,
attributes,
compliance,
createTime,
definitions,
deployments,
description,
displayName,
documentation,
lifecycle,
selectedDeployment,
sourceMetadata,
specs,
updateTime
;

UPDATE examples

Update API version. The following fields in the version can be updated currently: * display_name * description * documentation * deployments * lifecycle * compliance * accreditation * attributes The update_mask should be used to specify the fields being updated.

UPDATE google.apihub.versions
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__description = '{{ description }}',
data__documentation = '{{ documentation }}',
data__deployments = '{{ deployments }}',
data__lifecycle = '{{ lifecycle }}',
data__compliance = '{{ compliance }}',
data__accreditation = '{{ accreditation }}',
data__attributes = '{{ attributes }}',
data__selectedDeployment = '{{ selectedDeployment }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND apisId = '{{ apisId }}' --required
AND versionsId = '{{ versionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
accreditation,
apiOperations,
attributes,
compliance,
createTime,
definitions,
deployments,
description,
displayName,
documentation,
lifecycle,
selectedDeployment,
sourceMetadata,
specs,
updateTime;

DELETE examples

Delete an API version. Version can only be deleted if all underlying specs, operations, definitions and linked deployments are deleted.

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