OLD | NEW |
(Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis_beta.oslogin.v1alpha; |
| 4 |
| 5 import 'dart:core' as core; |
| 6 import 'dart:async' as async; |
| 7 import 'dart:convert' as convert; |
| 8 |
| 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 10 import 'package:http/http.dart' as http; |
| 11 |
| 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 13 ApiRequestError, DetailedApiRequestError; |
| 14 |
| 15 const core.String USER_AGENT = 'dart-api-client oslogin/v1alpha'; |
| 16 |
| 17 /** |
| 18 * A Google Cloud API for managing OS login configuration for Directory API |
| 19 * users. |
| 20 */ |
| 21 class OsloginApi { |
| 22 /** View and manage your data across Google Cloud Platform services */ |
| 23 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; |
| 24 |
| 25 /** View your data across Google Cloud Platform services */ |
| 26 static const CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/clo
ud-platform.read-only"; |
| 27 |
| 28 |
| 29 final commons.ApiRequester _requester; |
| 30 |
| 31 UsersResourceApi get users => new UsersResourceApi(_requester); |
| 32 |
| 33 OsloginApi(http.Client client, {core.String rootUrl: "https://oslogin.googleap
is.com/", core.String servicePath: ""}) : |
| 34 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 35 } |
| 36 |
| 37 |
| 38 class UsersResourceApi { |
| 39 final commons.ApiRequester _requester; |
| 40 |
| 41 UsersSshPublicKeysResourceApi get sshPublicKeys => new UsersSshPublicKeysResou
rceApi(_requester); |
| 42 |
| 43 UsersResourceApi(commons.ApiRequester client) : |
| 44 _requester = client; |
| 45 |
| 46 /** |
| 47 * Retrieves the profile information used for logging in to a virtual machine |
| 48 * on Google Compute Engine. |
| 49 * |
| 50 * Request parameters: |
| 51 * |
| 52 * [name] - The unique ID for the user in format `users/{user}`. |
| 53 * Value must have pattern "^users/[^/]+$". |
| 54 * |
| 55 * Completes with a [LoginProfile]. |
| 56 * |
| 57 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 58 * error. |
| 59 * |
| 60 * If the used [http.Client] completes with an error when making a REST call, |
| 61 * this method will complete with the same error. |
| 62 */ |
| 63 async.Future<LoginProfile> getLoginProfile(core.String name) { |
| 64 var _url = null; |
| 65 var _queryParams = new core.Map(); |
| 66 var _uploadMedia = null; |
| 67 var _uploadOptions = null; |
| 68 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 69 var _body = null; |
| 70 |
| 71 if (name == null) { |
| 72 throw new core.ArgumentError("Parameter name is required."); |
| 73 } |
| 74 |
| 75 _url = 'v1alpha/' + commons.Escaper.ecapeVariableReserved('$name') + '/login
Profile'; |
| 76 |
| 77 var _response = _requester.request(_url, |
| 78 "GET", |
| 79 body: _body, |
| 80 queryParams: _queryParams, |
| 81 uploadOptions: _uploadOptions, |
| 82 uploadMedia: _uploadMedia, |
| 83 downloadOptions: _downloadOptions); |
| 84 return _response.then((data) => new LoginProfile.fromJson(data)); |
| 85 } |
| 86 |
| 87 /** |
| 88 * Adds an SSH public key and returns the profile information. Default POSIX |
| 89 * account information is set when no username and UID exist as part of the |
| 90 * login profile. |
| 91 * |
| 92 * [request] - The metadata request object. |
| 93 * |
| 94 * Request parameters: |
| 95 * |
| 96 * [parent] - The unique ID for the user in format `users/{user}`. |
| 97 * Value must have pattern "^users/[^/]+$". |
| 98 * |
| 99 * Completes with a [ImportSshPublicKeyResponse]. |
| 100 * |
| 101 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 102 * error. |
| 103 * |
| 104 * If the used [http.Client] completes with an error when making a REST call, |
| 105 * this method will complete with the same error. |
| 106 */ |
| 107 async.Future<ImportSshPublicKeyResponse> importSshPublicKey(SshPublicKey reque
st, core.String parent) { |
| 108 var _url = null; |
| 109 var _queryParams = new core.Map(); |
| 110 var _uploadMedia = null; |
| 111 var _uploadOptions = null; |
| 112 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 113 var _body = null; |
| 114 |
| 115 if (request != null) { |
| 116 _body = convert.JSON.encode((request).toJson()); |
| 117 } |
| 118 if (parent == null) { |
| 119 throw new core.ArgumentError("Parameter parent is required."); |
| 120 } |
| 121 |
| 122 _url = 'v1alpha/' + commons.Escaper.ecapeVariableReserved('$parent') + ':imp
ortSshPublicKey'; |
| 123 |
| 124 var _response = _requester.request(_url, |
| 125 "POST", |
| 126 body: _body, |
| 127 queryParams: _queryParams, |
| 128 uploadOptions: _uploadOptions, |
| 129 uploadMedia: _uploadMedia, |
| 130 downloadOptions: _downloadOptions); |
| 131 return _response.then((data) => new ImportSshPublicKeyResponse.fromJson(data
)); |
| 132 } |
| 133 |
| 134 } |
| 135 |
| 136 |
| 137 class UsersSshPublicKeysResourceApi { |
| 138 final commons.ApiRequester _requester; |
| 139 |
| 140 UsersSshPublicKeysResourceApi(commons.ApiRequester client) : |
| 141 _requester = client; |
| 142 |
| 143 /** |
| 144 * Deletes an SSH public key. |
| 145 * |
| 146 * Request parameters: |
| 147 * |
| 148 * [name] - The fingerprint of the public key to update. Public keys are |
| 149 * identified by |
| 150 * their SHA-256 fingerprint. The fingerprint of the public key is in format |
| 151 * `users/{user}/sshPublicKeys/{fingerprint}`. |
| 152 * Value must have pattern "^users/[^/]+/sshPublicKeys/[^/]+$". |
| 153 * |
| 154 * Completes with a [Empty]. |
| 155 * |
| 156 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 157 * error. |
| 158 * |
| 159 * If the used [http.Client] completes with an error when making a REST call, |
| 160 * this method will complete with the same error. |
| 161 */ |
| 162 async.Future<Empty> delete(core.String name) { |
| 163 var _url = null; |
| 164 var _queryParams = new core.Map(); |
| 165 var _uploadMedia = null; |
| 166 var _uploadOptions = null; |
| 167 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 168 var _body = null; |
| 169 |
| 170 if (name == null) { |
| 171 throw new core.ArgumentError("Parameter name is required."); |
| 172 } |
| 173 |
| 174 _url = 'v1alpha/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 175 |
| 176 var _response = _requester.request(_url, |
| 177 "DELETE", |
| 178 body: _body, |
| 179 queryParams: _queryParams, |
| 180 uploadOptions: _uploadOptions, |
| 181 uploadMedia: _uploadMedia, |
| 182 downloadOptions: _downloadOptions); |
| 183 return _response.then((data) => new Empty.fromJson(data)); |
| 184 } |
| 185 |
| 186 /** |
| 187 * Retrieves an SSH public key. |
| 188 * |
| 189 * Request parameters: |
| 190 * |
| 191 * [name] - The fingerprint of the public key to retrieve. Public keys are |
| 192 * identified |
| 193 * by their SHA-256 fingerprint. The fingerprint of the public key is in |
| 194 * format `users/{user}/sshPublicKeys/{fingerprint}`. |
| 195 * Value must have pattern "^users/[^/]+/sshPublicKeys/[^/]+$". |
| 196 * |
| 197 * Completes with a [SshPublicKey]. |
| 198 * |
| 199 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 200 * error. |
| 201 * |
| 202 * If the used [http.Client] completes with an error when making a REST call, |
| 203 * this method will complete with the same error. |
| 204 */ |
| 205 async.Future<SshPublicKey> get(core.String name) { |
| 206 var _url = null; |
| 207 var _queryParams = new core.Map(); |
| 208 var _uploadMedia = null; |
| 209 var _uploadOptions = null; |
| 210 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 211 var _body = null; |
| 212 |
| 213 if (name == null) { |
| 214 throw new core.ArgumentError("Parameter name is required."); |
| 215 } |
| 216 |
| 217 _url = 'v1alpha/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 218 |
| 219 var _response = _requester.request(_url, |
| 220 "GET", |
| 221 body: _body, |
| 222 queryParams: _queryParams, |
| 223 uploadOptions: _uploadOptions, |
| 224 uploadMedia: _uploadMedia, |
| 225 downloadOptions: _downloadOptions); |
| 226 return _response.then((data) => new SshPublicKey.fromJson(data)); |
| 227 } |
| 228 |
| 229 /** |
| 230 * Updates an SSH public key and returns the profile information. This method |
| 231 * supports patch semantics. |
| 232 * |
| 233 * [request] - The metadata request object. |
| 234 * |
| 235 * Request parameters: |
| 236 * |
| 237 * [name] - The fingerprint of the public key to update. Public keys are |
| 238 * identified by |
| 239 * their SHA-256 fingerprint. The fingerprint of the public key is in format |
| 240 * `users/{user}/sshPublicKeys/{fingerprint}`. |
| 241 * Value must have pattern "^users/[^/]+/sshPublicKeys/[^/]+$". |
| 242 * |
| 243 * [updateMask] - Mask to control which fields get updated. Updates all if not |
| 244 * present. |
| 245 * |
| 246 * Completes with a [SshPublicKey]. |
| 247 * |
| 248 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 249 * error. |
| 250 * |
| 251 * If the used [http.Client] completes with an error when making a REST call, |
| 252 * this method will complete with the same error. |
| 253 */ |
| 254 async.Future<SshPublicKey> patch(SshPublicKey request, core.String name, {core
.String updateMask}) { |
| 255 var _url = null; |
| 256 var _queryParams = new core.Map(); |
| 257 var _uploadMedia = null; |
| 258 var _uploadOptions = null; |
| 259 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 260 var _body = null; |
| 261 |
| 262 if (request != null) { |
| 263 _body = convert.JSON.encode((request).toJson()); |
| 264 } |
| 265 if (name == null) { |
| 266 throw new core.ArgumentError("Parameter name is required."); |
| 267 } |
| 268 if (updateMask != null) { |
| 269 _queryParams["updateMask"] = [updateMask]; |
| 270 } |
| 271 |
| 272 _url = 'v1alpha/' + commons.Escaper.ecapeVariableReserved('$name'); |
| 273 |
| 274 var _response = _requester.request(_url, |
| 275 "PATCH", |
| 276 body: _body, |
| 277 queryParams: _queryParams, |
| 278 uploadOptions: _uploadOptions, |
| 279 uploadMedia: _uploadMedia, |
| 280 downloadOptions: _downloadOptions); |
| 281 return _response.then((data) => new SshPublicKey.fromJson(data)); |
| 282 } |
| 283 |
| 284 } |
| 285 |
| 286 |
| 287 |
| 288 /** |
| 289 * A generic empty message that you can re-use to avoid defining duplicated |
| 290 * empty messages in your APIs. A typical example is to use it as the request |
| 291 * or the response type of an API method. For instance: |
| 292 * |
| 293 * service Foo { |
| 294 * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); |
| 295 * } |
| 296 * |
| 297 * The JSON representation for `Empty` is empty JSON object `{}`. |
| 298 */ |
| 299 class Empty { |
| 300 |
| 301 Empty(); |
| 302 |
| 303 Empty.fromJson(core.Map _json) { |
| 304 } |
| 305 |
| 306 core.Map<core.String, core.Object> toJson() { |
| 307 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 308 return _json; |
| 309 } |
| 310 } |
| 311 |
| 312 /** A response message for importing an SSH public key. */ |
| 313 class ImportSshPublicKeyResponse { |
| 314 /** The login profile information for the user. */ |
| 315 LoginProfile loginProfile; |
| 316 |
| 317 ImportSshPublicKeyResponse(); |
| 318 |
| 319 ImportSshPublicKeyResponse.fromJson(core.Map _json) { |
| 320 if (_json.containsKey("loginProfile")) { |
| 321 loginProfile = new LoginProfile.fromJson(_json["loginProfile"]); |
| 322 } |
| 323 } |
| 324 |
| 325 core.Map<core.String, core.Object> toJson() { |
| 326 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 327 if (loginProfile != null) { |
| 328 _json["loginProfile"] = (loginProfile).toJson(); |
| 329 } |
| 330 return _json; |
| 331 } |
| 332 } |
| 333 |
| 334 /** |
| 335 * The Directory API profile information used for logging in to a virtual |
| 336 * machine on Google Compute Engine. |
| 337 */ |
| 338 class LoginProfile { |
| 339 /** A unique user ID for identifying the user. */ |
| 340 core.String name; |
| 341 /** The list of POSIX accounts associated with the Directory API user. */ |
| 342 core.List<PosixAccount> posixAccounts; |
| 343 /** A map from SSH public key fingerprint to the associated key object. */ |
| 344 core.Map<core.String, SshPublicKey> sshPublicKeys; |
| 345 /** Indicates if the user is suspended. */ |
| 346 core.bool suspended; |
| 347 |
| 348 LoginProfile(); |
| 349 |
| 350 LoginProfile.fromJson(core.Map _json) { |
| 351 if (_json.containsKey("name")) { |
| 352 name = _json["name"]; |
| 353 } |
| 354 if (_json.containsKey("posixAccounts")) { |
| 355 posixAccounts = _json["posixAccounts"].map((value) => new PosixAccount.fro
mJson(value)).toList(); |
| 356 } |
| 357 if (_json.containsKey("sshPublicKeys")) { |
| 358 sshPublicKeys = commons.mapMap<core.Map<core.String, core.Object>, SshPubl
icKey>(_json["sshPublicKeys"], (core.Map<core.String, core.Object> item) => new
SshPublicKey.fromJson(item)); |
| 359 } |
| 360 if (_json.containsKey("suspended")) { |
| 361 suspended = _json["suspended"]; |
| 362 } |
| 363 } |
| 364 |
| 365 core.Map<core.String, core.Object> toJson() { |
| 366 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 367 if (name != null) { |
| 368 _json["name"] = name; |
| 369 } |
| 370 if (posixAccounts != null) { |
| 371 _json["posixAccounts"] = posixAccounts.map((value) => (value).toJson()).to
List(); |
| 372 } |
| 373 if (sshPublicKeys != null) { |
| 374 _json["sshPublicKeys"] = commons.mapMap<SshPublicKey, core.Map<core.String
, core.Object>>(sshPublicKeys, (SshPublicKey item) => (item).toJson()); |
| 375 } |
| 376 if (suspended != null) { |
| 377 _json["suspended"] = suspended; |
| 378 } |
| 379 return _json; |
| 380 } |
| 381 } |
| 382 |
| 383 /** The POSIX account information associated with a Directory API User. */ |
| 384 class PosixAccount { |
| 385 /** The GECOS (user information) entry for this account. */ |
| 386 core.String gecos; |
| 387 /** The default group ID. */ |
| 388 core.int gid; |
| 389 /** The path to the home directory for this account. */ |
| 390 core.String homeDirectory; |
| 391 /** Only one POSIX account can be marked as primary. */ |
| 392 core.bool primary; |
| 393 /** The path to the logic shell for this account. */ |
| 394 core.String shell; |
| 395 /** |
| 396 * System identifier for which account the username or uid applies to. |
| 397 * By default, the empty value is used. |
| 398 */ |
| 399 core.String systemId; |
| 400 /** The user ID. */ |
| 401 core.int uid; |
| 402 /** The username of the POSIX account. */ |
| 403 core.String username; |
| 404 |
| 405 PosixAccount(); |
| 406 |
| 407 PosixAccount.fromJson(core.Map _json) { |
| 408 if (_json.containsKey("gecos")) { |
| 409 gecos = _json["gecos"]; |
| 410 } |
| 411 if (_json.containsKey("gid")) { |
| 412 gid = _json["gid"]; |
| 413 } |
| 414 if (_json.containsKey("homeDirectory")) { |
| 415 homeDirectory = _json["homeDirectory"]; |
| 416 } |
| 417 if (_json.containsKey("primary")) { |
| 418 primary = _json["primary"]; |
| 419 } |
| 420 if (_json.containsKey("shell")) { |
| 421 shell = _json["shell"]; |
| 422 } |
| 423 if (_json.containsKey("systemId")) { |
| 424 systemId = _json["systemId"]; |
| 425 } |
| 426 if (_json.containsKey("uid")) { |
| 427 uid = _json["uid"]; |
| 428 } |
| 429 if (_json.containsKey("username")) { |
| 430 username = _json["username"]; |
| 431 } |
| 432 } |
| 433 |
| 434 core.Map<core.String, core.Object> toJson() { |
| 435 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 436 if (gecos != null) { |
| 437 _json["gecos"] = gecos; |
| 438 } |
| 439 if (gid != null) { |
| 440 _json["gid"] = gid; |
| 441 } |
| 442 if (homeDirectory != null) { |
| 443 _json["homeDirectory"] = homeDirectory; |
| 444 } |
| 445 if (primary != null) { |
| 446 _json["primary"] = primary; |
| 447 } |
| 448 if (shell != null) { |
| 449 _json["shell"] = shell; |
| 450 } |
| 451 if (systemId != null) { |
| 452 _json["systemId"] = systemId; |
| 453 } |
| 454 if (uid != null) { |
| 455 _json["uid"] = uid; |
| 456 } |
| 457 if (username != null) { |
| 458 _json["username"] = username; |
| 459 } |
| 460 return _json; |
| 461 } |
| 462 } |
| 463 |
| 464 /** The SSH public key information associated with a Directory API User. */ |
| 465 class SshPublicKey { |
| 466 /** An expiration time in microseconds since epoch. */ |
| 467 core.String expirationTimeUsec; |
| 468 /** [Output Only] The SHA-256 fingerprint of the SSH public key. */ |
| 469 core.String fingerprint; |
| 470 /** |
| 471 * Public key text in SSH format, defined by |
| 472 * <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a> |
| 473 * section 6.6. |
| 474 */ |
| 475 core.String key; |
| 476 |
| 477 SshPublicKey(); |
| 478 |
| 479 SshPublicKey.fromJson(core.Map _json) { |
| 480 if (_json.containsKey("expirationTimeUsec")) { |
| 481 expirationTimeUsec = _json["expirationTimeUsec"]; |
| 482 } |
| 483 if (_json.containsKey("fingerprint")) { |
| 484 fingerprint = _json["fingerprint"]; |
| 485 } |
| 486 if (_json.containsKey("key")) { |
| 487 key = _json["key"]; |
| 488 } |
| 489 } |
| 490 |
| 491 core.Map<core.String, core.Object> toJson() { |
| 492 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); |
| 493 if (expirationTimeUsec != null) { |
| 494 _json["expirationTimeUsec"] = expirationTimeUsec; |
| 495 } |
| 496 if (fingerprint != null) { |
| 497 _json["fingerprint"] = fingerprint; |
| 498 } |
| 499 if (key != null) { |
| 500 _json["key"] = key; |
| 501 } |
| 502 return _json; |
| 503 } |
| 504 } |
OLD | NEW |