Skip to main content

controls

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

Overview

Namecontrols
TypeResource
Idgoogle.retail.controls

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringImmutable. Fully qualified name projects/*/locations/global/catalogs/*/controls/*
associatedServingConfigIdsarrayOutput only. List of serving config ids that are associated with this control in the same Catalog. Note the association is managed via the ServingConfig, this is an output only denormalized view.
displayNamestringRequired. The human readable control display name. Used in Retail UI. This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is thrown.
ruleobjectA rule control - a condition-action pair. Enacts a set action when the condition is triggered. For example: Boost "gShoe" when query full matches "Running Shoes". (id: GoogleCloudRetailV2Rule)
searchSolutionUseCasearraySpecifies the use case for the control. Affects what condition fields can be set. Only settable by search controls. Will default to SEARCH_SOLUTION_USE_CASE_SEARCH if not specified. Currently only allow one search_solution_use_case per control.
solutionTypesarrayRequired. Immutable. The solution types that the control is used for. Currently we support setting only one type of solution at creation time. Only SOLUTION_TYPE_SEARCH value is supported at the moment. If no solution type is provided at creation time, will default to SOLUTION_TYPE_SEARCH.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_catalogs_controls_getselectprojectsId, locationsId, catalogsId, controlsIdGets a Control.
projects_locations_catalogs_controls_listselectprojectsId, locationsId, catalogsIdpageSize, pageToken, filterLists all Controls by their parent Catalog.
projects_locations_catalogs_controls_createinsertprojectsId, locationsId, catalogsIdcontrolIdCreates a Control. If the Control to create already exists, an ALREADY_EXISTS error is returned.
projects_locations_catalogs_controls_patchupdateprojectsId, locationsId, catalogsId, controlsIdupdateMaskUpdates a Control. Control cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the Control to update does not exist, a NOT_FOUND error is returned.
projects_locations_catalogs_controls_deletedeleteprojectsId, locationsId, catalogsId, controlsIdDeletes a Control. If the Control to delete does not exist, a NOT_FOUND error is returned.

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
catalogsIdstring
controlsIdstring
locationsIdstring
projectsIdstring
controlIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a Control.

SELECT
name,
associatedServingConfigIds,
displayName,
rule,
searchSolutionUseCase,
solutionTypes
FROM google.retail.controls
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND catalogsId = '{{ catalogsId }}' -- required
AND controlsId = '{{ controlsId }}' -- required;

INSERT examples

Creates a Control. If the Control to create already exists, an ALREADY_EXISTS error is returned.

INSERT INTO google.retail.controls (
data__name,
data__displayName,
data__rule,
data__solutionTypes,
data__searchSolutionUseCase,
projectsId,
locationsId,
catalogsId,
controlId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ rule }}',
'{{ solutionTypes }}',
'{{ searchSolutionUseCase }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ catalogsId }}',
'{{ controlId }}'
RETURNING
name,
associatedServingConfigIds,
displayName,
rule,
searchSolutionUseCase,
solutionTypes
;

UPDATE examples

Updates a Control. Control cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the Control to update does not exist, a NOT_FOUND error is returned.

UPDATE google.retail.controls
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__rule = '{{ rule }}',
data__solutionTypes = '{{ solutionTypes }}',
data__searchSolutionUseCase = '{{ searchSolutionUseCase }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND catalogsId = '{{ catalogsId }}' --required
AND controlsId = '{{ controlsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
associatedServingConfigIds,
displayName,
rule,
searchSolutionUseCase,
solutionTypes;

DELETE examples

Deletes a Control. If the Control to delete does not exist, a NOT_FOUND error is returned.

DELETE FROM google.retail.controls
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND catalogsId = '{{ catalogsId }}' --required
AND controlsId = '{{ controlsId }}' --required;