oslogin.proto 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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.oslogin.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/oslogin/common/common.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option csharp_namespace = "Google.Cloud.OsLogin.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "OsLoginProto";
  27. option java_package = "com.google.cloud.oslogin.v1";
  28. option php_namespace = "Google\\Cloud\\OsLogin\\V1";
  29. option ruby_package = "Google::Cloud::OsLogin::V1";
  30. // Cloud OS Login API
  31. //
  32. // The Cloud OS Login API allows you to manage users and their associated SSH
  33. // public keys for logging into virtual machines on Google Cloud Platform.
  34. service OsLoginService {
  35. option (google.api.default_host) = "oslogin.googleapis.com";
  36. option (google.api.oauth_scopes) =
  37. "https://www.googleapis.com/auth/cloud-platform,"
  38. "https://www.googleapis.com/auth/cloud-platform.read-only,"
  39. "https://www.googleapis.com/auth/compute,"
  40. "https://www.googleapis.com/auth/compute.readonly";
  41. // Create an SSH public key
  42. rpc CreateSshPublicKey(CreateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) {
  43. option (google.api.http) = {
  44. post: "/v1/{parent=users/*}/sshPublicKeys"
  45. body: "ssh_public_key"
  46. };
  47. option (google.api.method_signature) = "parent,ssh_public_key";
  48. }
  49. // Deletes a POSIX account.
  50. rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) {
  51. option (google.api.http) = {
  52. delete: "/v1/{name=users/*/projects/*}"
  53. };
  54. option (google.api.method_signature) = "name";
  55. }
  56. // Deletes an SSH public key.
  57. rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) {
  58. option (google.api.http) = {
  59. delete: "/v1/{name=users/*/sshPublicKeys/*}"
  60. };
  61. option (google.api.method_signature) = "name";
  62. }
  63. // Retrieves the profile information used for logging in to a virtual machine
  64. // on Google Compute Engine.
  65. rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) {
  66. option (google.api.http) = {
  67. get: "/v1/{name=users/*}/loginProfile"
  68. };
  69. option (google.api.method_signature) = "name";
  70. }
  71. // Retrieves an SSH public key.
  72. rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) {
  73. option (google.api.http) = {
  74. get: "/v1/{name=users/*/sshPublicKeys/*}"
  75. };
  76. option (google.api.method_signature) = "name";
  77. }
  78. // Adds an SSH public key and returns the profile information. Default POSIX
  79. // account information is set when no username and UID exist as part of the
  80. // login profile.
  81. rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) {
  82. option (google.api.http) = {
  83. post: "/v1/{parent=users/*}:importSshPublicKey"
  84. body: "ssh_public_key"
  85. };
  86. option (google.api.method_signature) = "parent,ssh_public_key";
  87. option (google.api.method_signature) = "parent,ssh_public_key,project_id";
  88. }
  89. // Updates an SSH public key and returns the profile information. This method
  90. // supports patch semantics.
  91. rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) {
  92. option (google.api.http) = {
  93. patch: "/v1/{name=users/*/sshPublicKeys/*}"
  94. body: "ssh_public_key"
  95. };
  96. option (google.api.method_signature) = "name,ssh_public_key";
  97. option (google.api.method_signature) = "name,ssh_public_key,update_mask";
  98. }
  99. }
  100. // The user profile information used for logging in to a virtual machine on
  101. // Google Compute Engine.
  102. message LoginProfile {
  103. // Required. A unique user ID.
  104. string name = 1 [(google.api.field_behavior) = REQUIRED];
  105. // The list of POSIX accounts associated with the user.
  106. repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2;
  107. // A map from SSH public key fingerprint to the associated key object.
  108. map<string, google.cloud.oslogin.common.SshPublicKey> ssh_public_keys = 3;
  109. }
  110. // A request message for creating an SSH public key.
  111. message CreateSshPublicKeyRequest {
  112. // Required. The unique ID for the user in format `users/{user}`.
  113. string parent = 1 [
  114. (google.api.field_behavior) = REQUIRED,
  115. (google.api.resource_reference) = {
  116. child_type: "oslogin.googleapis.com/SshPublicKey"
  117. }
  118. ];
  119. // Required. The SSH public key and expiration time.
  120. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
  121. }
  122. // A request message for deleting a POSIX account entry.
  123. message DeletePosixAccountRequest {
  124. // Required. A reference to the POSIX account to update. POSIX accounts are identified
  125. // by the project ID they are associated with. A reference to the POSIX
  126. // account is in format `users/{user}/projects/{project}`.
  127. string name = 1 [
  128. (google.api.field_behavior) = REQUIRED,
  129. (google.api.resource_reference) = {
  130. type: "oslogin.googleapis.com/PosixAccount"
  131. }
  132. ];
  133. }
  134. // A request message for deleting an SSH public key.
  135. message DeleteSshPublicKeyRequest {
  136. // Required. The fingerprint of the public key to update. Public keys are identified by
  137. // their SHA-256 fingerprint. The fingerprint of the public key is in format
  138. // `users/{user}/sshPublicKeys/{fingerprint}`.
  139. string name = 1 [
  140. (google.api.field_behavior) = REQUIRED,
  141. (google.api.resource_reference) = {
  142. type: "oslogin.googleapis.com/SshPublicKey"
  143. }
  144. ];
  145. }
  146. // A request message for retrieving the login profile information for a user.
  147. message GetLoginProfileRequest {
  148. // Required. The unique ID for the user in format `users/{user}`.
  149. string name = 1 [
  150. (google.api.field_behavior) = REQUIRED,
  151. (google.api.resource_reference) = {
  152. child_type: "oslogin.googleapis.com/PosixAccount"
  153. }
  154. ];
  155. // The project ID of the Google Cloud Platform project.
  156. string project_id = 2;
  157. // A system ID for filtering the results of the request.
  158. string system_id = 3;
  159. }
  160. // A request message for retrieving an SSH public key.
  161. message GetSshPublicKeyRequest {
  162. // Required. The fingerprint of the public key to retrieve. Public keys are identified
  163. // by their SHA-256 fingerprint. The fingerprint of the public key is in
  164. // format `users/{user}/sshPublicKeys/{fingerprint}`.
  165. string name = 1 [
  166. (google.api.field_behavior) = REQUIRED,
  167. (google.api.resource_reference) = {
  168. type: "oslogin.googleapis.com/SshPublicKey"
  169. }
  170. ];
  171. }
  172. // A request message for importing an SSH public key.
  173. message ImportSshPublicKeyRequest {
  174. // Required. The unique ID for the user in format `users/{user}`.
  175. string parent = 1 [
  176. (google.api.field_behavior) = REQUIRED,
  177. (google.api.resource_reference) = {
  178. child_type: "oslogin.googleapis.com/SshPublicKey"
  179. }
  180. ];
  181. // Optional. The SSH public key and expiration time.
  182. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = OPTIONAL];
  183. // The project ID of the Google Cloud Platform project.
  184. string project_id = 3;
  185. }
  186. // A response message for importing an SSH public key.
  187. message ImportSshPublicKeyResponse {
  188. // The login profile information for the user.
  189. LoginProfile login_profile = 1;
  190. // Detailed information about import results.
  191. string details = 2;
  192. }
  193. // A request message for updating an SSH public key.
  194. message UpdateSshPublicKeyRequest {
  195. // Required. The fingerprint of the public key to update. Public keys are identified by
  196. // their SHA-256 fingerprint. The fingerprint of the public key is in format
  197. // `users/{user}/sshPublicKeys/{fingerprint}`.
  198. string name = 1 [
  199. (google.api.field_behavior) = REQUIRED,
  200. (google.api.resource_reference) = {
  201. type: "oslogin.googleapis.com/SshPublicKey"
  202. }
  203. ];
  204. // Required. The SSH public key and expiration time.
  205. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
  206. // Mask to control which fields get updated. Updates all if not present.
  207. google.protobuf.FieldMask update_mask = 3;
  208. }