xref: /aosp_15_r20/external/googleapis/google/cloud/recommender/v1/insight.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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.recommender.v1;
18
19import "google/api/resource.proto";
20import "google/protobuf/duration.proto";
21import "google/protobuf/struct.proto";
22import "google/protobuf/timestamp.proto";
23
24option csharp_namespace = "Google.Cloud.Recommender.V1";
25option go_package = "cloud.google.com/go/recommender/apiv1/recommenderpb;recommenderpb";
26option java_multiple_files = true;
27option java_outer_classname = "InsightProto";
28option java_package = "com.google.cloud.recommender.v1";
29option objc_class_prefix = "CREC";
30option (google.api.resource_definition) = {
31  type: "recommender.googleapis.com/InsightType"
32  pattern: "projects/{project}/locations/{location}/insightTypes/{insight_type}"
33  pattern: "billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}"
34  pattern: "folders/{folder}/locations/{location}/insightTypes/{insight_type}"
35  pattern: "organizations/{organization}/locations/{location}/insightTypes/{insight_type}"
36};
37
38// An insight along with the information used to derive the insight. The insight
39// may have associated recommendations as well.
40message Insight {
41  option (google.api.resource) = {
42    type: "recommender.googleapis.com/Insight"
43    pattern: "projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}"
44    pattern: "billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight}"
45    pattern: "folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight}"
46    pattern: "organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight}"
47  };
48
49  // Insight category.
50  enum Category {
51    // Unspecified category.
52    CATEGORY_UNSPECIFIED = 0;
53
54    // The insight is related to cost.
55    COST = 1;
56
57    // The insight is related to security.
58    SECURITY = 2;
59
60    // The insight is related to performance.
61    PERFORMANCE = 3;
62
63    // This insight is related to manageability.
64    MANAGEABILITY = 4;
65
66    // The insight is related to sustainability.
67    SUSTAINABILITY = 5;
68
69    // This insight is related to reliability.
70    RELIABILITY = 6;
71  }
72
73  // Insight severity levels.
74  enum Severity {
75    // Insight has unspecified severity.
76    SEVERITY_UNSPECIFIED = 0;
77
78    // Insight has low severity.
79    LOW = 1;
80
81    // Insight has medium severity.
82    MEDIUM = 2;
83
84    // Insight has high severity.
85    HIGH = 3;
86
87    // Insight has critical severity.
88    CRITICAL = 4;
89  }
90
91  // Reference to an associated recommendation.
92  message RecommendationReference {
93    // Recommendation resource name, e.g.
94    // projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID]
95    string recommendation = 1;
96  }
97
98  // Name of the insight.
99  string name = 1;
100
101  // Free-form human readable summary in English. The maximum length is 500
102  // characters.
103  string description = 2;
104
105  // Fully qualified resource names that this insight is targeting.
106  repeated string target_resources = 9;
107
108  // Insight subtype. Insight content schema will be stable for a given subtype.
109  string insight_subtype = 10;
110
111  // A struct of custom fields to explain the insight.
112  // Example: "grantedPermissionsCount": "1000"
113  google.protobuf.Struct content = 3;
114
115  // Timestamp of the latest data used to generate the insight.
116  google.protobuf.Timestamp last_refresh_time = 4;
117
118  // Observation period that led to the insight. The source data used to
119  // generate the insight ends at last_refresh_time and begins at
120  // (last_refresh_time - observation_period).
121  google.protobuf.Duration observation_period = 5;
122
123  // Information state and metadata.
124  InsightStateInfo state_info = 6;
125
126  // Category being targeted by the insight.
127  Category category = 7;
128
129  // Insight's severity.
130  Severity severity = 15;
131
132  // Fingerprint of the Insight. Provides optimistic locking when updating
133  // states.
134  string etag = 11;
135
136  // Recommendations derived from this insight.
137  repeated RecommendationReference associated_recommendations = 8;
138}
139
140// Information related to insight state.
141message InsightStateInfo {
142  // Represents insight state.
143  enum State {
144    // Unspecified state.
145    STATE_UNSPECIFIED = 0;
146
147    // Insight is active. Content for ACTIVE insights can be updated by Google.
148    // ACTIVE insights can be marked DISMISSED OR ACCEPTED.
149    ACTIVE = 1;
150
151    // Some action has been taken based on this insight. Insights become
152    // accepted when a recommendation derived from the insight has been marked
153    // CLAIMED, SUCCEEDED, or FAILED. ACTIVE insights can also be marked
154    // ACCEPTED explicitly. Content for ACCEPTED insights is immutable. ACCEPTED
155    // insights can only be marked ACCEPTED (which may update state metadata).
156    ACCEPTED = 2;
157
158    // Insight is dismissed. Content for DISMISSED insights can be updated by
159    // Google. DISMISSED insights can be marked as ACTIVE.
160    DISMISSED = 3;
161  }
162
163  // Insight state.
164  State state = 1;
165
166  // A map of metadata for the state, provided by user or automations systems.
167  map<string, string> state_metadata = 2;
168}
169