group_service.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. syntax = "proto3";
  15. package google.monitoring.v3;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/monitored_resource.proto";
  20. import "google/api/resource.proto";
  21. import "google/monitoring/v3/common.proto";
  22. import "google/monitoring/v3/group.proto";
  23. import "google/protobuf/empty.proto";
  24. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  25. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "GroupServiceProto";
  28. option java_package = "com.google.monitoring.v3";
  29. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  30. option ruby_package = "Google::Cloud::Monitoring::V3";
  31. // The Group API lets you inspect and manage your
  32. // [groups](#google.monitoring.v3.Group).
  33. //
  34. // A group is a named filter that is used to identify
  35. // a collection of monitored resources. Groups are typically used to
  36. // mirror the physical and/or logical topology of the environment.
  37. // Because group membership is computed dynamically, monitored
  38. // resources that are started in the future are automatically placed
  39. // in matching groups. By using a group to name monitored resources in,
  40. // for example, an alert policy, the target of that alert policy is
  41. // updated automatically as monitored resources are added and removed
  42. // from the infrastructure.
  43. service GroupService {
  44. option (google.api.default_host) = "monitoring.googleapis.com";
  45. option (google.api.oauth_scopes) =
  46. "https://www.googleapis.com/auth/cloud-platform,"
  47. "https://www.googleapis.com/auth/monitoring,"
  48. "https://www.googleapis.com/auth/monitoring.read";
  49. // Lists the existing groups.
  50. rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) {
  51. option (google.api.http) = {
  52. get: "/v3/{name=projects/*}/groups"
  53. };
  54. option (google.api.method_signature) = "name";
  55. }
  56. // Gets a single group.
  57. rpc GetGroup(GetGroupRequest) returns (Group) {
  58. option (google.api.http) = {
  59. get: "/v3/{name=projects/*/groups/*}"
  60. };
  61. option (google.api.method_signature) = "name";
  62. }
  63. // Creates a new group.
  64. rpc CreateGroup(CreateGroupRequest) returns (Group) {
  65. option (google.api.http) = {
  66. post: "/v3/{name=projects/*}/groups"
  67. body: "group"
  68. };
  69. option (google.api.method_signature) = "name,group";
  70. }
  71. // Updates an existing group.
  72. // You can change any group attributes except `name`.
  73. rpc UpdateGroup(UpdateGroupRequest) returns (Group) {
  74. option (google.api.http) = {
  75. put: "/v3/{group.name=projects/*/groups/*}"
  76. body: "group"
  77. };
  78. option (google.api.method_signature) = "group";
  79. }
  80. // Deletes an existing group.
  81. rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) {
  82. option (google.api.http) = {
  83. delete: "/v3/{name=projects/*/groups/*}"
  84. };
  85. option (google.api.method_signature) = "name";
  86. }
  87. // Lists the monitored resources that are members of a group.
  88. rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) {
  89. option (google.api.http) = {
  90. get: "/v3/{name=projects/*/groups/*}/members"
  91. };
  92. option (google.api.method_signature) = "name";
  93. }
  94. }
  95. // The `ListGroup` request.
  96. message ListGroupsRequest {
  97. // Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
  98. // whose groups are to be listed. The format is:
  99. //
  100. // projects/[PROJECT_ID_OR_NUMBER]
  101. string name = 7 [
  102. (google.api.field_behavior) = REQUIRED,
  103. (google.api.resource_reference) = {
  104. child_type: "monitoring.googleapis.com/Group"
  105. }
  106. ];
  107. // An optional filter consisting of a single group name. The filters limit
  108. // the groups returned based on their parent-child relationship with the
  109. // specified group. If no filter is specified, all groups are returned.
  110. oneof filter {
  111. // A group name. The format is:
  112. //
  113. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  114. //
  115. // Returns groups whose `parent_name` field contains the group
  116. // name. If no groups have this parent, the results are empty.
  117. string children_of_group = 2 [(google.api.resource_reference) = {
  118. type: "monitoring.googleapis.com/Group"
  119. }];
  120. // A group name. The format is:
  121. //
  122. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  123. //
  124. // Returns groups that are ancestors of the specified group.
  125. // The groups are returned in order, starting with the immediate parent and
  126. // ending with the most distant ancestor. If the specified group has no
  127. // immediate parent, the results are empty.
  128. string ancestors_of_group = 3 [(google.api.resource_reference) = {
  129. type: "monitoring.googleapis.com/Group"
  130. }];
  131. // A group name. The format is:
  132. //
  133. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  134. //
  135. // Returns the descendants of the specified group. This is a superset of
  136. // the results returned by the `children_of_group` filter, and includes
  137. // children-of-children, and so forth.
  138. string descendants_of_group = 4 [(google.api.resource_reference) = {
  139. type: "monitoring.googleapis.com/Group"
  140. }];
  141. }
  142. // A positive number that is the maximum number of results to return.
  143. int32 page_size = 5;
  144. // If this field is not empty then it must contain the `next_page_token` value
  145. // returned by a previous call to this method. Using this field causes the
  146. // method to return additional results from the previous method call.
  147. string page_token = 6;
  148. }
  149. // The `ListGroups` response.
  150. message ListGroupsResponse {
  151. // The groups that match the specified filters.
  152. repeated Group group = 1;
  153. // If there are more results than have been returned, then this field is set
  154. // to a non-empty value. To see the additional results,
  155. // use that value as `page_token` in the next call to this method.
  156. string next_page_token = 2;
  157. }
  158. // The `GetGroup` request.
  159. message GetGroupRequest {
  160. // Required. The group to retrieve. The format is:
  161. //
  162. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  163. string name = 3 [
  164. (google.api.field_behavior) = REQUIRED,
  165. (google.api.resource_reference) = {
  166. type: "monitoring.googleapis.com/Group"
  167. }
  168. ];
  169. }
  170. // The `CreateGroup` request.
  171. message CreateGroupRequest {
  172. // Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
  173. // which to create the group. The format is:
  174. //
  175. // projects/[PROJECT_ID_OR_NUMBER]
  176. string name = 4 [
  177. (google.api.field_behavior) = REQUIRED,
  178. (google.api.resource_reference) = {
  179. child_type: "monitoring.googleapis.com/Group"
  180. }
  181. ];
  182. // Required. A group definition. It is an error to define the `name` field because
  183. // the system assigns the name.
  184. Group group = 2 [(google.api.field_behavior) = REQUIRED];
  185. // If true, validate this request but do not create the group.
  186. bool validate_only = 3;
  187. }
  188. // The `UpdateGroup` request.
  189. message UpdateGroupRequest {
  190. // Required. The new definition of the group. All fields of the existing group,
  191. // excepting `name`, are replaced with the corresponding fields of this group.
  192. Group group = 2 [(google.api.field_behavior) = REQUIRED];
  193. // If true, validate this request but do not update the existing group.
  194. bool validate_only = 3;
  195. }
  196. // The `DeleteGroup` request. The default behavior is to be able to delete a
  197. // single group without any descendants.
  198. message DeleteGroupRequest {
  199. // Required. The group to delete. The format is:
  200. //
  201. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  202. string name = 3 [
  203. (google.api.field_behavior) = REQUIRED,
  204. (google.api.resource_reference) = {
  205. type: "monitoring.googleapis.com/Group"
  206. }
  207. ];
  208. // If this field is true, then the request means to delete a group with all
  209. // its descendants. Otherwise, the request means to delete a group only when
  210. // it has no descendants. The default value is false.
  211. bool recursive = 4;
  212. }
  213. // The `ListGroupMembers` request.
  214. message ListGroupMembersRequest {
  215. // Required. The group whose members are listed. The format is:
  216. //
  217. // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
  218. string name = 7 [
  219. (google.api.field_behavior) = REQUIRED,
  220. (google.api.resource_reference) = {
  221. type: "monitoring.googleapis.com/Group"
  222. }
  223. ];
  224. // A positive number that is the maximum number of results to return.
  225. int32 page_size = 3;
  226. // If this field is not empty then it must contain the `next_page_token` value
  227. // returned by a previous call to this method. Using this field causes the
  228. // method to return additional results from the previous method call.
  229. string page_token = 4;
  230. // An optional [list
  231. // filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
  232. // describing the members to be returned. The filter may reference the type,
  233. // labels, and metadata of monitored resources that comprise the group. For
  234. // example, to return only resources representing Compute Engine VM instances,
  235. // use this filter:
  236. //
  237. // `resource.type = "gce_instance"`
  238. string filter = 5;
  239. // An optional time interval for which results should be returned. Only
  240. // members that were part of the group during the specified interval are
  241. // included in the response. If no interval is provided then the group
  242. // membership over the last minute is returned.
  243. TimeInterval interval = 6;
  244. }
  245. // The `ListGroupMembers` response.
  246. message ListGroupMembersResponse {
  247. // A set of monitored resources in the group.
  248. repeated google.api.MonitoredResource members = 1;
  249. // If there are more results than have been returned, then this field is
  250. // set to a non-empty value. To see the additional results, use that value as
  251. // `page_token` in the next call to this method.
  252. string next_page_token = 2;
  253. // The total number of elements matching this request.
  254. int32 total_size = 3;
  255. }