cloud_sql_users.proto 5.8 KB

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