xref: /aosp_15_r20/external/googleapis/google/cloud/retail/v2beta/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.v2beta;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/retail/v2beta/common.proto";
22import "google/cloud/retail/v2beta/search_service.proto";
23
24option csharp_namespace = "Google.Cloud.Retail.V2Beta";
25option go_package = "cloud.google.com/go/retail/apiv2beta/retailpb;retailpb";
26option java_multiple_files = true;
27option java_outer_classname = "ControlProto";
28option java_package = "com.google.cloud.retail.v2beta";
29option objc_class_prefix = "RETAIL";
30option php_namespace = "Google\\Cloud\\Retail\\V2beta";
31option ruby_package = "Google::Cloud::Retail::V2beta";
32
33// Configures dynamic metadata that can be linked to a
34// [ServingConfig][google.cloud.retail.v2beta.ServingConfig] and affect search
35// or recommendation results at serving time.
36message Control {
37  option (google.api.resource) = {
38    type: "retail.googleapis.com/Control"
39    pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}"
40  };
41
42  // The behavior/type of the control
43  //
44  // A behavior/type must be specified on creation. Type cannot be changed once
45  // specified (e.g. A Rule control will always be a Rule control.). An
46  // INVALID_ARGUMENT will be returned if either condition is violated.
47  oneof control {
48    // A facet specification to perform faceted search.
49    //
50    // Note that this field is deprecated and will throw NOT_IMPLEMENTED if
51    // used for creating a control.
52    SearchRequest.FacetSpec facet_spec = 3 [deprecated = true];
53
54    // A rule control - a condition-action pair.
55    // Enacts a set action when the condition is triggered.
56    // For example: Boost "gShoe" when query full matches "Running Shoes".
57    Rule rule = 4;
58  }
59
60  // Immutable. Fully qualified name
61  // `projects/*/locations/global/catalogs/*/controls/*`
62  string name = 1 [(google.api.field_behavior) = IMMUTABLE];
63
64  // Required. The human readable control display name. Used in Retail UI.
65  //
66  // This field must be a UTF-8 encoded string with a length limit of 128
67  // characters. Otherwise, an INVALID_ARGUMENT error is thrown.
68  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
69
70  // Output only. List of [serving
71  // config][google.cloud.retail.v2beta.ServingConfig] ids that are associated
72  // with this control in the same
73  // [Catalog][google.cloud.retail.v2beta.Catalog].
74  //
75  // Note the association is managed via the
76  // [ServingConfig][google.cloud.retail.v2beta.ServingConfig], this is an
77  // output only denormalized view.
78  repeated string associated_serving_config_ids = 5
79      [(google.api.field_behavior) = OUTPUT_ONLY];
80
81  // Required. Immutable. The solution types that the control is used for.
82  // Currently we support setting only one type of solution at creation time.
83  //
84  // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
85  // If no solution type is provided at creation time, will default to
86  // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2beta.SolutionType.SOLUTION_TYPE_SEARCH].
87  repeated SolutionType solution_types = 6 [
88    (google.api.field_behavior) = REQUIRED,
89    (google.api.field_behavior) = IMMUTABLE
90  ];
91
92  // Specifies the use case for the control.
93  // Affects what condition fields can be set.
94  // Only settable by search controls.
95  // Will default to
96  // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2beta.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
97  // if not specified. Currently only allow one search_solution_use_case per
98  // control.
99  repeated SearchSolutionUseCase search_solution_use_case = 7;
100}
101