Skip to main content

workloads

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

Overview

Nameworkloads
TypeResource
Idgoogle.apphub.workloads

Fields

NameDatatypeDescription
namestringIdentifier. The resource name of the Workload. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/workloads/{workload-id}"
descriptionstringOptional. User-defined description of a Workload. Can have a maximum length of 2048 characters.
attributesobjectConsumer provided attributes.
createTimestringOutput only. Create time.
discoveredWorkloadstringRequired. Immutable. The resource name of the original discovered workload.
displayNamestringOptional. User-defined name for the Workload. Can have a maximum length of 63 characters.
statestringOutput only. Workload state.
uidstringOutput only. A universally unique identifier (UUID) for the Workload in the UUID4 format.
updateTimestringOutput only. Update time.
workloadPropertiesobjectProperties of an underlying compute resource represented by the Workload.
workloadReferenceobjectReference of an underlying compute resource represented by the Workload.

Methods

NameAccessible byRequired ParamsDescription
getSELECTapplicationsId, locationsId, projectsId, workloadsIdGets a Workload in an Application.
listSELECTapplicationsId, locationsId, projectsIdLists Workloads in an Application.
createINSERTapplicationsId, locationsId, projectsIdCreates a Workload in an Application.
deleteDELETEapplicationsId, locationsId, projectsId, workloadsIdDeletes a Workload from an Application.
patchUPDATEapplicationsId, locationsId, projectsId, workloadsIdUpdates a Workload in an Application.

SELECT examples

Lists Workloads in an Application.

SELECT
name,
description,
attributes,
createTime,
discoveredWorkload,
displayName,
state,
uid,
updateTime,
workloadProperties,
workloadReference
FROM google.apphub.workloads
WHERE applicationsId = '{{ applicationsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new workloads resource.

/*+ create */
INSERT INTO google.apphub.workloads (
applicationsId,
locationsId,
projectsId,
name,
displayName,
description,
discoveredWorkload,
attributes
)
SELECT
'{{ applicationsId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ displayName }}',
'{{ description }}',
'{{ discoveredWorkload }}',
'{{ attributes }}'
;

UPDATE example

Updates a workloads resource.

/*+ update */
UPDATE google.apphub.workloads
SET
name = '{{ name }}',
displayName = '{{ displayName }}',
description = '{{ description }}',
discoveredWorkload = '{{ discoveredWorkload }}',
attributes = '{{ attributes }}'
WHERE
applicationsId = '{{ applicationsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND workloadsId = '{{ workloadsId }}';

DELETE example

Deletes the specified workloads resource.

/*+ delete */
DELETE FROM google.apphub.workloads
WHERE applicationsId = '{{ applicationsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND workloadsId = '{{ workloadsId }}';