recommender_service.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. // Copyright 2020 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. syntax = "proto3";
  15. package google.cloud.recommender.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/recommender/v1/insight.proto";
  21. import "google/cloud/recommender/v1/recommendation.proto";
  22. option csharp_namespace = "Google.Cloud.Recommender.V1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/recommender/v1;recommender";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "RecommenderProto";
  26. option java_package = "com.google.cloud.recommender.v1";
  27. option objc_class_prefix = "CREC";
  28. // Provides insights and recommendations for cloud customers for various
  29. // categories like performance optimization, cost savings, reliability, feature
  30. // discovery, etc. Insights and recommendations are generated automatically
  31. // based on analysis of user resources, configuration and monitoring metrics.
  32. service Recommender {
  33. option (google.api.default_host) = "recommender.googleapis.com";
  34. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  35. // Lists insights for a Cloud project. Requires the recommender.*.list IAM
  36. // permission for the specified insight type.
  37. rpc ListInsights(ListInsightsRequest) returns (ListInsightsResponse) {
  38. option (google.api.http) = {
  39. get: "/v1/{parent=projects/*/locations/*/insightTypes/*}/insights"
  40. additional_bindings {
  41. get: "/v1/{parent=billingAccounts/*/locations/*/insightTypes/*}/insights"
  42. }
  43. additional_bindings {
  44. get: "/v1/{parent=folders/*/locations/*/insightTypes/*}/insights"
  45. }
  46. additional_bindings {
  47. get: "/v1/{parent=organizations/*/locations/*/insightTypes/*}/insights"
  48. }
  49. };
  50. option (google.api.method_signature) = "parent";
  51. }
  52. // Gets the requested insight. Requires the recommender.*.get IAM permission
  53. // for the specified insight type.
  54. rpc GetInsight(GetInsightRequest) returns (Insight) {
  55. option (google.api.http) = {
  56. get: "/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}"
  57. additional_bindings {
  58. get: "/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}"
  59. }
  60. additional_bindings {
  61. get: "/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}"
  62. }
  63. additional_bindings {
  64. get: "/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}"
  65. }
  66. };
  67. option (google.api.method_signature) = "name";
  68. }
  69. // Marks the Insight State as Accepted. Users can use this method to
  70. // indicate to the Recommender API that they have applied some action based
  71. // on the insight. This stops the insight content from being updated.
  72. //
  73. // MarkInsightAccepted can be applied to insights in ACTIVE state. Requires
  74. // the recommender.*.update IAM permission for the specified insight.
  75. rpc MarkInsightAccepted(MarkInsightAcceptedRequest) returns (Insight) {
  76. option (google.api.http) = {
  77. post: "/v1/{name=projects/*/locations/*/insightTypes/*/insights/*}:markAccepted"
  78. body: "*"
  79. additional_bindings {
  80. post: "/v1/{name=billingAccounts/*/locations/*/insightTypes/*/insights/*}:markAccepted"
  81. body: "*"
  82. }
  83. additional_bindings {
  84. post: "/v1/{name=folders/*/locations/*/insightTypes/*/insights/*}:markAccepted"
  85. body: "*"
  86. }
  87. additional_bindings {
  88. post: "/v1/{name=organizations/*/locations/*/insightTypes/*/insights/*}:markAccepted"
  89. body: "*"
  90. }
  91. };
  92. option (google.api.method_signature) = "name,state_metadata,etag";
  93. }
  94. // Lists recommendations for a Cloud project. Requires the recommender.*.list
  95. // IAM permission for the specified recommender.
  96. rpc ListRecommendations(ListRecommendationsRequest) returns (ListRecommendationsResponse) {
  97. option (google.api.http) = {
  98. get: "/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations"
  99. additional_bindings {
  100. get: "/v1/{parent=billingAccounts/*/locations/*/recommenders/*}/recommendations"
  101. }
  102. additional_bindings {
  103. get: "/v1/{parent=folders/*/locations/*/recommenders/*}/recommendations"
  104. }
  105. additional_bindings {
  106. get: "/v1/{parent=organizations/*/locations/*/recommenders/*}/recommendations"
  107. }
  108. };
  109. option (google.api.method_signature) = "parent";
  110. option (google.api.method_signature) = "parent,filter";
  111. }
  112. // Gets the requested recommendation. Requires the recommender.*.get
  113. // IAM permission for the specified recommender.
  114. rpc GetRecommendation(GetRecommendationRequest) returns (Recommendation) {
  115. option (google.api.http) = {
  116. get: "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}"
  117. additional_bindings {
  118. get: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}"
  119. }
  120. additional_bindings {
  121. get: "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}"
  122. }
  123. additional_bindings {
  124. get: "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}"
  125. }
  126. };
  127. option (google.api.method_signature) = "name";
  128. }
  129. // Marks the Recommendation State as Claimed. Users can use this method to
  130. // indicate to the Recommender API that they are starting to apply the
  131. // recommendation themselves. This stops the recommendation content from being
  132. // updated. Associated insights are frozen and placed in the ACCEPTED state.
  133. //
  134. // MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
  135. // SUCCEEDED, FAILED, or ACTIVE state.
  136. //
  137. // Requires the recommender.*.update IAM permission for the specified
  138. // recommender.
  139. rpc MarkRecommendationClaimed(MarkRecommendationClaimedRequest) returns (Recommendation) {
  140. option (google.api.http) = {
  141. post: "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed"
  142. body: "*"
  143. additional_bindings {
  144. post: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markClaimed"
  145. body: "*"
  146. }
  147. additional_bindings {
  148. post: "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markClaimed"
  149. body: "*"
  150. }
  151. additional_bindings {
  152. post: "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markClaimed"
  153. body: "*"
  154. }
  155. };
  156. option (google.api.method_signature) = "name,state_metadata,etag";
  157. }
  158. // Marks the Recommendation State as Succeeded. Users can use this method to
  159. // indicate to the Recommender API that they have applied the recommendation
  160. // themselves, and the operation was successful. This stops the recommendation
  161. // content from being updated. Associated insights are frozen and placed in
  162. // the ACCEPTED state.
  163. //
  164. // MarkRecommendationSucceeded can be applied to recommendations in ACTIVE,
  165. // CLAIMED, SUCCEEDED, or FAILED state.
  166. //
  167. // Requires the recommender.*.update IAM permission for the specified
  168. // recommender.
  169. rpc MarkRecommendationSucceeded(MarkRecommendationSucceededRequest) returns (Recommendation) {
  170. option (google.api.http) = {
  171. post: "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded"
  172. body: "*"
  173. additional_bindings {
  174. post: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markSucceeded"
  175. body: "*"
  176. }
  177. additional_bindings {
  178. post: "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markSucceeded"
  179. body: "*"
  180. }
  181. additional_bindings {
  182. post: "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markSucceeded"
  183. body: "*"
  184. }
  185. };
  186. option (google.api.method_signature) = "name,state_metadata,etag";
  187. }
  188. // Marks the Recommendation State as Failed. Users can use this method to
  189. // indicate to the Recommender API that they have applied the recommendation
  190. // themselves, and the operation failed. This stops the recommendation content
  191. // from being updated. Associated insights are frozen and placed in the
  192. // ACCEPTED state.
  193. //
  194. // MarkRecommendationFailed can be applied to recommendations in ACTIVE,
  195. // CLAIMED, SUCCEEDED, or FAILED state.
  196. //
  197. // Requires the recommender.*.update IAM permission for the specified
  198. // recommender.
  199. rpc MarkRecommendationFailed(MarkRecommendationFailedRequest) returns (Recommendation) {
  200. option (google.api.http) = {
  201. post: "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed"
  202. body: "*"
  203. additional_bindings {
  204. post: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markFailed"
  205. body: "*"
  206. }
  207. additional_bindings {
  208. post: "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markFailed"
  209. body: "*"
  210. }
  211. additional_bindings {
  212. post: "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markFailed"
  213. body: "*"
  214. }
  215. };
  216. option (google.api.method_signature) = "name,state_metadata,etag";
  217. }
  218. }
  219. // Request for the `ListInsights` method.
  220. message ListInsightsRequest {
  221. // Required. The container resource on which to execute the request.
  222. // Acceptable formats:
  223. //
  224. // 1.
  225. // "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
  226. //
  227. // LOCATION here refers to GCP Locations:
  228. // https://cloud.google.com/about/locations/
  229. // INSIGHT_TYPE_ID refers to supported insight types:
  230. // https://cloud.google.com/recommender/docs/insights/insight-types.)
  231. string parent = 1 [
  232. (google.api.field_behavior) = REQUIRED,
  233. (google.api.resource_reference) = {
  234. type: "recommender.googleapis.com/InsightType"
  235. }
  236. ];
  237. // Optional. The maximum number of results to return from this request. Non-positive
  238. // values are ignored. If not specified, the server will determine the number
  239. // of results to return.
  240. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  241. // Optional. If present, retrieves the next batch of results from the preceding call to
  242. // this method. `page_token` must be the value of `next_page_token` from the
  243. // previous response. The values of other method parameters must be identical
  244. // to those in the previous call.
  245. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  246. // Optional. Filter expression to restrict the insights returned. Supported
  247. // filter fields: state
  248. // Eg: `state:"DISMISSED" or state:"ACTIVE"
  249. string filter = 4 [(google.api.field_behavior) = OPTIONAL];
  250. }
  251. // Response to the `ListInsights` method.
  252. message ListInsightsResponse {
  253. // The set of insights for the `parent` resource.
  254. repeated Insight insights = 1;
  255. // A token that can be used to request the next page of results. This field is
  256. // empty if there are no additional results.
  257. string next_page_token = 2;
  258. }
  259. // Request to the `GetInsight` method.
  260. message GetInsightRequest {
  261. // Required. Name of the insight.
  262. string name = 1 [
  263. (google.api.field_behavior) = REQUIRED,
  264. (google.api.resource_reference) = {
  265. type: "recommender.googleapis.com/Insight"
  266. }
  267. ];
  268. }
  269. // Request for the `MarkInsightAccepted` method.
  270. message MarkInsightAcceptedRequest {
  271. // Required. Name of the insight.
  272. string name = 1 [
  273. (google.api.field_behavior) = REQUIRED,
  274. (google.api.resource_reference) = {
  275. type: "recommender.googleapis.com/Insight"
  276. }
  277. ];
  278. // Optional. State properties user wish to include with this state. Full replace of the
  279. // current state_metadata.
  280. map<string, string> state_metadata = 2 [(google.api.field_behavior) = OPTIONAL];
  281. // Required. Fingerprint of the Insight. Provides optimistic locking.
  282. string etag = 3 [(google.api.field_behavior) = REQUIRED];
  283. }
  284. // Request for the `ListRecommendations` method.
  285. message ListRecommendationsRequest {
  286. // Required. The container resource on which to execute the request.
  287. // Acceptable formats:
  288. //
  289. // 1.
  290. // "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
  291. //
  292. // LOCATION here refers to GCP Locations:
  293. // https://cloud.google.com/about/locations/
  294. // RECOMMENDER_ID refers to supported recommenders:
  295. // https://cloud.google.com/recommender/docs/recommenders.
  296. string parent = 1 [
  297. (google.api.field_behavior) = REQUIRED,
  298. (google.api.resource_reference) = {
  299. type: "recommender.googleapis.com/Recommender"
  300. }
  301. ];
  302. // Optional. The maximum number of results to return from this request. Non-positive
  303. // values are ignored. If not specified, the server will determine the number
  304. // of results to return.
  305. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  306. // Optional. If present, retrieves the next batch of results from the preceding call to
  307. // this method. `page_token` must be the value of `next_page_token` from the
  308. // previous response. The values of other method parameters must be identical
  309. // to those in the previous call.
  310. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  311. // Filter expression to restrict the recommendations returned. Supported
  312. // filter fields: state_info.state
  313. // Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED"
  314. string filter = 5;
  315. }
  316. // Response to the `ListRecommendations` method.
  317. message ListRecommendationsResponse {
  318. // The set of recommendations for the `parent` resource.
  319. repeated Recommendation recommendations = 1;
  320. // A token that can be used to request the next page of results. This field is
  321. // empty if there are no additional results.
  322. string next_page_token = 2;
  323. }
  324. // Request to the `GetRecommendation` method.
  325. message GetRecommendationRequest {
  326. // Required. Name of the recommendation.
  327. string name = 1 [
  328. (google.api.field_behavior) = REQUIRED,
  329. (google.api.resource_reference) = {
  330. type: "recommender.googleapis.com/Recommendation"
  331. }
  332. ];
  333. }
  334. // Request for the `MarkRecommendationClaimed` Method.
  335. message MarkRecommendationClaimedRequest {
  336. // Required. Name of the recommendation.
  337. string name = 1 [
  338. (google.api.field_behavior) = REQUIRED,
  339. (google.api.resource_reference) = {
  340. type: "recommender.googleapis.com/Recommendation"
  341. }
  342. ];
  343. // State properties to include with this state. Overwrites any existing
  344. // `state_metadata`.
  345. // Keys must match the regex /^[a-z0-9][a-z0-9_.-]{0,62}$/.
  346. // Values must match the regex /^[a-zA-Z0-9_./-]{0,255}$/.
  347. map<string, string> state_metadata = 2;
  348. // Required. Fingerprint of the Recommendation. Provides optimistic locking.
  349. string etag = 3 [(google.api.field_behavior) = REQUIRED];
  350. }
  351. // Request for the `MarkRecommendationSucceeded` Method.
  352. message MarkRecommendationSucceededRequest {
  353. // Required. Name of the recommendation.
  354. string name = 1 [
  355. (google.api.field_behavior) = REQUIRED,
  356. (google.api.resource_reference) = {
  357. type: "recommender.googleapis.com/Recommendation"
  358. }
  359. ];
  360. // State properties to include with this state. Overwrites any existing
  361. // `state_metadata`.
  362. // Keys must match the regex /^[a-z0-9][a-z0-9_.-]{0,62}$/.
  363. // Values must match the regex /^[a-zA-Z0-9_./-]{0,255}$/.
  364. map<string, string> state_metadata = 2;
  365. // Required. Fingerprint of the Recommendation. Provides optimistic locking.
  366. string etag = 3 [(google.api.field_behavior) = REQUIRED];
  367. }
  368. // Request for the `MarkRecommendationFailed` Method.
  369. message MarkRecommendationFailedRequest {
  370. // Required. Name of the recommendation.
  371. string name = 1 [
  372. (google.api.field_behavior) = REQUIRED,
  373. (google.api.resource_reference) = {
  374. type: "recommender.googleapis.com/Recommendation"
  375. }
  376. ];
  377. // State properties to include with this state. Overwrites any existing
  378. // `state_metadata`.
  379. // Keys must match the regex /^[a-z0-9][a-z0-9_.-]{0,62}$/.
  380. // Values must match the regex /^[a-zA-Z0-9_./-]{0,255}$/.
  381. map<string, string> state_metadata = 2;
  382. // Required. Fingerprint of the Recommendation. Provides optimistic locking.
  383. string etag = 3 [(google.api.field_behavior) = REQUIRED];
  384. }