cloud_sql_users.proto 5.7 KB

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