oslogin.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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.v1beta;
  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.V1Beta";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta;oslogin";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "OsLoginProto";
  27. option java_package = "com.google.cloud.oslogin.v1beta";
  28. option php_namespace = "Google\\Cloud\\OsLogin\\V1beta";
  29. option ruby_package = "Google::Cloud::OsLogin::V1beta";
  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: "/v1beta/{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: "/v1beta/{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: "/v1beta/{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: "/v1beta/{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: "/v1beta/{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: "/v1beta/{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: "/v1beta/{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. // The registered security key credentials for a user.
  110. repeated SecurityKey security_keys = 5;
  111. }
  112. // A request message for creating an SSH public key.
  113. message CreateSshPublicKeyRequest {
  114. // Required. The unique ID for the user in format `users/{user}`.
  115. string parent = 1 [
  116. (google.api.field_behavior) = REQUIRED,
  117. (google.api.resource_reference) = {
  118. child_type: "oslogin.googleapis.com/SshPublicKey"
  119. }
  120. ];
  121. // Required. The SSH public key and expiration time.
  122. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
  123. }
  124. // A request message for deleting a POSIX account entry.
  125. message DeletePosixAccountRequest {
  126. // Required. A reference to the POSIX account to update. POSIX accounts are identified
  127. // by the project ID they are associated with. A reference to the POSIX
  128. // account is in format `users/{user}/projects/{project}`.
  129. string name = 1 [
  130. (google.api.field_behavior) = REQUIRED,
  131. (google.api.resource_reference) = {
  132. type: "oslogin.googleapis.com/PosixAccount"
  133. }
  134. ];
  135. }
  136. // A request message for deleting an SSH public key.
  137. message DeleteSshPublicKeyRequest {
  138. // Required. The fingerprint of the public key to update. Public keys are identified by
  139. // their SHA-256 fingerprint. The fingerprint of the public key is in format
  140. // `users/{user}/sshPublicKeys/{fingerprint}`.
  141. string name = 1 [
  142. (google.api.field_behavior) = REQUIRED,
  143. (google.api.resource_reference) = {
  144. type: "oslogin.googleapis.com/SshPublicKey"
  145. }
  146. ];
  147. }
  148. // A request message for retrieving the login profile information for a user.
  149. message GetLoginProfileRequest {
  150. // Required. The unique ID for the user in format `users/{user}`.
  151. string name = 1 [
  152. (google.api.field_behavior) = REQUIRED,
  153. (google.api.resource_reference) = {
  154. type: "oslogin.googleapis.com/User"
  155. }
  156. ];
  157. // The project ID of the Google Cloud Platform project.
  158. string project_id = 2;
  159. // A system ID for filtering the results of the request.
  160. string system_id = 3;
  161. // The view configures whether to retrieve security keys information.
  162. LoginProfileView view = 4;
  163. }
  164. // A request message for retrieving an SSH public key.
  165. message GetSshPublicKeyRequest {
  166. // Required. The fingerprint of the public key to retrieve. Public keys are identified
  167. // by their SHA-256 fingerprint. The fingerprint of the public key is in
  168. // format `users/{user}/sshPublicKeys/{fingerprint}`.
  169. string name = 1 [
  170. (google.api.field_behavior) = REQUIRED,
  171. (google.api.resource_reference) = {
  172. type: "oslogin.googleapis.com/SshPublicKey"
  173. }
  174. ];
  175. }
  176. // A request message for importing an SSH public key.
  177. message ImportSshPublicKeyRequest {
  178. // The unique ID for the user in format `users/{user}`.
  179. string parent = 1 [(google.api.resource_reference) = {
  180. child_type: "oslogin.googleapis.com/SshPublicKey"
  181. }];
  182. // Required. The SSH public key and expiration time.
  183. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
  184. // The project ID of the Google Cloud Platform project.
  185. string project_id = 3;
  186. // The view configures whether to retrieve security keys information.
  187. LoginProfileView view = 4;
  188. }
  189. // A response message for importing an SSH public key.
  190. message ImportSshPublicKeyResponse {
  191. // The login profile information for the user.
  192. LoginProfile login_profile = 1;
  193. // Detailed information about import results.
  194. string details = 2;
  195. }
  196. // A request message for updating an SSH public key.
  197. message UpdateSshPublicKeyRequest {
  198. // Required. The fingerprint of the public key to update. Public keys are identified by
  199. // their SHA-256 fingerprint. The fingerprint of the public key is in format
  200. // `users/{user}/sshPublicKeys/{fingerprint}`.
  201. string name = 1 [
  202. (google.api.field_behavior) = REQUIRED,
  203. (google.api.resource_reference) = {
  204. type: "oslogin.googleapis.com/SshPublicKey"
  205. }
  206. ];
  207. // Required. The SSH public key and expiration time.
  208. google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED];
  209. // Mask to control which fields get updated. Updates all if not present.
  210. google.protobuf.FieldMask update_mask = 3;
  211. }
  212. // The credential information for a Google registered security key.
  213. message SecurityKey {
  214. // Public key text in SSH format, defined by
  215. // [RFC4253]("https://www.ietf.org/rfc/rfc4253.txt") section 6.6.
  216. string public_key = 1;
  217. // Hardware-backed private key text in SSH format.
  218. string private_key = 2;
  219. // The FIDO protocol type used to register this credential.
  220. oneof protocol_type {
  221. // The U2F protocol type.
  222. UniversalTwoFactor universal_two_factor = 3;
  223. // The Web Authentication protocol type.
  224. WebAuthn web_authn = 4;
  225. }
  226. }
  227. // Security key information specific to the U2F protocol.
  228. message UniversalTwoFactor {
  229. // Application ID for the U2F protocol.
  230. string app_id = 1;
  231. }
  232. // Security key information specific to the Web Authentication protocol.
  233. message WebAuthn {
  234. // Relying party ID for Web Authentication.
  235. string rp_id = 1;
  236. }
  237. // The login profile view limits the user content retrieved.
  238. enum LoginProfileView {
  239. // The default login profile view. The API defaults to the BASIC view.
  240. LOGIN_PROFILE_VIEW_UNSPECIFIED = 0;
  241. // Includes POSIX and SSH key information.
  242. BASIC = 1;
  243. // Include security key information for the user.
  244. SECURITY_KEY = 2;
  245. }