cloud_sql_users.proto 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. // Copyright 2022 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.sql.v1beta4;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/cloud/sql/v1beta4/cloud_sql_resources.proto";
  20. import "google/protobuf/duration.proto";
  21. import "google/protobuf/timestamp.proto";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/sql/v1beta4;sql";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "CloudSqlUsersProto";
  25. option java_package = "com.google.cloud.sql.v1beta4";
  26. // NOTE: No sensitive PII logging is allowed. If you are adding a field/enum
  27. // value that is sensitive PII, please add corresponding datapol annotation to
  28. // it. For more information, please see
  29. // https://g3doc.corp.google.com/storage/speckle/g3doc/purple_team/data_pol_annotations.md?cl=head
  30. service SqlUsersService {
  31. option (google.api.default_host) = "sqladmin.googleapis.com";
  32. option (google.api.oauth_scopes) =
  33. "https://www.googleapis.com/auth/cloud-platform,"
  34. "https://www.googleapis.com/auth/sqlservice.admin";
  35. // Deletes a user from a Cloud SQL instance.
  36. rpc Delete(SqlUsersDeleteRequest) returns (Operation) {
  37. option (google.api.http) = {
  38. delete: "/sql/v1beta4/projects/{project}/instances/{instance}/users"
  39. };
  40. }
  41. // Creates a new user in a Cloud SQL instance.
  42. rpc Insert(SqlUsersInsertRequest) returns (Operation) {
  43. option (google.api.http) = {
  44. post: "/sql/v1beta4/projects/{project}/instances/{instance}/users"
  45. body: "body"
  46. };
  47. }
  48. // Lists users in the specified Cloud SQL instance.
  49. rpc List(SqlUsersListRequest) returns (UsersListResponse) {
  50. option (google.api.http) = {
  51. get: "/sql/v1beta4/projects/{project}/instances/{instance}/users"
  52. };
  53. }
  54. // Updates an existing user in a Cloud SQL instance.
  55. rpc Update(SqlUsersUpdateRequest) returns (Operation) {
  56. option (google.api.http) = {
  57. put: "/sql/v1beta4/projects/{project}/instances/{instance}/users"
  58. body: "body"
  59. };
  60. }
  61. }
  62. message SqlUsersDeleteRequest {
  63. // Host of the user in the instance.
  64. string host = 1;
  65. // Database instance ID. This does not include the project ID.
  66. string instance = 2;
  67. // Name of the user in the instance.
  68. string name = 3;
  69. // Project ID of the project that contains the instance.
  70. string project = 4;
  71. }
  72. message SqlUsersInsertRequest {
  73. // Database instance ID. This does not include the project ID.
  74. string instance = 1;
  75. // Project ID of the project that contains the instance.
  76. string project = 2;
  77. User body = 100;
  78. }
  79. message SqlUsersListRequest {
  80. // Database instance ID. This does not include the project ID.
  81. string instance = 1;
  82. // Project ID of the project that contains the instance.
  83. string project = 2;
  84. }
  85. message SqlUsersUpdateRequest {
  86. // Optional. Host of the user in the instance.
  87. string host = 1 [(google.api.field_behavior) = OPTIONAL];
  88. // Database instance ID. This does not include the project ID.
  89. string instance = 2;
  90. // Name of the user in the instance.
  91. string name = 3;
  92. // Project ID of the project that contains the instance.
  93. string project = 4;
  94. User body = 100;
  95. }
  96. // User level password validation policy.
  97. message UserPasswordValidationPolicy {
  98. // Number of failed login attempts allowed before user get locked.
  99. int32 allowed_failed_attempts = 1;
  100. // Expiration duration after password is updated.
  101. google.protobuf.Duration password_expiration_duration = 2;
  102. // If true, failed login attempts check will be enabled.
  103. bool enable_failed_attempts_check = 3;
  104. // Output only. Read-only password status.
  105. PasswordStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  106. }
  107. // Read-only password status.
  108. message PasswordStatus {
  109. // If true, user does not have login privileges.
  110. bool locked = 1;
  111. // The expiration time of the current password.
  112. google.protobuf.Timestamp password_expiration_time = 2;
  113. }
  114. // A Cloud SQL user resource.
  115. message User {
  116. // The user type.
  117. enum SqlUserType {
  118. // The database's built-in user type.
  119. BUILT_IN = 0;
  120. // Cloud IAM user.
  121. CLOUD_IAM_USER = 1;
  122. // Cloud IAM service account.
  123. CLOUD_IAM_SERVICE_ACCOUNT = 2;
  124. }
  125. // This is always `sql#user`.
  126. string kind = 1;
  127. // The password for the user.
  128. string password = 2;
  129. // This field is deprecated and will be removed from a future version of the
  130. // API.
  131. string etag = 3;
  132. // The name of the user in the Cloud SQL instance. Can be omitted for
  133. // `update` because it is already specified in the URL.
  134. string name = 4;
  135. // Optional. The host from which the user can connect. For `insert`
  136. // operations, host defaults to an empty string. For `update`
  137. // operations, host is specified as part of the request URL. The host name
  138. // cannot be updated after insertion. For a MySQL instance, it's required;
  139. // for a PostgreSQL or SQL Server instance, it's optional.
  140. string host = 5 [(google.api.field_behavior) = OPTIONAL];
  141. // The name of the Cloud SQL instance. This does not include the project ID.
  142. // Can be omitted for <b>update</b> because it is already specified on the
  143. // URL.
  144. string instance = 6;
  145. // The project ID of the project containing the Cloud SQL database. The Google
  146. // apps domain is prefixed if applicable. Can be omitted for
  147. // <b>update</b> because it is already specified on the URL.
  148. string project = 7;
  149. // The user type. It determines the method to authenticate the user during
  150. // login. The default is the database's built-in user type.
  151. SqlUserType type = 8;
  152. // User details for specific database type
  153. oneof user_details {
  154. SqlServerUserDetails sqlserver_user_details = 9;
  155. }
  156. // User level password validation policy.
  157. UserPasswordValidationPolicy password_policy = 12;
  158. }
  159. // Represents a Sql Server user on the Cloud SQL instance.
  160. message SqlServerUserDetails {
  161. // If the user has been disabled
  162. bool disabled = 1;
  163. // The server roles for this user
  164. repeated string server_roles = 2;
  165. }
  166. // User list response.
  167. message UsersListResponse {
  168. // This is always <b>sql#usersList</b>.
  169. string kind = 1;
  170. // List of user resources in the instance.
  171. repeated User items = 2;
  172. // An identifier that uniquely identifies the operation. You can use this
  173. // identifier to retrieve the Operations resource that has information about
  174. // the operation.
  175. string next_page_token = 3;
  176. }