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