Skip to content

Commit

Permalink
feat: Implement configurable recommenders and update .bazel files
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 457101611
  • Loading branch information
Google APIs authored and Copybara-Service committed Jun 24, 2022
1 parent dfefc95 commit c13c88b
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 22 deletions.
5 changes: 5 additions & 0 deletions google/cloud/recommender/v1/BUILD.bazel
Expand Up @@ -22,7 +22,9 @@ proto_library(
name = "recommender_proto",
srcs = [
"insight.proto",
"insight_type_config.proto",
"recommendation.proto",
"recommender_config.proto",
"recommender_service.proto",
],
deps = [
Expand All @@ -32,6 +34,7 @@ proto_library(
"//google/api:resource_proto",
"//google/type:money_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
],
Expand Down Expand Up @@ -173,6 +176,7 @@ py_gapic_library(
name = "recommender_py_gapic",
srcs = [":recommender_proto"],
grpc_service_config = "recommender_grpc_service_config.json",
service_yaml = "recommender_v1.yaml",
)

# Open Source Packages
Expand Down Expand Up @@ -289,6 +293,7 @@ ruby_cloud_gapic_library(
grpc_service_config = "recommender_grpc_service_config.json",
ruby_cloud_description = "Recommender is a service on Google Cloud that provides usage recommendations for Cloud products and services.",
ruby_cloud_title = "Recommender V1",
service_yaml = "recommender_v1.yaml",
deps = [
":recommender_ruby_grpc",
":recommender_ruby_proto",
Expand Down
85 changes: 85 additions & 0 deletions google/cloud/recommender/v1/insight_type_config.proto
@@ -0,0 +1,85 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.recommender.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Recommender.V1";
option go_package = "google.golang.org/genproto/googleapis/cloud/recommender/v1;recommender";
option java_multiple_files = true;
option java_outer_classname = "InsightTypeConfigProto";
option java_package = "com.google.cloud.recommender.v1";
option objc_class_prefix = "CREC";

// Configuration for an InsightType.
message InsightTypeConfig {
option (google.api.resource) = {
type: "recommender.googleapis.com/InsightTypeConfig"
pattern: "projects/{project}/locations/{location}/insightTypes/{insight_type}/config"
pattern: "organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config"
};

// Name of insight type config.
// Eg,
// projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config
string name = 1;

// InsightTypeGenerationConfig which configures the generation of
// insights for this insight type.
InsightTypeGenerationConfig insight_type_generation_config = 2;

// Fingerprint of the InsightTypeConfig. Provides optimistic locking when
// updating.
string etag = 3;

// Last time when the config was updated.
google.protobuf.Timestamp update_time = 4;

// Output only. Immutable. The revision ID of the config.
// A new revision is committed whenever the config is changed in any way.
// The format is an 8-character hexadecimal string.
string revision_id = 5 [
(google.api.field_behavior) = IMMUTABLE,
(google.api.field_behavior) = OUTPUT_ONLY
];

// Allows clients to store small amounts of arbitrary data. Annotations must
// follow the Kubernetes syntax.
// The total size of all keys and values combined is limited to 256k.
// Key can have 2 segments: prefix (optional) and name (required),
// separated by a slash (/).
// Prefix must be a DNS subdomain.
// Name must be 63 characters or less, begin and end with alphanumerics,
// with dashes (-), underscores (_), dots (.), and alphanumerics between.
map<string, string> annotations = 6;

// A user-settable field to provide a human-readable name to be used in user
// interfaces.
string display_name = 7;
}

// A configuration to customize the generation of insights.
// Eg, customizing the lookback period considered when generating a
// insight.
message InsightTypeGenerationConfig {
// Parameters for this InsightTypeGenerationConfig. These configs can be used
// by or are applied to all subtypes.
google.protobuf.Struct params = 1;
}
85 changes: 85 additions & 0 deletions google/cloud/recommender/v1/recommender_config.proto
@@ -0,0 +1,85 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.recommender.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Recommender.V1";
option go_package = "google.golang.org/genproto/googleapis/cloud/recommender/v1;recommender";
option java_multiple_files = true;
option java_outer_classname = "RecommenderConfigProto";
option java_package = "com.google.cloud.recommender.v1";
option objc_class_prefix = "CREC";

// Configuration for a Recommender.
message RecommenderConfig {
option (google.api.resource) = {
type: "recommender.googleapis.com/RecommenderConfig"
pattern: "projects/{project}/locations/{location}/recommenders/{recommender}/config"
pattern: "organizations/{organization}/locations/{location}/recommenders/{recommender}/config"
};

// Name of recommender config.
// Eg,
// projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config
string name = 1;

// RecommenderGenerationConfig which configures the Generation of
// recommendations for this recommender.
RecommenderGenerationConfig recommender_generation_config = 2;

// Fingerprint of the RecommenderConfig. Provides optimistic locking when
// updating.
string etag = 3;

// Last time when the config was updated.
google.protobuf.Timestamp update_time = 4;

// Output only. Immutable. The revision ID of the config.
// A new revision is committed whenever the config is changed in any way.
// The format is an 8-character hexadecimal string.
string revision_id = 5 [
(google.api.field_behavior) = IMMUTABLE,
(google.api.field_behavior) = OUTPUT_ONLY
];

// Allows clients to store small amounts of arbitrary data. Annotations must
// follow the Kubernetes syntax.
// The total size of all keys and values combined is limited to 256k.
// Key can have 2 segments: prefix (optional) and name (required),
// separated by a slash (/).
// Prefix must be a DNS subdomain.
// Name must be 63 characters or less, begin and end with alphanumerics,
// with dashes (-), underscores (_), dots (.), and alphanumerics between.
map<string, string> annotations = 6;

// A user-settable field to provide a human-readable name to be used in user
// interfaces.
string display_name = 7;
}

// A Configuration to customize the generation of recommendations.
// Eg, customizing the lookback period considered when generating a
// recommendation.
message RecommenderGenerationConfig {
// Parameters for this RecommenderGenerationConfig. These configs can be used
// by or are applied to all subtypes.
google.protobuf.Struct params = 1;
}

0 comments on commit c13c88b

Please sign in to comment.