xref: /aosp_15_r20/external/googleapis/google/cloud/retail/v2/control.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.retail.v2;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/retail/v2/common.proto";
22
23option csharp_namespace = "Google.Cloud.Retail.V2";
24option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb";
25option java_multiple_files = true;
26option java_outer_classname = "ControlProto";
27option java_package = "com.google.cloud.retail.v2";
28option objc_class_prefix = "RETAIL";
29option php_namespace = "Google\\Cloud\\Retail\\V2";
30option ruby_package = "Google::Cloud::Retail::V2";
31
32// Configures dynamic metadata that can be linked to a
33// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
34// recommendation results at serving time.
35message Control {
36  option (google.api.resource) = {
37    type: "retail.googleapis.com/Control"
38    pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}"
39  };
40
41  // The behavior/type of the control
42  //
43  // A behavior/type must be specified on creation. Type cannot be changed once
44  // specified (e.g. A Rule control will always be a Rule control.). An
45  // INVALID_ARGUMENT will be returned if either condition is violated.
46  oneof control {
47    // A rule control - a condition-action pair.
48    // Enacts a set action when the condition is triggered.
49    // For example: Boost "gShoe" when query full matches "Running Shoes".
50    Rule rule = 4;
51  }
52
53  // Immutable. Fully qualified name
54  // `projects/*/locations/global/catalogs/*/controls/*`
55  string name = 1 [(google.api.field_behavior) = IMMUTABLE];
56
57  // Required. The human readable control display name. Used in Retail UI.
58  //
59  // This field must be a UTF-8 encoded string with a length limit of 128
60  // characters. Otherwise, an INVALID_ARGUMENT error is thrown.
61  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
62
63  // Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
64  // ids that are associated with this control in the same
65  // [Catalog][google.cloud.retail.v2.Catalog].
66  //
67  // Note the association is managed via the
68  // [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
69  // only denormalized view.
70  repeated string associated_serving_config_ids = 5
71      [(google.api.field_behavior) = OUTPUT_ONLY];
72
73  // Required. Immutable. The solution types that the control is used for.
74  // Currently we support setting only one type of solution at creation time.
75  //
76  // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
77  // If no solution type is provided at creation time, will default to
78  // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
79  repeated SolutionType solution_types = 6 [
80    (google.api.field_behavior) = REQUIRED,
81    (google.api.field_behavior) = IMMUTABLE
82  ];
83
84  // Specifies the use case for the control.
85  // Affects what condition fields can be set.
86  // Only settable by search controls.
87  // Will default to
88  // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
89  // if not specified. Currently only allow one search_solution_use_case per
90  // control.
91  repeated SearchSolutionUseCase search_solution_use_case = 7;
92}
93