Skip to content

Commit c13c88b

Browse files
Google APIscopybara-github
authored andcommitted
feat: Implement configurable recommenders and update .bazel files
PiperOrigin-RevId: 457101611
1 parent dfefc95 commit c13c88b

5 files changed

Lines changed: 330 additions & 22 deletions

File tree

google/cloud/recommender/v1/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ proto_library(
2222
name = "recommender_proto",
2323
srcs = [
2424
"insight.proto",
25+
"insight_type_config.proto",
2526
"recommendation.proto",
27+
"recommender_config.proto",
2628
"recommender_service.proto",
2729
],
2830
deps = [
@@ -32,6 +34,7 @@ proto_library(
3234
"//google/api:resource_proto",
3335
"//google/type:money_proto",
3436
"@com_google_protobuf//:duration_proto",
37+
"@com_google_protobuf//:field_mask_proto",
3538
"@com_google_protobuf//:struct_proto",
3639
"@com_google_protobuf//:timestamp_proto",
3740
],
@@ -173,6 +176,7 @@ py_gapic_library(
173176
name = "recommender_py_gapic",
174177
srcs = [":recommender_proto"],
175178
grpc_service_config = "recommender_grpc_service_config.json",
179+
service_yaml = "recommender_v1.yaml",
176180
)
177181

178182
# Open Source Packages
@@ -289,6 +293,7 @@ ruby_cloud_gapic_library(
289293
grpc_service_config = "recommender_grpc_service_config.json",
290294
ruby_cloud_description = "Recommender is a service on Google Cloud that provides usage recommendations for Cloud products and services.",
291295
ruby_cloud_title = "Recommender V1",
296+
service_yaml = "recommender_v1.yaml",
292297
deps = [
293298
":recommender_ruby_grpc",
294299
":recommender_ruby_proto",
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright 2022 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.recommender.v1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
import "google/protobuf/struct.proto";
22+
import "google/protobuf/timestamp.proto";
23+
24+
option csharp_namespace = "Google.Cloud.Recommender.V1";
25+
option go_package = "google.golang.org/genproto/googleapis/cloud/recommender/v1;recommender";
26+
option java_multiple_files = true;
27+
option java_outer_classname = "InsightTypeConfigProto";
28+
option java_package = "com.google.cloud.recommender.v1";
29+
option objc_class_prefix = "CREC";
30+
31+
// Configuration for an InsightType.
32+
message InsightTypeConfig {
33+
option (google.api.resource) = {
34+
type: "recommender.googleapis.com/InsightTypeConfig"
35+
pattern: "projects/{project}/locations/{location}/insightTypes/{insight_type}/config"
36+
pattern: "organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config"
37+
};
38+
39+
// Name of insight type config.
40+
// Eg,
41+
// projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config
42+
string name = 1;
43+
44+
// InsightTypeGenerationConfig which configures the generation of
45+
// insights for this insight type.
46+
InsightTypeGenerationConfig insight_type_generation_config = 2;
47+
48+
// Fingerprint of the InsightTypeConfig. Provides optimistic locking when
49+
// updating.
50+
string etag = 3;
51+
52+
// Last time when the config was updated.
53+
google.protobuf.Timestamp update_time = 4;
54+
55+
// Output only. Immutable. The revision ID of the config.
56+
// A new revision is committed whenever the config is changed in any way.
57+
// The format is an 8-character hexadecimal string.
58+
string revision_id = 5 [
59+
(google.api.field_behavior) = IMMUTABLE,
60+
(google.api.field_behavior) = OUTPUT_ONLY
61+
];
62+
63+
// Allows clients to store small amounts of arbitrary data. Annotations must
64+
// follow the Kubernetes syntax.
65+
// The total size of all keys and values combined is limited to 256k.
66+
// Key can have 2 segments: prefix (optional) and name (required),
67+
// separated by a slash (/).
68+
// Prefix must be a DNS subdomain.
69+
// Name must be 63 characters or less, begin and end with alphanumerics,
70+
// with dashes (-), underscores (_), dots (.), and alphanumerics between.
71+
map<string, string> annotations = 6;
72+
73+
// A user-settable field to provide a human-readable name to be used in user
74+
// interfaces.
75+
string display_name = 7;
76+
}
77+
78+
// A configuration to customize the generation of insights.
79+
// Eg, customizing the lookback period considered when generating a
80+
// insight.
81+
message InsightTypeGenerationConfig {
82+
// Parameters for this InsightTypeGenerationConfig. These configs can be used
83+
// by or are applied to all subtypes.
84+
google.protobuf.Struct params = 1;
85+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright 2022 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.recommender.v1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
import "google/protobuf/struct.proto";
22+
import "google/protobuf/timestamp.proto";
23+
24+
option csharp_namespace = "Google.Cloud.Recommender.V1";
25+
option go_package = "google.golang.org/genproto/googleapis/cloud/recommender/v1;recommender";
26+
option java_multiple_files = true;
27+
option java_outer_classname = "RecommenderConfigProto";
28+
option java_package = "com.google.cloud.recommender.v1";
29+
option objc_class_prefix = "CREC";
30+
31+
// Configuration for a Recommender.
32+
message RecommenderConfig {
33+
option (google.api.resource) = {
34+
type: "recommender.googleapis.com/RecommenderConfig"
35+
pattern: "projects/{project}/locations/{location}/recommenders/{recommender}/config"
36+
pattern: "organizations/{organization}/locations/{location}/recommenders/{recommender}/config"
37+
};
38+
39+
// Name of recommender config.
40+
// Eg,
41+
// projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config
42+
string name = 1;
43+
44+
// RecommenderGenerationConfig which configures the Generation of
45+
// recommendations for this recommender.
46+
RecommenderGenerationConfig recommender_generation_config = 2;
47+
48+
// Fingerprint of the RecommenderConfig. Provides optimistic locking when
49+
// updating.
50+
string etag = 3;
51+
52+
// Last time when the config was updated.
53+
google.protobuf.Timestamp update_time = 4;
54+
55+
// Output only. Immutable. The revision ID of the config.
56+
// A new revision is committed whenever the config is changed in any way.
57+
// The format is an 8-character hexadecimal string.
58+
string revision_id = 5 [
59+
(google.api.field_behavior) = IMMUTABLE,
60+
(google.api.field_behavior) = OUTPUT_ONLY
61+
];
62+
63+
// Allows clients to store small amounts of arbitrary data. Annotations must
64+
// follow the Kubernetes syntax.
65+
// The total size of all keys and values combined is limited to 256k.
66+
// Key can have 2 segments: prefix (optional) and name (required),
67+
// separated by a slash (/).
68+
// Prefix must be a DNS subdomain.
69+
// Name must be 63 characters or less, begin and end with alphanumerics,
70+
// with dashes (-), underscores (_), dots (.), and alphanumerics between.
71+
map<string, string> annotations = 6;
72+
73+
// A user-settable field to provide a human-readable name to be used in user
74+
// interfaces.
75+
string display_name = 7;
76+
}
77+
78+
// A Configuration to customize the generation of recommendations.
79+
// Eg, customizing the lookback period considered when generating a
80+
// recommendation.
81+
message RecommenderGenerationConfig {
82+
// Parameters for this RecommenderGenerationConfig. These configs can be used
83+
// by or are applied to all subtypes.
84+
google.protobuf.Struct params = 1;
85+
}

0 commit comments

Comments
 (0)