service.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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.cloud.essentialcontacts.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/essentialcontacts/v1/enums.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1;essentialcontacts";
  25. option java_multiple_files = true;
  26. option java_package = "com.google.cloud.essentialcontacts.v1";
  27. option csharp_namespace = "Google.Cloud.EssentialContacts.V1";
  28. option php_namespace = "Google\\Cloud\\EssentialContacts\\V1";
  29. option ruby_package = "Google::Cloud::EssentialContacts::V1";
  30. // Manages contacts for important Google Cloud notifications.
  31. service EssentialContactsService {
  32. option (google.api.default_host) = "essentialcontacts.googleapis.com";
  33. option (google.api.oauth_scopes) =
  34. "https://www.googleapis.com/auth/cloud-platform";
  35. // Adds a new contact for a resource.
  36. rpc CreateContact(CreateContactRequest) returns (Contact) {
  37. option (google.api.http) = {
  38. post: "/v1/{parent=projects/*}/contacts"
  39. body: "contact"
  40. additional_bindings {
  41. post: "/v1/{parent=folders/*}/contacts"
  42. body: "contact"
  43. }
  44. additional_bindings {
  45. post: "/v1/{parent=organizations/*}/contacts"
  46. body: "contact"
  47. }
  48. };
  49. option (google.api.method_signature) = "parent,contact";
  50. }
  51. // Updates a contact.
  52. // Note: A contact's email address cannot be changed.
  53. rpc UpdateContact(UpdateContactRequest) returns (Contact) {
  54. option (google.api.http) = {
  55. patch: "/v1/{contact.name=projects/*/contacts/*}"
  56. body: "contact"
  57. additional_bindings {
  58. patch: "/v1/{contact.name=folders/*/contacts/*}"
  59. body: "contact"
  60. }
  61. additional_bindings {
  62. patch: "/v1/{contact.name=organizations/*/contacts/*}"
  63. body: "contact"
  64. }
  65. };
  66. option (google.api.method_signature) = "contact,update_mask";
  67. }
  68. // Lists the contacts that have been set on a resource.
  69. rpc ListContacts(ListContactsRequest) returns (ListContactsResponse) {
  70. option (google.api.http) = {
  71. get: "/v1/{parent=projects/*}/contacts"
  72. additional_bindings { get: "/v1/{parent=folders/*}/contacts" }
  73. additional_bindings { get: "/v1/{parent=organizations/*}/contacts" }
  74. };
  75. option (google.api.method_signature) = "parent";
  76. }
  77. // Gets a single contact.
  78. rpc GetContact(GetContactRequest) returns (Contact) {
  79. option (google.api.http) = {
  80. get: "/v1/{name=projects/*/contacts/*}"
  81. additional_bindings { get: "/v1/{name=folders/*/contacts/*}" }
  82. additional_bindings { get: "/v1/{name=organizations/*/contacts/*}" }
  83. };
  84. option (google.api.method_signature) = "name";
  85. }
  86. // Deletes a contact.
  87. rpc DeleteContact(DeleteContactRequest) returns (google.protobuf.Empty) {
  88. option (google.api.http) = {
  89. delete: "/v1/{name=projects/*/contacts/*}"
  90. additional_bindings { delete: "/v1/{name=folders/*/contacts/*}" }
  91. additional_bindings { delete: "/v1/{name=organizations/*/contacts/*}" }
  92. };
  93. option (google.api.method_signature) = "name";
  94. }
  95. // Lists all contacts for the resource that are subscribed to the
  96. // specified notification categories, including contacts inherited from
  97. // any parent resources.
  98. rpc ComputeContacts(ComputeContactsRequest)
  99. returns (ComputeContactsResponse) {
  100. option (google.api.http) = {
  101. get: "/v1/{parent=projects/*}/contacts:compute"
  102. additional_bindings { get: "/v1/{parent=folders/*}/contacts:compute" }
  103. additional_bindings {
  104. get: "/v1/{parent=organizations/*}/contacts:compute"
  105. }
  106. };
  107. }
  108. // Allows a contact admin to send a test message to contact to verify that it
  109. // has been configured correctly.
  110. rpc SendTestMessage(SendTestMessageRequest) returns (google.protobuf.Empty) {
  111. option (google.api.http) = {
  112. post: "/v1/{resource=projects/*}/contacts:sendTestMessage"
  113. body: "*"
  114. additional_bindings {
  115. post: "/v1/{resource=folders/*}/contacts:sendTestMessage"
  116. body: "*"
  117. }
  118. additional_bindings {
  119. post: "/v1/{resource=organizations/*}/contacts:sendTestMessage"
  120. body: "*"
  121. }
  122. };
  123. }
  124. }
  125. // A contact that will receive notifications from Google Cloud.
  126. message Contact {
  127. option (google.api.resource) = {
  128. type: "essentialcontacts.googleapis.com/Contact"
  129. pattern: "projects/{project}/contacts/{contact}"
  130. pattern: "folders/{folder}/contacts/{contact}"
  131. pattern: "organizations/{organization}/contacts/{contact}"
  132. };
  133. // The identifier for the contact.
  134. // Format: {resource_type}/{resource_id}/contacts/{contact_id}
  135. string name = 1;
  136. // Required. The email address to send notifications to. This does not need to
  137. // be a Google account.
  138. string email = 2;
  139. // The categories of notifications that the contact will receive
  140. // communications for.
  141. repeated NotificationCategory notification_category_subscriptions = 3;
  142. // The preferred language for notifications, as a ISO 639-1 language code. See
  143. // [Supported
  144. // languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
  145. // for a list of supported languages.
  146. string language_tag = 4;
  147. // The validity of the contact. A contact is considered valid if it is the
  148. // correct recipient for notifications for a particular resource.
  149. ValidationState validation_state = 8;
  150. // The last time the validation_state was updated, either manually or
  151. // automatically. A contact is considered stale if its validation state was
  152. // updated more than 1 year ago.
  153. google.protobuf.Timestamp validate_time = 9;
  154. }
  155. // Request message for the ListContacts method.
  156. message ListContactsRequest {
  157. // Required. The parent resource name.
  158. // Format: organizations/{organization_id}, folders/{folder_id} or
  159. // projects/{project_id}
  160. string parent = 1 [
  161. (google.api.field_behavior) = REQUIRED,
  162. (google.api.resource_reference) = {
  163. child_type: "essentialcontacts.googleapis.com/Contact"
  164. }
  165. ];
  166. // Optional. The maximum number of results to return from this request.
  167. // Non-positive values are ignored. The presence of `next_page_token` in the
  168. // response indicates that more results might be available.
  169. // If not specified, the default page_size is 100.
  170. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  171. // Optional. If present, retrieves the next batch of results from the
  172. // preceding call to this method. `page_token` must be the value of
  173. // `next_page_token` from the previous response. The values of other method
  174. // parameters should be identical to those in the previous call.
  175. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  176. }
  177. // Response message for the ListContacts method.
  178. message ListContactsResponse {
  179. // The contacts for the specified resource.
  180. repeated Contact contacts = 1;
  181. // If there are more results than those appearing in this response, then
  182. // `next_page_token` is included. To get the next set of results, call this
  183. // method again using the value of `next_page_token` as `page_token` and the
  184. // rest of the parameters the same as the original request.
  185. string next_page_token = 2;
  186. }
  187. // Request message for the GetContact method.
  188. message GetContactRequest {
  189. // Required. The name of the contact to retrieve.
  190. // Format: organizations/{organization_id}/contacts/{contact_id},
  191. // folders/{folder_id}/contacts/{contact_id} or
  192. // projects/{project_id}/contacts/{contact_id}
  193. string name = 1 [
  194. (google.api.field_behavior) = REQUIRED,
  195. (google.api.resource_reference) = {
  196. type: "essentialcontacts.googleapis.com/Contact"
  197. }
  198. ];
  199. }
  200. // Request message for the DeleteContact method.
  201. message DeleteContactRequest {
  202. // Required. The name of the contact to delete.
  203. // Format: organizations/{organization_id}/contacts/{contact_id},
  204. // folders/{folder_id}/contacts/{contact_id} or
  205. // projects/{project_id}/contacts/{contact_id}
  206. string name = 1 [
  207. (google.api.field_behavior) = REQUIRED,
  208. (google.api.resource_reference) = {
  209. type: "essentialcontacts.googleapis.com/Contact"
  210. }
  211. ];
  212. }
  213. // Request message for the CreateContact method.
  214. message CreateContactRequest {
  215. // Required. The resource to save this contact for.
  216. // Format: organizations/{organization_id}, folders/{folder_id} or
  217. // projects/{project_id}
  218. string parent = 1 [
  219. (google.api.field_behavior) = REQUIRED,
  220. (google.api.resource_reference) = {
  221. child_type: "essentialcontacts.googleapis.com/Contact"
  222. }
  223. ];
  224. // Required. The contact to create. Must specify an email address and language
  225. // tag.
  226. Contact contact = 2 [(google.api.field_behavior) = REQUIRED];
  227. }
  228. // Request message for the UpdateContact method.
  229. message UpdateContactRequest {
  230. // Required. The contact resource to replace the existing saved contact. Note:
  231. // the email address of the contact cannot be modified.
  232. Contact contact = 2 [(google.api.field_behavior) = REQUIRED];
  233. // Optional. The update mask applied to the resource. For the `FieldMask`
  234. // definition, see
  235. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
  236. google.protobuf.FieldMask update_mask = 3
  237. [(google.api.field_behavior) = OPTIONAL];
  238. }
  239. // Request message for the ComputeContacts method.
  240. message ComputeContactsRequest {
  241. // Required. The name of the resource to compute contacts for.
  242. // Format: organizations/{organization_id},
  243. // folders/{folder_id} or projects/{project_id}
  244. string parent = 1 [
  245. (google.api.field_behavior) = REQUIRED,
  246. (google.api.resource_reference) = {
  247. child_type: "essentialcontacts.googleapis.com/Contact"
  248. }
  249. ];
  250. // The categories of notifications to compute contacts for. If ALL is included
  251. // in this list, contacts subscribed to any notification category will be
  252. // returned.
  253. repeated NotificationCategory notification_categories = 6;
  254. // Optional. The maximum number of results to return from this request.
  255. // Non-positive values are ignored. The presence of `next_page_token` in the
  256. // response indicates that more results might be available.
  257. // If not specified, the default page_size is 100.
  258. int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
  259. // Optional. If present, retrieves the next batch of results from the
  260. // preceding call to this method. `page_token` must be the value of
  261. // `next_page_token` from the previous response. The values of other method
  262. // parameters should be identical to those in the previous call.
  263. string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
  264. }
  265. // Response message for the ComputeContacts method.
  266. message ComputeContactsResponse {
  267. // All contacts for the resource that are subscribed to the specified
  268. // notification categories, including contacts inherited from any parent
  269. // resources.
  270. repeated Contact contacts = 1;
  271. // If there are more results than those appearing in this response, then
  272. // `next_page_token` is included. To get the next set of results, call this
  273. // method again using the value of `next_page_token` as `page_token` and the
  274. // rest of the parameters the same as the original request.
  275. string next_page_token = 2;
  276. }
  277. // Request message for the SendTestMessage method.
  278. message SendTestMessageRequest {
  279. // Required. The list of names of the contacts to send a test message to.
  280. // Format: organizations/{organization_id}/contacts/{contact_id},
  281. // folders/{folder_id}/contacts/{contact_id} or
  282. // projects/{project_id}/contacts/{contact_id}
  283. repeated string contacts = 1 [
  284. (google.api.field_behavior) = REQUIRED,
  285. (google.api.resource_reference) = {
  286. type: "essentialcontacts.googleapis.com/Contact"
  287. }
  288. ];
  289. // Required. The name of the resource to send the test message for. All
  290. // contacts must either be set directly on this resource or inherited from
  291. // another resource that is an ancestor of this one. Format:
  292. // organizations/{organization_id}, folders/{folder_id} or
  293. // projects/{project_id}
  294. string resource = 2 [
  295. (google.api.field_behavior) = REQUIRED,
  296. (google.api.resource_reference) = {
  297. child_type: "essentialcontacts.googleapis.com/Contact"
  298. }
  299. ];
  300. // Required. The notification category to send the test message for. All
  301. // contacts must be subscribed to this category.
  302. NotificationCategory notification_category = 3
  303. [(google.api.field_behavior) = REQUIRED];
  304. }