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