diff --git a/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto new file mode 100644 index 00000000000..75d7c060518 --- /dev/null +++ b/packages/google-cloud-oslogin/protos/google/cloud/oslogin/v1/oslogin.proto @@ -0,0 +1,211 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.oslogin.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/oslogin/common/common.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.OsLogin.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin"; +option java_multiple_files = true; +option java_outer_classname = "OsLoginProto"; +option java_package = "com.google.cloud.oslogin.v1"; +option php_namespace = "Google\\Cloud\\OsLogin\\V1"; + +// Cloud OS Login API +// +// The Cloud OS Login API allows you to manage users and their associated SSH +// public keys for logging into virtual machines on Google Cloud Platform. +service OsLoginService { + option (google.api.default_host) = "oslogin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/compute"; + + // Deletes a POSIX account. + rpc DeletePosixAccount(DeletePosixAccountRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=users/*/projects/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes an SSH public key. + rpc DeleteSshPublicKey(DeleteSshPublicKeyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves the profile information used for logging in to a virtual machine + // on Google Compute Engine. + rpc GetLoginProfile(GetLoginProfileRequest) returns (LoginProfile) { + option (google.api.http) = { + get: "/v1/{name=users/*}/loginProfile" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves an SSH public key. + rpc GetSshPublicKey(GetSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + get: "/v1/{name=users/*/sshPublicKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds an SSH public key and returns the profile information. Default POSIX + // account information is set when no username and UID exist as part of the + // login profile. + rpc ImportSshPublicKey(ImportSshPublicKeyRequest) returns (ImportSshPublicKeyResponse) { + option (google.api.http) = { + post: "/v1/{parent=users/*}:importSshPublicKey" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "parent,ssh_public_key"; + option (google.api.method_signature) = "parent,ssh_public_key,project_id"; + } + + // Updates an SSH public key and returns the profile information. This method + // supports patch semantics. + rpc UpdateSshPublicKey(UpdateSshPublicKeyRequest) returns (google.cloud.oslogin.common.SshPublicKey) { + option (google.api.http) = { + patch: "/v1/{name=users/*/sshPublicKeys/*}" + body: "ssh_public_key" + }; + option (google.api.method_signature) = "name,ssh_public_key"; + option (google.api.method_signature) = "name,ssh_public_key,update_mask"; + } +} + +// The user profile information used for logging in to a virtual machine on +// Google Compute Engine. +message LoginProfile { + // Required. A unique user ID. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of POSIX accounts associated with the user. + repeated google.cloud.oslogin.common.PosixAccount posix_accounts = 2; + + // A map from SSH public key fingerprint to the associated key object. + map ssh_public_keys = 3; +} + +// A request message for deleting a POSIX account entry. +message DeletePosixAccountRequest { + // Required. A reference to the POSIX account to update. POSIX accounts are identified + // by the project ID they are associated with. A reference to the POSIX + // account is in format `users/{user}/projects/{project}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/PosixAccount" + } + ]; +} + +// A request message for deleting an SSH public key. +message DeleteSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for retrieving the login profile information for a user. +message GetLoginProfileRequest { + // Required. The unique ID for the user in format `users/{user}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/PosixAccount" + } + ]; + + // The project ID of the Google Cloud Platform project. + string project_id = 2; + + // A system ID for filtering the results of the request. + string system_id = 3; +} + +// A request message for retrieving an SSH public key. +message GetSshPublicKeyRequest { + // Required. The fingerprint of the public key to retrieve. Public keys are identified + // by their SHA-256 fingerprint. The fingerprint of the public key is in + // format `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; +} + +// A request message for importing an SSH public key. +message ImportSshPublicKeyRequest { + // Required. The unique ID for the user in format `users/{user}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Optional. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The project ID of the Google Cloud Platform project. + string project_id = 3; +} + +// A response message for importing an SSH public key. +message ImportSshPublicKeyResponse { + // The login profile information for the user. + LoginProfile login_profile = 1; +} + +// A request message for updating an SSH public key. +message UpdateSshPublicKeyRequest { + // Required. The fingerprint of the public key to update. Public keys are identified by + // their SHA-256 fingerprint. The fingerprint of the public key is in format + // `users/{user}/sshPublicKeys/{fingerprint}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "oslogin.googleapis.com/SshPublicKey" + } + ]; + + // Required. The SSH public key and expiration time. + google.cloud.oslogin.common.SshPublicKey ssh_public_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Mask to control which fields get updated. Updates all if not present. + google.protobuf.FieldMask update_mask = 3; +} diff --git a/packages/google-cloud-oslogin/protos/protos.d.ts b/packages/google-cloud-oslogin/protos/protos.d.ts index e08d6f71656..b6169b7ac3e 100644 --- a/packages/google-cloud-oslogin/protos/protos.d.ts +++ b/packages/google-cloud-oslogin/protos/protos.d.ts @@ -43,10 +43,10 @@ export namespace google { username?: (string|null); /** PosixAccount uid */ - uid?: (number|Long|string|null); + uid?: (number|Long|null); /** PosixAccount gid */ - gid?: (number|Long|string|null); + gid?: (number|Long|null); /** PosixAccount homeDirectory */ homeDirectory?: (string|null); @@ -64,7 +64,7 @@ export namespace google { accountId?: (string|null); /** PosixAccount operatingSystemType */ - operatingSystemType?: (google.cloud.oslogin.common.OperatingSystemType|keyof typeof google.cloud.oslogin.common.OperatingSystemType|null); + operatingSystemType?: (google.cloud.oslogin.common.OperatingSystemType|null); /** PosixAccount name */ name?: (string|null); @@ -86,10 +86,10 @@ export namespace google { public username: string; /** PosixAccount uid. */ - public uid: (number|Long|string); + public uid: (number|Long); /** PosixAccount gid. */ - public gid: (number|Long|string); + public gid: (number|Long); /** PosixAccount homeDirectory. */ public homeDirectory: string; @@ -107,7 +107,7 @@ export namespace google { public accountId: string; /** PosixAccount operatingSystemType. */ - public operatingSystemType: (google.cloud.oslogin.common.OperatingSystemType|keyof typeof google.cloud.oslogin.common.OperatingSystemType); + public operatingSystemType: google.cloud.oslogin.common.OperatingSystemType; /** PosixAccount name. */ public name: string; @@ -190,7 +190,7 @@ export namespace google { key?: (string|null); /** SshPublicKey expirationTimeUsec */ - expirationTimeUsec?: (number|Long|string|null); + expirationTimeUsec?: (number|Long|null); /** SshPublicKey fingerprint */ fingerprint?: (string|null); @@ -212,7 +212,7 @@ export namespace google { public key: string; /** SshPublicKey expirationTimeUsec. */ - public expirationTimeUsec: (number|Long|string); + public expirationTimeUsec: (number|Long); /** SshPublicKey fingerprint. */ public fingerprint: string; @@ -292,6 +292,928 @@ export namespace google { } } + /** Namespace v1. */ + namespace v1 { + + /** Represents an OsLoginService */ + class OsLoginService extends $protobuf.rpc.Service { + + /** + * Constructs a new OsLoginService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new OsLoginService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): OsLoginService; + + /** + * Calls DeletePosixAccount. + * @param request DeletePosixAccountRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deletePosixAccount(request: google.cloud.oslogin.v1.IDeletePosixAccountRequest, callback: google.cloud.oslogin.v1.OsLoginService.DeletePosixAccountCallback): void; + + /** + * Calls DeletePosixAccount. + * @param request DeletePosixAccountRequest message or plain object + * @returns Promise + */ + public deletePosixAccount(request: google.cloud.oslogin.v1.IDeletePosixAccountRequest): Promise; + + /** + * Calls DeleteSshPublicKey. + * @param request DeleteSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteSshPublicKey(request: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, callback: google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKeyCallback): void; + + /** + * Calls DeleteSshPublicKey. + * @param request DeleteSshPublicKeyRequest message or plain object + * @returns Promise + */ + public deleteSshPublicKey(request: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest): Promise; + + /** + * Calls GetLoginProfile. + * @param request GetLoginProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and LoginProfile + */ + public getLoginProfile(request: google.cloud.oslogin.v1.IGetLoginProfileRequest, callback: google.cloud.oslogin.v1.OsLoginService.GetLoginProfileCallback): void; + + /** + * Calls GetLoginProfile. + * @param request GetLoginProfileRequest message or plain object + * @returns Promise + */ + public getLoginProfile(request: google.cloud.oslogin.v1.IGetLoginProfileRequest): Promise; + + /** + * Calls GetSshPublicKey. + * @param request GetSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SshPublicKey + */ + public getSshPublicKey(request: google.cloud.oslogin.v1.IGetSshPublicKeyRequest, callback: google.cloud.oslogin.v1.OsLoginService.GetSshPublicKeyCallback): void; + + /** + * Calls GetSshPublicKey. + * @param request GetSshPublicKeyRequest message or plain object + * @returns Promise + */ + public getSshPublicKey(request: google.cloud.oslogin.v1.IGetSshPublicKeyRequest): Promise; + + /** + * Calls ImportSshPublicKey. + * @param request ImportSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ImportSshPublicKeyResponse + */ + public importSshPublicKey(request: google.cloud.oslogin.v1.IImportSshPublicKeyRequest, callback: google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKeyCallback): void; + + /** + * Calls ImportSshPublicKey. + * @param request ImportSshPublicKeyRequest message or plain object + * @returns Promise + */ + public importSshPublicKey(request: google.cloud.oslogin.v1.IImportSshPublicKeyRequest): Promise; + + /** + * Calls UpdateSshPublicKey. + * @param request UpdateSshPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SshPublicKey + */ + public updateSshPublicKey(request: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, callback: google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKeyCallback): void; + + /** + * Calls UpdateSshPublicKey. + * @param request UpdateSshPublicKeyRequest message or plain object + * @returns Promise + */ + public updateSshPublicKey(request: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest): Promise; + } + + namespace OsLoginService { + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#deletePosixAccount}. + * @param error Error, if any + * @param [response] Empty + */ + type DeletePosixAccountCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#deleteSshPublicKey}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteSshPublicKeyCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#getLoginProfile}. + * @param error Error, if any + * @param [response] LoginProfile + */ + type GetLoginProfileCallback = (error: (Error|null), response?: google.cloud.oslogin.v1.LoginProfile) => void; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#getSshPublicKey}. + * @param error Error, if any + * @param [response] SshPublicKey + */ + type GetSshPublicKeyCallback = (error: (Error|null), response?: google.cloud.oslogin.common.SshPublicKey) => void; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#importSshPublicKey}. + * @param error Error, if any + * @param [response] ImportSshPublicKeyResponse + */ + type ImportSshPublicKeyCallback = (error: (Error|null), response?: google.cloud.oslogin.v1.ImportSshPublicKeyResponse) => void; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#updateSshPublicKey}. + * @param error Error, if any + * @param [response] SshPublicKey + */ + type UpdateSshPublicKeyCallback = (error: (Error|null), response?: google.cloud.oslogin.common.SshPublicKey) => void; + } + + /** Properties of a LoginProfile. */ + interface ILoginProfile { + + /** LoginProfile name */ + name?: (string|null); + + /** LoginProfile posixAccounts */ + posixAccounts?: (google.cloud.oslogin.common.IPosixAccount[]|null); + + /** LoginProfile sshPublicKeys */ + sshPublicKeys?: ({ [k: string]: google.cloud.oslogin.common.ISshPublicKey }|null); + } + + /** Represents a LoginProfile. */ + class LoginProfile implements ILoginProfile { + + /** + * Constructs a new LoginProfile. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.ILoginProfile); + + /** LoginProfile name. */ + public name: string; + + /** LoginProfile posixAccounts. */ + public posixAccounts: google.cloud.oslogin.common.IPosixAccount[]; + + /** LoginProfile sshPublicKeys. */ + public sshPublicKeys: { [k: string]: google.cloud.oslogin.common.ISshPublicKey }; + + /** + * Creates a new LoginProfile instance using the specified properties. + * @param [properties] Properties to set + * @returns LoginProfile instance + */ + public static create(properties?: google.cloud.oslogin.v1.ILoginProfile): google.cloud.oslogin.v1.LoginProfile; + + /** + * Encodes the specified LoginProfile message. Does not implicitly {@link google.cloud.oslogin.v1.LoginProfile.verify|verify} messages. + * @param message LoginProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.ILoginProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LoginProfile message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.LoginProfile.verify|verify} messages. + * @param message LoginProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.ILoginProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LoginProfile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LoginProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.LoginProfile; + + /** + * Decodes a LoginProfile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LoginProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.LoginProfile; + + /** + * Verifies a LoginProfile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LoginProfile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LoginProfile + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.LoginProfile; + + /** + * Creates a plain object from a LoginProfile message. Also converts values to other types if specified. + * @param message LoginProfile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.LoginProfile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LoginProfile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeletePosixAccountRequest. */ + interface IDeletePosixAccountRequest { + + /** DeletePosixAccountRequest name */ + name?: (string|null); + } + + /** Represents a DeletePosixAccountRequest. */ + class DeletePosixAccountRequest implements IDeletePosixAccountRequest { + + /** + * Constructs a new DeletePosixAccountRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IDeletePosixAccountRequest); + + /** DeletePosixAccountRequest name. */ + public name: string; + + /** + * Creates a new DeletePosixAccountRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeletePosixAccountRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IDeletePosixAccountRequest): google.cloud.oslogin.v1.DeletePosixAccountRequest; + + /** + * Encodes the specified DeletePosixAccountRequest message. Does not implicitly {@link google.cloud.oslogin.v1.DeletePosixAccountRequest.verify|verify} messages. + * @param message DeletePosixAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IDeletePosixAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeletePosixAccountRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.DeletePosixAccountRequest.verify|verify} messages. + * @param message DeletePosixAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IDeletePosixAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeletePosixAccountRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeletePosixAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.DeletePosixAccountRequest; + + /** + * Decodes a DeletePosixAccountRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeletePosixAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.DeletePosixAccountRequest; + + /** + * Verifies a DeletePosixAccountRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeletePosixAccountRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeletePosixAccountRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.DeletePosixAccountRequest; + + /** + * Creates a plain object from a DeletePosixAccountRequest message. Also converts values to other types if specified. + * @param message DeletePosixAccountRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.DeletePosixAccountRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeletePosixAccountRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteSshPublicKeyRequest. */ + interface IDeleteSshPublicKeyRequest { + + /** DeleteSshPublicKeyRequest name */ + name?: (string|null); + } + + /** Represents a DeleteSshPublicKeyRequest. */ + class DeleteSshPublicKeyRequest implements IDeleteSshPublicKeyRequest { + + /** + * Constructs a new DeleteSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest); + + /** DeleteSshPublicKeyRequest name. */ + public name: string; + + /** + * Creates a new DeleteSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest): google.cloud.oslogin.v1.DeleteSshPublicKeyRequest; + + /** + * Encodes the specified DeleteSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.DeleteSshPublicKeyRequest.verify|verify} messages. + * @param message DeleteSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.DeleteSshPublicKeyRequest.verify|verify} messages. + * @param message DeleteSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.DeleteSshPublicKeyRequest; + + /** + * Decodes a DeleteSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.DeleteSshPublicKeyRequest; + + /** + * Verifies a DeleteSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.DeleteSshPublicKeyRequest; + + /** + * Creates a plain object from a DeleteSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message DeleteSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.DeleteSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetLoginProfileRequest. */ + interface IGetLoginProfileRequest { + + /** GetLoginProfileRequest name */ + name?: (string|null); + + /** GetLoginProfileRequest projectId */ + projectId?: (string|null); + + /** GetLoginProfileRequest systemId */ + systemId?: (string|null); + } + + /** Represents a GetLoginProfileRequest. */ + class GetLoginProfileRequest implements IGetLoginProfileRequest { + + /** + * Constructs a new GetLoginProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IGetLoginProfileRequest); + + /** GetLoginProfileRequest name. */ + public name: string; + + /** GetLoginProfileRequest projectId. */ + public projectId: string; + + /** GetLoginProfileRequest systemId. */ + public systemId: string; + + /** + * Creates a new GetLoginProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetLoginProfileRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IGetLoginProfileRequest): google.cloud.oslogin.v1.GetLoginProfileRequest; + + /** + * Encodes the specified GetLoginProfileRequest message. Does not implicitly {@link google.cloud.oslogin.v1.GetLoginProfileRequest.verify|verify} messages. + * @param message GetLoginProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IGetLoginProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetLoginProfileRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.GetLoginProfileRequest.verify|verify} messages. + * @param message GetLoginProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IGetLoginProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetLoginProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetLoginProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.GetLoginProfileRequest; + + /** + * Decodes a GetLoginProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetLoginProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.GetLoginProfileRequest; + + /** + * Verifies a GetLoginProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetLoginProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetLoginProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.GetLoginProfileRequest; + + /** + * Creates a plain object from a GetLoginProfileRequest message. Also converts values to other types if specified. + * @param message GetLoginProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.GetLoginProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetLoginProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetSshPublicKeyRequest. */ + interface IGetSshPublicKeyRequest { + + /** GetSshPublicKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetSshPublicKeyRequest. */ + class GetSshPublicKeyRequest implements IGetSshPublicKeyRequest { + + /** + * Constructs a new GetSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IGetSshPublicKeyRequest); + + /** GetSshPublicKeyRequest name. */ + public name: string; + + /** + * Creates a new GetSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IGetSshPublicKeyRequest): google.cloud.oslogin.v1.GetSshPublicKeyRequest; + + /** + * Encodes the specified GetSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.GetSshPublicKeyRequest.verify|verify} messages. + * @param message GetSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IGetSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.GetSshPublicKeyRequest.verify|verify} messages. + * @param message GetSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IGetSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.GetSshPublicKeyRequest; + + /** + * Decodes a GetSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.GetSshPublicKeyRequest; + + /** + * Verifies a GetSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.GetSshPublicKeyRequest; + + /** + * Creates a plain object from a GetSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message GetSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.GetSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportSshPublicKeyRequest. */ + interface IImportSshPublicKeyRequest { + + /** ImportSshPublicKeyRequest parent */ + parent?: (string|null); + + /** ImportSshPublicKeyRequest sshPublicKey */ + sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** ImportSshPublicKeyRequest projectId */ + projectId?: (string|null); + } + + /** Represents an ImportSshPublicKeyRequest. */ + class ImportSshPublicKeyRequest implements IImportSshPublicKeyRequest { + + /** + * Constructs a new ImportSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IImportSshPublicKeyRequest); + + /** ImportSshPublicKeyRequest parent. */ + public parent: string; + + /** ImportSshPublicKeyRequest sshPublicKey. */ + public sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** ImportSshPublicKeyRequest projectId. */ + public projectId: string; + + /** + * Creates a new ImportSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IImportSshPublicKeyRequest): google.cloud.oslogin.v1.ImportSshPublicKeyRequest; + + /** + * Encodes the specified ImportSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyRequest.verify|verify} messages. + * @param message ImportSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IImportSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyRequest.verify|verify} messages. + * @param message ImportSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IImportSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.ImportSshPublicKeyRequest; + + /** + * Decodes an ImportSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.ImportSshPublicKeyRequest; + + /** + * Verifies an ImportSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.ImportSshPublicKeyRequest; + + /** + * Creates a plain object from an ImportSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message ImportSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.ImportSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ImportSshPublicKeyResponse. */ + interface IImportSshPublicKeyResponse { + + /** ImportSshPublicKeyResponse loginProfile */ + loginProfile?: (google.cloud.oslogin.v1.ILoginProfile|null); + } + + /** Represents an ImportSshPublicKeyResponse. */ + class ImportSshPublicKeyResponse implements IImportSshPublicKeyResponse { + + /** + * Constructs a new ImportSshPublicKeyResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IImportSshPublicKeyResponse); + + /** ImportSshPublicKeyResponse loginProfile. */ + public loginProfile?: (google.cloud.oslogin.v1.ILoginProfile|null); + + /** + * Creates a new ImportSshPublicKeyResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportSshPublicKeyResponse instance + */ + public static create(properties?: google.cloud.oslogin.v1.IImportSshPublicKeyResponse): google.cloud.oslogin.v1.ImportSshPublicKeyResponse; + + /** + * Encodes the specified ImportSshPublicKeyResponse message. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse.verify|verify} messages. + * @param message ImportSshPublicKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IImportSshPublicKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportSshPublicKeyResponse message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse.verify|verify} messages. + * @param message ImportSshPublicKeyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IImportSshPublicKeyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportSshPublicKeyResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportSshPublicKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.ImportSshPublicKeyResponse; + + /** + * Decodes an ImportSshPublicKeyResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportSshPublicKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.ImportSshPublicKeyResponse; + + /** + * Verifies an ImportSshPublicKeyResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportSshPublicKeyResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportSshPublicKeyResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.ImportSshPublicKeyResponse; + + /** + * Creates a plain object from an ImportSshPublicKeyResponse message. Also converts values to other types if specified. + * @param message ImportSshPublicKeyResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.ImportSshPublicKeyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportSshPublicKeyResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateSshPublicKeyRequest. */ + interface IUpdateSshPublicKeyRequest { + + /** UpdateSshPublicKeyRequest name */ + name?: (string|null); + + /** UpdateSshPublicKeyRequest sshPublicKey */ + sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** UpdateSshPublicKeyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSshPublicKeyRequest. */ + class UpdateSshPublicKeyRequest implements IUpdateSshPublicKeyRequest { + + /** + * Constructs a new UpdateSshPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest); + + /** UpdateSshPublicKeyRequest name. */ + public name: string; + + /** UpdateSshPublicKeyRequest sshPublicKey. */ + public sshPublicKey?: (google.cloud.oslogin.common.ISshPublicKey|null); + + /** UpdateSshPublicKeyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSshPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSshPublicKeyRequest instance + */ + public static create(properties?: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest): google.cloud.oslogin.v1.UpdateSshPublicKeyRequest; + + /** + * Encodes the specified UpdateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.verify|verify} messages. + * @param message UpdateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.verify|verify} messages. + * @param message UpdateSshPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSshPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.oslogin.v1.UpdateSshPublicKeyRequest; + + /** + * Decodes an UpdateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.oslogin.v1.UpdateSshPublicKeyRequest; + + /** + * Verifies an UpdateSshPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSshPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.oslogin.v1.UpdateSshPublicKeyRequest; + + /** + * Creates a plain object from an UpdateSshPublicKeyRequest message. Also converts values to other types if specified. + * @param message UpdateSshPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.oslogin.v1.UpdateSshPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSshPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Namespace v1beta. */ namespace v1beta { @@ -1242,7 +2164,7 @@ export namespace google { nameField?: (string|null); /** ResourceDescriptor history */ - history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + history?: (google.api.ResourceDescriptor.History|null); /** ResourceDescriptor plural */ plural?: (string|null); @@ -1270,7 +2192,7 @@ export namespace google { public nameField: string; /** ResourceDescriptor history. */ - public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + public history: google.api.ResourceDescriptor.History; /** ResourceDescriptor plural. */ public plural: string; @@ -2489,10 +3411,10 @@ export namespace google { number?: (number|null); /** FieldDescriptorProto label */ - label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + label?: (google.protobuf.FieldDescriptorProto.Label|null); /** FieldDescriptorProto type */ - type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + type?: (google.protobuf.FieldDescriptorProto.Type|null); /** FieldDescriptorProto typeName */ typeName?: (string|null); @@ -2529,10 +3451,10 @@ export namespace google { public number: number; /** FieldDescriptorProto label. */ - public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + public label: google.protobuf.FieldDescriptorProto.Label; /** FieldDescriptorProto type. */ - public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + public type: google.protobuf.FieldDescriptorProto.Type; /** FieldDescriptorProto typeName. */ public typeName: string; @@ -3307,7 +4229,7 @@ export namespace google { javaStringCheckUtf8?: (boolean|null); /** FileOptions optimizeFor */ - optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|null); /** FileOptions goPackage */ goPackage?: (string|null); @@ -3383,7 +4305,7 @@ export namespace google { public javaStringCheckUtf8: boolean; /** FileOptions optimizeFor. */ - public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + public optimizeFor: google.protobuf.FileOptions.OptimizeMode; /** FileOptions goPackage. */ public goPackage: string; @@ -3632,13 +4554,13 @@ export namespace google { interface IFieldOptions { /** FieldOptions ctype */ - ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + ctype?: (google.protobuf.FieldOptions.CType|null); /** FieldOptions packed */ packed?: (boolean|null); /** FieldOptions jstype */ - jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + jstype?: (google.protobuf.FieldOptions.JSType|null); /** FieldOptions lazy */ lazy?: (boolean|null); @@ -3669,13 +4591,13 @@ export namespace google { constructor(properties?: google.protobuf.IFieldOptions); /** FieldOptions ctype. */ - public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + public ctype: google.protobuf.FieldOptions.CType; /** FieldOptions packed. */ public packed: boolean; /** FieldOptions jstype. */ - public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + public jstype: google.protobuf.FieldOptions.JSType; /** FieldOptions lazy. */ public lazy: boolean; @@ -4174,7 +5096,7 @@ export namespace google { deprecated?: (boolean|null); /** MethodOptions idempotencyLevel */ - idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|null); /** MethodOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -4199,7 +5121,7 @@ export namespace google { public deprecated: boolean; /** MethodOptions idempotencyLevel. */ - public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + public idempotencyLevel: google.protobuf.MethodOptions.IdempotencyLevel; /** MethodOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -4295,16 +5217,16 @@ export namespace google { identifierValue?: (string|null); /** UninterpretedOption positiveIntValue */ - positiveIntValue?: (number|Long|string|null); + positiveIntValue?: (number|Long|null); /** UninterpretedOption negativeIntValue */ - negativeIntValue?: (number|Long|string|null); + negativeIntValue?: (number|Long|null); /** UninterpretedOption doubleValue */ doubleValue?: (number|null); /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|string|null); + stringValue?: (Uint8Array|null); /** UninterpretedOption aggregateValue */ aggregateValue?: (string|null); @@ -4326,16 +5248,16 @@ export namespace google { public identifierValue: string; /** UninterpretedOption positiveIntValue. */ - public positiveIntValue: (number|Long|string); + public positiveIntValue: (number|Long); /** UninterpretedOption negativeIntValue. */ - public negativeIntValue: (number|Long|string); + public negativeIntValue: (number|Long); /** UninterpretedOption doubleValue. */ public doubleValue: number; /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|string); + public stringValue: Uint8Array; /** UninterpretedOption aggregateValue. */ public aggregateValue: string; diff --git a/packages/google-cloud-oslogin/protos/protos.js b/packages/google-cloud-oslogin/protos/protos.js index 219f71ffc02..349dde91b4f 100644 --- a/packages/google-cloud-oslogin/protos/protos.js +++ b/packages/google-cloud-oslogin/protos/protos.js @@ -807,6 +807,1997 @@ return common; })(); + oslogin.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.oslogin + * @namespace + */ + var v1 = {}; + + v1.OsLoginService = (function() { + + /** + * Constructs a new OsLoginService service. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents an OsLoginService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function OsLoginService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (OsLoginService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = OsLoginService; + + /** + * Creates new OsLoginService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.oslogin.v1.OsLoginService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {OsLoginService} RPC service. Useful where requests and/or responses are streamed. + */ + OsLoginService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#deletePosixAccount}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef DeletePosixAccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeletePosixAccount. + * @function deletePosixAccount + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest} request DeletePosixAccountRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.DeletePosixAccountCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.deletePosixAccount = function deletePosixAccount(request, callback) { + return this.rpcCall(deletePosixAccount, $root.google.cloud.oslogin.v1.DeletePosixAccountRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeletePosixAccount" }); + + /** + * Calls DeletePosixAccount. + * @function deletePosixAccount + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest} request DeletePosixAccountRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#deleteSshPublicKey}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef DeleteSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSshPublicKey. + * @function deleteSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest} request DeleteSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.DeleteSshPublicKeyCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.deleteSshPublicKey = function deleteSshPublicKey(request, callback) { + return this.rpcCall(deleteSshPublicKey, $root.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSshPublicKey" }); + + /** + * Calls DeleteSshPublicKey. + * @function deleteSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest} request DeleteSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#getLoginProfile}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef GetLoginProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.v1.LoginProfile} [response] LoginProfile + */ + + /** + * Calls GetLoginProfile. + * @function getLoginProfile + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest} request GetLoginProfileRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.GetLoginProfileCallback} callback Node-style callback called with the error, if any, and LoginProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.getLoginProfile = function getLoginProfile(request, callback) { + return this.rpcCall(getLoginProfile, $root.google.cloud.oslogin.v1.GetLoginProfileRequest, $root.google.cloud.oslogin.v1.LoginProfile, request, callback); + }, "name", { value: "GetLoginProfile" }); + + /** + * Calls GetLoginProfile. + * @function getLoginProfile + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest} request GetLoginProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#getSshPublicKey}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef GetSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.common.SshPublicKey} [response] SshPublicKey + */ + + /** + * Calls GetSshPublicKey. + * @function getSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest} request GetSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.GetSshPublicKeyCallback} callback Node-style callback called with the error, if any, and SshPublicKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.getSshPublicKey = function getSshPublicKey(request, callback) { + return this.rpcCall(getSshPublicKey, $root.google.cloud.oslogin.v1.GetSshPublicKeyRequest, $root.google.cloud.oslogin.common.SshPublicKey, request, callback); + }, "name", { value: "GetSshPublicKey" }); + + /** + * Calls GetSshPublicKey. + * @function getSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest} request GetSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#importSshPublicKey}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef ImportSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} [response] ImportSshPublicKeyResponse + */ + + /** + * Calls ImportSshPublicKey. + * @function importSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest} request ImportSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.ImportSshPublicKeyCallback} callback Node-style callback called with the error, if any, and ImportSshPublicKeyResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.importSshPublicKey = function importSshPublicKey(request, callback) { + return this.rpcCall(importSshPublicKey, $root.google.cloud.oslogin.v1.ImportSshPublicKeyRequest, $root.google.cloud.oslogin.v1.ImportSshPublicKeyResponse, request, callback); + }, "name", { value: "ImportSshPublicKey" }); + + /** + * Calls ImportSshPublicKey. + * @function importSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest} request ImportSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.oslogin.v1.OsLoginService#updateSshPublicKey}. + * @memberof google.cloud.oslogin.v1.OsLoginService + * @typedef UpdateSshPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.oslogin.common.SshPublicKey} [response] SshPublicKey + */ + + /** + * Calls UpdateSshPublicKey. + * @function updateSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest} request UpdateSshPublicKeyRequest message or plain object + * @param {google.cloud.oslogin.v1.OsLoginService.UpdateSshPublicKeyCallback} callback Node-style callback called with the error, if any, and SshPublicKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(OsLoginService.prototype.updateSshPublicKey = function updateSshPublicKey(request, callback) { + return this.rpcCall(updateSshPublicKey, $root.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest, $root.google.cloud.oslogin.common.SshPublicKey, request, callback); + }, "name", { value: "UpdateSshPublicKey" }); + + /** + * Calls UpdateSshPublicKey. + * @function updateSshPublicKey + * @memberof google.cloud.oslogin.v1.OsLoginService + * @instance + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest} request UpdateSshPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return OsLoginService; + })(); + + v1.LoginProfile = (function() { + + /** + * Properties of a LoginProfile. + * @memberof google.cloud.oslogin.v1 + * @interface ILoginProfile + * @property {string|null} [name] LoginProfile name + * @property {Array.|null} [posixAccounts] LoginProfile posixAccounts + * @property {Object.|null} [sshPublicKeys] LoginProfile sshPublicKeys + */ + + /** + * Constructs a new LoginProfile. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a LoginProfile. + * @implements ILoginProfile + * @constructor + * @param {google.cloud.oslogin.v1.ILoginProfile=} [properties] Properties to set + */ + function LoginProfile(properties) { + this.posixAccounts = []; + this.sshPublicKeys = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LoginProfile name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.LoginProfile + * @instance + */ + LoginProfile.prototype.name = ""; + + /** + * LoginProfile posixAccounts. + * @member {Array.} posixAccounts + * @memberof google.cloud.oslogin.v1.LoginProfile + * @instance + */ + LoginProfile.prototype.posixAccounts = $util.emptyArray; + + /** + * LoginProfile sshPublicKeys. + * @member {Object.} sshPublicKeys + * @memberof google.cloud.oslogin.v1.LoginProfile + * @instance + */ + LoginProfile.prototype.sshPublicKeys = $util.emptyObject; + + /** + * Creates a new LoginProfile instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {google.cloud.oslogin.v1.ILoginProfile=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.LoginProfile} LoginProfile instance + */ + LoginProfile.create = function create(properties) { + return new LoginProfile(properties); + }; + + /** + * Encodes the specified LoginProfile message. Does not implicitly {@link google.cloud.oslogin.v1.LoginProfile.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {google.cloud.oslogin.v1.ILoginProfile} message LoginProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoginProfile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.posixAccounts != null && message.posixAccounts.length) + for (var i = 0; i < message.posixAccounts.length; ++i) + $root.google.cloud.oslogin.common.PosixAccount.encode(message.posixAccounts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sshPublicKeys != null && message.hasOwnProperty("sshPublicKeys")) + for (var keys = Object.keys(message.sshPublicKeys), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKeys[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified LoginProfile message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.LoginProfile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {google.cloud.oslogin.v1.ILoginProfile} message LoginProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoginProfile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LoginProfile message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.LoginProfile} LoginProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoginProfile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.LoginProfile(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.posixAccounts && message.posixAccounts.length)) + message.posixAccounts = []; + message.posixAccounts.push($root.google.cloud.oslogin.common.PosixAccount.decode(reader, reader.uint32())); + break; + case 3: + reader.skip().pos++; + if (message.sshPublicKeys === $util.emptyObject) + message.sshPublicKeys = {}; + key = reader.string(); + reader.pos++; + message.sshPublicKeys[key] = $root.google.cloud.oslogin.common.SshPublicKey.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LoginProfile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.LoginProfile} LoginProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoginProfile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LoginProfile message. + * @function verify + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LoginProfile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.posixAccounts != null && message.hasOwnProperty("posixAccounts")) { + if (!Array.isArray(message.posixAccounts)) + return "posixAccounts: array expected"; + for (var i = 0; i < message.posixAccounts.length; ++i) { + var error = $root.google.cloud.oslogin.common.PosixAccount.verify(message.posixAccounts[i]); + if (error) + return "posixAccounts." + error; + } + } + if (message.sshPublicKeys != null && message.hasOwnProperty("sshPublicKeys")) { + if (!$util.isObject(message.sshPublicKeys)) + return "sshPublicKeys: object expected"; + var key = Object.keys(message.sshPublicKeys); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.oslogin.common.SshPublicKey.verify(message.sshPublicKeys[key[i]]); + if (error) + return "sshPublicKeys." + error; + } + } + return null; + }; + + /** + * Creates a LoginProfile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.LoginProfile} LoginProfile + */ + LoginProfile.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.LoginProfile) + return object; + var message = new $root.google.cloud.oslogin.v1.LoginProfile(); + if (object.name != null) + message.name = String(object.name); + if (object.posixAccounts) { + if (!Array.isArray(object.posixAccounts)) + throw TypeError(".google.cloud.oslogin.v1.LoginProfile.posixAccounts: array expected"); + message.posixAccounts = []; + for (var i = 0; i < object.posixAccounts.length; ++i) { + if (typeof object.posixAccounts[i] !== "object") + throw TypeError(".google.cloud.oslogin.v1.LoginProfile.posixAccounts: object expected"); + message.posixAccounts[i] = $root.google.cloud.oslogin.common.PosixAccount.fromObject(object.posixAccounts[i]); + } + } + if (object.sshPublicKeys) { + if (typeof object.sshPublicKeys !== "object") + throw TypeError(".google.cloud.oslogin.v1.LoginProfile.sshPublicKeys: object expected"); + message.sshPublicKeys = {}; + for (var keys = Object.keys(object.sshPublicKeys), i = 0; i < keys.length; ++i) { + if (typeof object.sshPublicKeys[keys[i]] !== "object") + throw TypeError(".google.cloud.oslogin.v1.LoginProfile.sshPublicKeys: object expected"); + message.sshPublicKeys[keys[i]] = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKeys[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a LoginProfile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.LoginProfile + * @static + * @param {google.cloud.oslogin.v1.LoginProfile} message LoginProfile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LoginProfile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.posixAccounts = []; + if (options.objects || options.defaults) + object.sshPublicKeys = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.posixAccounts && message.posixAccounts.length) { + object.posixAccounts = []; + for (var j = 0; j < message.posixAccounts.length; ++j) + object.posixAccounts[j] = $root.google.cloud.oslogin.common.PosixAccount.toObject(message.posixAccounts[j], options); + } + var keys2; + if (message.sshPublicKeys && (keys2 = Object.keys(message.sshPublicKeys)).length) { + object.sshPublicKeys = {}; + for (var j = 0; j < keys2.length; ++j) + object.sshPublicKeys[keys2[j]] = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKeys[keys2[j]], options); + } + return object; + }; + + /** + * Converts this LoginProfile to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.LoginProfile + * @instance + * @returns {Object.} JSON object + */ + LoginProfile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LoginProfile; + })(); + + v1.DeletePosixAccountRequest = (function() { + + /** + * Properties of a DeletePosixAccountRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IDeletePosixAccountRequest + * @property {string|null} [name] DeletePosixAccountRequest name + */ + + /** + * Constructs a new DeletePosixAccountRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a DeletePosixAccountRequest. + * @implements IDeletePosixAccountRequest + * @constructor + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest=} [properties] Properties to set + */ + function DeletePosixAccountRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeletePosixAccountRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @instance + */ + DeletePosixAccountRequest.prototype.name = ""; + + /** + * Creates a new DeletePosixAccountRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.DeletePosixAccountRequest} DeletePosixAccountRequest instance + */ + DeletePosixAccountRequest.create = function create(properties) { + return new DeletePosixAccountRequest(properties); + }; + + /** + * Encodes the specified DeletePosixAccountRequest message. Does not implicitly {@link google.cloud.oslogin.v1.DeletePosixAccountRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest} message DeletePosixAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePosixAccountRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeletePosixAccountRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.DeletePosixAccountRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {google.cloud.oslogin.v1.IDeletePosixAccountRequest} message DeletePosixAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePosixAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeletePosixAccountRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.DeletePosixAccountRequest} DeletePosixAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePosixAccountRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.DeletePosixAccountRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeletePosixAccountRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.DeletePosixAccountRequest} DeletePosixAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePosixAccountRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeletePosixAccountRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeletePosixAccountRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeletePosixAccountRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.DeletePosixAccountRequest} DeletePosixAccountRequest + */ + DeletePosixAccountRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.DeletePosixAccountRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.DeletePosixAccountRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeletePosixAccountRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @static + * @param {google.cloud.oslogin.v1.DeletePosixAccountRequest} message DeletePosixAccountRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeletePosixAccountRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeletePosixAccountRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.DeletePosixAccountRequest + * @instance + * @returns {Object.} JSON object + */ + DeletePosixAccountRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeletePosixAccountRequest; + })(); + + v1.DeleteSshPublicKeyRequest = (function() { + + /** + * Properties of a DeleteSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IDeleteSshPublicKeyRequest + * @property {string|null} [name] DeleteSshPublicKeyRequest name + */ + + /** + * Constructs a new DeleteSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a DeleteSshPublicKeyRequest. + * @implements IDeleteSshPublicKeyRequest + * @constructor + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest=} [properties] Properties to set + */ + function DeleteSshPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSshPublicKeyRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @instance + */ + DeleteSshPublicKeyRequest.prototype.name = ""; + + /** + * Creates a new DeleteSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.DeleteSshPublicKeyRequest} DeleteSshPublicKeyRequest instance + */ + DeleteSshPublicKeyRequest.create = function create(properties) { + return new DeleteSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified DeleteSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.DeleteSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest} message DeleteSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.DeleteSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest} message DeleteSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.DeleteSshPublicKeyRequest} DeleteSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.DeleteSshPublicKeyRequest} DeleteSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.DeleteSshPublicKeyRequest} DeleteSshPublicKeyRequest + */ + DeleteSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.DeleteSshPublicKeyRequest} message DeleteSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.DeleteSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteSshPublicKeyRequest; + })(); + + v1.GetLoginProfileRequest = (function() { + + /** + * Properties of a GetLoginProfileRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IGetLoginProfileRequest + * @property {string|null} [name] GetLoginProfileRequest name + * @property {string|null} [projectId] GetLoginProfileRequest projectId + * @property {string|null} [systemId] GetLoginProfileRequest systemId + */ + + /** + * Constructs a new GetLoginProfileRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a GetLoginProfileRequest. + * @implements IGetLoginProfileRequest + * @constructor + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest=} [properties] Properties to set + */ + function GetLoginProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLoginProfileRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @instance + */ + GetLoginProfileRequest.prototype.name = ""; + + /** + * GetLoginProfileRequest projectId. + * @member {string} projectId + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @instance + */ + GetLoginProfileRequest.prototype.projectId = ""; + + /** + * GetLoginProfileRequest systemId. + * @member {string} systemId + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @instance + */ + GetLoginProfileRequest.prototype.systemId = ""; + + /** + * Creates a new GetLoginProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.GetLoginProfileRequest} GetLoginProfileRequest instance + */ + GetLoginProfileRequest.create = function create(properties) { + return new GetLoginProfileRequest(properties); + }; + + /** + * Encodes the specified GetLoginProfileRequest message. Does not implicitly {@link google.cloud.oslogin.v1.GetLoginProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest} message GetLoginProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLoginProfileRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.projectId != null && message.hasOwnProperty("projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.systemId != null && message.hasOwnProperty("systemId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.systemId); + return writer; + }; + + /** + * Encodes the specified GetLoginProfileRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.GetLoginProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {google.cloud.oslogin.v1.IGetLoginProfileRequest} message GetLoginProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLoginProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLoginProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.GetLoginProfileRequest} GetLoginProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLoginProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.GetLoginProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.systemId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLoginProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.GetLoginProfileRequest} GetLoginProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLoginProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLoginProfileRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLoginProfileRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.systemId != null && message.hasOwnProperty("systemId")) + if (!$util.isString(message.systemId)) + return "systemId: string expected"; + return null; + }; + + /** + * Creates a GetLoginProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.GetLoginProfileRequest} GetLoginProfileRequest + */ + GetLoginProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.GetLoginProfileRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.GetLoginProfileRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.systemId != null) + message.systemId = String(object.systemId); + return message; + }; + + /** + * Creates a plain object from a GetLoginProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @static + * @param {google.cloud.oslogin.v1.GetLoginProfileRequest} message GetLoginProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLoginProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.projectId = ""; + object.systemId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.systemId != null && message.hasOwnProperty("systemId")) + object.systemId = message.systemId; + return object; + }; + + /** + * Converts this GetLoginProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.GetLoginProfileRequest + * @instance + * @returns {Object.} JSON object + */ + GetLoginProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetLoginProfileRequest; + })(); + + v1.GetSshPublicKeyRequest = (function() { + + /** + * Properties of a GetSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IGetSshPublicKeyRequest + * @property {string|null} [name] GetSshPublicKeyRequest name + */ + + /** + * Constructs a new GetSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents a GetSshPublicKeyRequest. + * @implements IGetSshPublicKeyRequest + * @constructor + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest=} [properties] Properties to set + */ + function GetSshPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSshPublicKeyRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @instance + */ + GetSshPublicKeyRequest.prototype.name = ""; + + /** + * Creates a new GetSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.GetSshPublicKeyRequest} GetSshPublicKeyRequest instance + */ + GetSshPublicKeyRequest.create = function create(properties) { + return new GetSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified GetSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.GetSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest} message GetSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.GetSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IGetSshPublicKeyRequest} message GetSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.GetSshPublicKeyRequest} GetSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.GetSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.GetSshPublicKeyRequest} GetSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.GetSshPublicKeyRequest} GetSshPublicKeyRequest + */ + GetSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.GetSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.GetSshPublicKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.GetSshPublicKeyRequest} message GetSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.GetSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + GetSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSshPublicKeyRequest; + })(); + + v1.ImportSshPublicKeyRequest = (function() { + + /** + * Properties of an ImportSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IImportSshPublicKeyRequest + * @property {string|null} [parent] ImportSshPublicKeyRequest parent + * @property {google.cloud.oslogin.common.ISshPublicKey|null} [sshPublicKey] ImportSshPublicKeyRequest sshPublicKey + * @property {string|null} [projectId] ImportSshPublicKeyRequest projectId + */ + + /** + * Constructs a new ImportSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents an ImportSshPublicKeyRequest. + * @implements IImportSshPublicKeyRequest + * @constructor + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest=} [properties] Properties to set + */ + function ImportSshPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportSshPublicKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @instance + */ + ImportSshPublicKeyRequest.prototype.parent = ""; + + /** + * ImportSshPublicKeyRequest sshPublicKey. + * @member {google.cloud.oslogin.common.ISshPublicKey|null|undefined} sshPublicKey + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @instance + */ + ImportSshPublicKeyRequest.prototype.sshPublicKey = null; + + /** + * ImportSshPublicKeyRequest projectId. + * @member {string} projectId + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @instance + */ + ImportSshPublicKeyRequest.prototype.projectId = ""; + + /** + * Creates a new ImportSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyRequest} ImportSshPublicKeyRequest instance + */ + ImportSshPublicKeyRequest.create = function create(properties) { + return new ImportSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified ImportSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest} message ImportSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.projectId != null && message.hasOwnProperty("projectId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.projectId); + return writer; + }; + + /** + * Encodes the specified ImportSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyRequest} message ImportSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyRequest} ImportSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.ImportSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.projectId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyRequest} ImportSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) { + var error = $root.google.cloud.oslogin.common.SshPublicKey.verify(message.sshPublicKey); + if (error) + return "sshPublicKey." + error; + } + if (message.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + return null; + }; + + /** + * Creates an ImportSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyRequest} ImportSshPublicKeyRequest + */ + ImportSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.ImportSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.ImportSshPublicKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sshPublicKey != null) { + if (typeof object.sshPublicKey !== "object") + throw TypeError(".google.cloud.oslogin.v1.ImportSshPublicKeyRequest.sshPublicKey: object expected"); + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKey); + } + if (object.projectId != null) + message.projectId = String(object.projectId); + return message; + }; + + /** + * Creates a plain object from an ImportSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.ImportSshPublicKeyRequest} message ImportSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sshPublicKey = null; + object.projectId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + object.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKey, options); + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + return object; + }; + + /** + * Converts this ImportSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + ImportSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportSshPublicKeyRequest; + })(); + + v1.ImportSshPublicKeyResponse = (function() { + + /** + * Properties of an ImportSshPublicKeyResponse. + * @memberof google.cloud.oslogin.v1 + * @interface IImportSshPublicKeyResponse + * @property {google.cloud.oslogin.v1.ILoginProfile|null} [loginProfile] ImportSshPublicKeyResponse loginProfile + */ + + /** + * Constructs a new ImportSshPublicKeyResponse. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents an ImportSshPublicKeyResponse. + * @implements IImportSshPublicKeyResponse + * @constructor + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyResponse=} [properties] Properties to set + */ + function ImportSshPublicKeyResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportSshPublicKeyResponse loginProfile. + * @member {google.cloud.oslogin.v1.ILoginProfile|null|undefined} loginProfile + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @instance + */ + ImportSshPublicKeyResponse.prototype.loginProfile = null; + + /** + * Creates a new ImportSshPublicKeyResponse instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyResponse=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} ImportSshPublicKeyResponse instance + */ + ImportSshPublicKeyResponse.create = function create(properties) { + return new ImportSshPublicKeyResponse(properties); + }; + + /** + * Encodes the specified ImportSshPublicKeyResponse message. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyResponse} message ImportSshPublicKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportSshPublicKeyResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.loginProfile != null && message.hasOwnProperty("loginProfile")) + $root.google.cloud.oslogin.v1.LoginProfile.encode(message.loginProfile, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportSshPublicKeyResponse message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {google.cloud.oslogin.v1.IImportSshPublicKeyResponse} message ImportSshPublicKeyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportSshPublicKeyResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportSshPublicKeyResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} ImportSshPublicKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportSshPublicKeyResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.ImportSshPublicKeyResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportSshPublicKeyResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} ImportSshPublicKeyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportSshPublicKeyResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportSshPublicKeyResponse message. + * @function verify + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportSshPublicKeyResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.loginProfile != null && message.hasOwnProperty("loginProfile")) { + var error = $root.google.cloud.oslogin.v1.LoginProfile.verify(message.loginProfile); + if (error) + return "loginProfile." + error; + } + return null; + }; + + /** + * Creates an ImportSshPublicKeyResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} ImportSshPublicKeyResponse + */ + ImportSshPublicKeyResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.ImportSshPublicKeyResponse) + return object; + var message = new $root.google.cloud.oslogin.v1.ImportSshPublicKeyResponse(); + if (object.loginProfile != null) { + if (typeof object.loginProfile !== "object") + throw TypeError(".google.cloud.oslogin.v1.ImportSshPublicKeyResponse.loginProfile: object expected"); + message.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.fromObject(object.loginProfile); + } + return message; + }; + + /** + * Creates a plain object from an ImportSshPublicKeyResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @static + * @param {google.cloud.oslogin.v1.ImportSshPublicKeyResponse} message ImportSshPublicKeyResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportSshPublicKeyResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.loginProfile = null; + if (message.loginProfile != null && message.hasOwnProperty("loginProfile")) + object.loginProfile = $root.google.cloud.oslogin.v1.LoginProfile.toObject(message.loginProfile, options); + return object; + }; + + /** + * Converts this ImportSshPublicKeyResponse to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.ImportSshPublicKeyResponse + * @instance + * @returns {Object.} JSON object + */ + ImportSshPublicKeyResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportSshPublicKeyResponse; + })(); + + v1.UpdateSshPublicKeyRequest = (function() { + + /** + * Properties of an UpdateSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @interface IUpdateSshPublicKeyRequest + * @property {string|null} [name] UpdateSshPublicKeyRequest name + * @property {google.cloud.oslogin.common.ISshPublicKey|null} [sshPublicKey] UpdateSshPublicKeyRequest sshPublicKey + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSshPublicKeyRequest updateMask + */ + + /** + * Constructs a new UpdateSshPublicKeyRequest. + * @memberof google.cloud.oslogin.v1 + * @classdesc Represents an UpdateSshPublicKeyRequest. + * @implements IUpdateSshPublicKeyRequest + * @constructor + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest=} [properties] Properties to set + */ + function UpdateSshPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSshPublicKeyRequest name. + * @member {string} name + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @instance + */ + UpdateSshPublicKeyRequest.prototype.name = ""; + + /** + * UpdateSshPublicKeyRequest sshPublicKey. + * @member {google.cloud.oslogin.common.ISshPublicKey|null|undefined} sshPublicKey + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @instance + */ + UpdateSshPublicKeyRequest.prototype.sshPublicKey = null; + + /** + * UpdateSshPublicKeyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @instance + */ + UpdateSshPublicKeyRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSshPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.oslogin.v1.UpdateSshPublicKeyRequest} UpdateSshPublicKeyRequest instance + */ + UpdateSshPublicKeyRequest.create = function create(properties) { + return new UpdateSshPublicKeyRequest(properties); + }; + + /** + * Encodes the specified UpdateSshPublicKeyRequest message. Does not implicitly {@link google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest} message UpdateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSshPublicKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + $root.google.cloud.oslogin.common.SshPublicKey.encode(message.sshPublicKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSshPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest} message UpdateSshPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSshPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSshPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.oslogin.v1.UpdateSshPublicKeyRequest} UpdateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSshPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSshPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.oslogin.v1.UpdateSshPublicKeyRequest} UpdateSshPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSshPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSshPublicKeyRequest message. + * @function verify + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSshPublicKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) { + var error = $root.google.cloud.oslogin.common.SshPublicKey.verify(message.sshPublicKey); + if (error) + return "sshPublicKey." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSshPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.oslogin.v1.UpdateSshPublicKeyRequest} UpdateSshPublicKeyRequest + */ + UpdateSshPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest) + return object; + var message = new $root.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.sshPublicKey != null) { + if (typeof object.sshPublicKey !== "object") + throw TypeError(".google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.sshPublicKey: object expected"); + message.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.fromObject(object.sshPublicKey); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.oslogin.v1.UpdateSshPublicKeyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSshPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @static + * @param {google.cloud.oslogin.v1.UpdateSshPublicKeyRequest} message UpdateSshPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSshPublicKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.sshPublicKey = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.sshPublicKey != null && message.hasOwnProperty("sshPublicKey")) + object.sshPublicKey = $root.google.cloud.oslogin.common.SshPublicKey.toObject(message.sshPublicKey, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSshPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.oslogin.v1.UpdateSshPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSshPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateSshPublicKeyRequest; + })(); + + return v1; + })(); + oslogin.v1beta = (function() { /** diff --git a/packages/google-cloud-oslogin/protos/protos.json b/packages/google-cloud-oslogin/protos/protos.json index b836380d36f..a7324aec5df 100644 --- a/packages/google-cloud-oslogin/protos/protos.json +++ b/packages/google-cloud-oslogin/protos/protos.json @@ -114,6 +114,207 @@ } } }, + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.OsLogin.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin", + "java_multiple_files": true, + "java_outer_classname": "OsLoginProto", + "java_package": "com.google.cloud.oslogin.v1", + "php_namespace": "Google\\Cloud\\OsLogin\\V1" + }, + "nested": { + "OsLoginService": { + "options": { + "(google.api.default_host)": "oslogin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute" + }, + "methods": { + "DeletePosixAccount": { + "requestType": "DeletePosixAccountRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=users/*/projects/*}", + "(google.api.method_signature)": "name" + } + }, + "DeleteSshPublicKey": { + "requestType": "DeleteSshPublicKeyRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=users/*/sshPublicKeys/*}", + "(google.api.method_signature)": "name" + } + }, + "GetLoginProfile": { + "requestType": "GetLoginProfileRequest", + "responseType": "LoginProfile", + "options": { + "(google.api.http).get": "/v1/{name=users/*}/loginProfile", + "(google.api.method_signature)": "name" + } + }, + "GetSshPublicKey": { + "requestType": "GetSshPublicKeyRequest", + "responseType": "google.cloud.oslogin.common.SshPublicKey", + "options": { + "(google.api.http).get": "/v1/{name=users/*/sshPublicKeys/*}", + "(google.api.method_signature)": "name" + } + }, + "ImportSshPublicKey": { + "requestType": "ImportSshPublicKeyRequest", + "responseType": "ImportSshPublicKeyResponse", + "options": { + "(google.api.http).post": "/v1/{parent=users/*}:importSshPublicKey", + "(google.api.http).body": "ssh_public_key", + "(google.api.method_signature)": "parent,ssh_public_key,project_id" + } + }, + "UpdateSshPublicKey": { + "requestType": "UpdateSshPublicKeyRequest", + "responseType": "google.cloud.oslogin.common.SshPublicKey", + "options": { + "(google.api.http).patch": "/v1/{name=users/*/sshPublicKeys/*}", + "(google.api.http).body": "ssh_public_key", + "(google.api.method_signature)": "name,ssh_public_key,update_mask" + } + } + } + }, + "LoginProfile": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "posixAccounts": { + "rule": "repeated", + "type": "google.cloud.oslogin.common.PosixAccount", + "id": 2 + }, + "sshPublicKeys": { + "keyType": "string", + "type": "google.cloud.oslogin.common.SshPublicKey", + "id": 3 + } + } + }, + "DeletePosixAccountRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "oslogin.googleapis.com/PosixAccount" + } + } + } + }, + "DeleteSshPublicKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "oslogin.googleapis.com/SshPublicKey" + } + } + } + }, + "GetLoginProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "oslogin.googleapis.com/PosixAccount" + } + }, + "projectId": { + "type": "string", + "id": 2 + }, + "systemId": { + "type": "string", + "id": 3 + } + } + }, + "GetSshPublicKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "oslogin.googleapis.com/SshPublicKey" + } + } + } + }, + "ImportSshPublicKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "oslogin.googleapis.com/SshPublicKey" + } + }, + "sshPublicKey": { + "type": "google.cloud.oslogin.common.SshPublicKey", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "projectId": { + "type": "string", + "id": 3 + } + } + }, + "ImportSshPublicKeyResponse": { + "fields": { + "loginProfile": { + "type": "LoginProfile", + "id": 1 + } + } + }, + "UpdateSshPublicKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "oslogin.googleapis.com/SshPublicKey" + } + }, + "sshPublicKey": { + "type": "google.cloud.oslogin.common.SshPublicKey", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + } + } + }, "v1beta": { "options": { "csharp_namespace": "Google.Cloud.OsLogin.V1Beta", diff --git a/packages/google-cloud-oslogin/src/index.js b/packages/google-cloud-oslogin/src/index.js deleted file mode 100644 index bfc7ddf5617..00000000000 --- a/packages/google-cloud-oslogin/src/index.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2017 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @namespace google - */ -/** - * @namespace google.cloud - */ -/** - * @namespace google.cloud.oslogin - */ -/** - * @namespace google.cloud.oslogin.v1beta - */ -/** - * @namespace google.cloud.oslogin.common - */ -/** - * @namespace google.protobuf - */ - -'use strict'; - -// Import the clients for each version supported by this package. -const gapic = Object.freeze({ - v1beta: require('./v1beta'), -}); - -/** - * The `@google-cloud/oslogin` package has the following named exports: - * - * - `OsLoginServiceClient` - Reference to - * {@link v1beta.OsLoginServiceClient} - * - `v1beta` - This is used for selecting or pinning a - * particular backend service version. It exports: - * - `OsLoginServiceClient` - Reference to - * {@link v1beta.OsLoginServiceClient} - * - * @module {object} @google-cloud/oslogin - * @alias nodejs-oslogin - * - * @example Install the client library with npm: - * npm install --save @google-cloud/oslogin - * - * @example Import the client library: - * const oslogin = require('@google-cloud/oslogin'); - * - * @example Create a client that uses Application Default Credentials (ADC): - * const client = new oslogin.OsLoginServiceClient(); - * - * @example Create a client with explicit credentials: - * const client = new oslogin.OsLoginServiceClient({ - * projectId: 'your-project-id', - * keyFilename: '/path/to/keyfile.json', - * }); - */ - -/** - * @type {object} - * @property {constructor} OsLoginServiceClient - * Reference to {@link v1beta.OsLoginServiceClient} - */ -module.exports = gapic.v1beta; - -/** - * @type {object} - * @property {constructor} OsLoginServiceClient - * Reference to {@link v1beta.OsLoginServiceClient} - */ -module.exports.v1beta = gapic.v1beta; - -// Alias `module.exports` as `module.exports.default`, for future-proofing. -module.exports.default = Object.assign({}, module.exports); diff --git a/packages/google-cloud-oslogin/src/index.ts b/packages/google-cloud-oslogin/src/index.ts index f5328b73c5f..1638ec020a4 100644 --- a/packages/google-cloud-oslogin/src/index.ts +++ b/packages/google-cloud-oslogin/src/index.ts @@ -17,8 +17,10 @@ // ** All changes to this file may be overwritten. ** import * as v1beta from './v1beta'; -const OsLoginServiceClient = v1beta.OsLoginServiceClient; -export {v1beta, OsLoginServiceClient}; +import * as v1 from './v1'; + +const OsLoginServiceClient = v1.OsLoginServiceClient; +export {v1beta, v1, OsLoginServiceClient}; // For compatibility with JavaScript libraries we need to provide this default export: // tslint:disable-next-line no-default-export -export default {v1beta, OsLoginServiceClient}; +export default {v1beta, v1, OsLoginServiceClient}; diff --git a/packages/google-cloud-oslogin/src/v1/index.ts b/packages/google-cloud-oslogin/src/v1/index.ts new file mode 100644 index 00000000000..c79dd4557a3 --- /dev/null +++ b/packages/google-cloud-oslogin/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {OsLoginServiceClient} from './os_login_service_client'; diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts new file mode 100644 index 00000000000..1d21919f99a --- /dev/null +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_client.ts @@ -0,0 +1,880 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './os_login_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Cloud OS Login API + * + * The Cloud OS Login API allows you to manage users and their associated SSH + * public keys for logging into virtual machines on Google Cloud Platform. + * @class + * @memberof v1 + */ +export class OsLoginServiceClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + osLoginServiceStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of OsLoginServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof OsLoginServiceClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof OsLoginServiceClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + posixAccountPathTemplate: new gaxModule.PathTemplate( + 'users/{user}/projects/{project}' + ), + sshPublicKeyPathTemplate: new gaxModule.PathTemplate( + 'users/{user}/sshPublicKeys/{fingerprint}' + ), + userPathTemplate: new gaxModule.PathTemplate('users/{user}'), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.oslogin.v1.OsLoginService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.oslogin.v1.OsLoginService. + this.osLoginServiceStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.oslogin.v1.OsLoginService' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.oslogin.v1.OsLoginService, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const osLoginServiceStubMethods = [ + 'deletePosixAccount', + 'deleteSshPublicKey', + 'getLoginProfile', + 'getSshPublicKey', + 'importSshPublicKey', + 'updateSshPublicKey', + ]; + + for (const methodName of osLoginServiceStubMethods) { + const innerCallPromise = this.osLoginServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'oslogin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'oslogin.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/compute', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + deletePosixAccount( + request: protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest + | undefined + ), + {} | undefined + ] + >; + deletePosixAccount( + request: protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest + | undefined, + {} | undefined + > + ): void; + /** + * Deletes a POSIX account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. A reference to the POSIX account to update. POSIX accounts are identified + * by the project ID they are associated with. A reference to the POSIX + * account is in format `users/{user}/projects/{project}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deletePosixAccount( + request: protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deletePosixAccount(request, options, callback); + } + deleteSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + >; + deleteSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * Deletes an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteSshPublicKey(request, options, callback); + } + getLoginProfile( + request: protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.oslogin.v1.ILoginProfile, + protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest | undefined, + {} | undefined + ] + >; + getLoginProfile( + request: protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.oslogin.v1.ILoginProfile, + protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest | undefined, + {} | undefined + > + ): void; + /** + * Retrieves the profile information used for logging in to a virtual machine + * on Google Compute Engine. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The unique ID for the user in format `users/{user}`. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @param {string} request.systemId + * A system ID for filtering the results of the request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [LoginProfile]{@link google.cloud.oslogin.v1.LoginProfile}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getLoginProfile( + request: protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.oslogin.v1.ILoginProfile, + | protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.oslogin.v1.ILoginProfile, + protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.oslogin.v1.ILoginProfile, + protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getLoginProfile(request, options, callback); + } + getSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest | undefined, + {} | undefined + ] + >; + getSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest | undefined, + {} | undefined + > + ): void; + /** + * Retrieves an SSH public key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to retrieve. Public keys are identified + * by their SHA-256 fingerprint. The fingerprint of the public key is in + * format `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + | protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getSshPublicKey(request, options, callback); + } + importSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + ( + | protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + >; + importSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + | protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * Adds an SSH public key and returns the profile information. Default POSIX + * account information is set when no username and UID exist as part of the + * login profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The unique ID for the user in format `users/{user}`. + * @param {google.cloud.oslogin.common.SshPublicKey} [request.sshPublicKey] + * Optional. The SSH public key and expiration time. + * @param {string} request.projectId + * The project ID of the Google Cloud Platform project. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ImportSshPublicKeyResponse]{@link google.cloud.oslogin.v1.ImportSshPublicKeyResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + importSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + | protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + | protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyResponse, + ( + | protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.importSshPublicKey(request, options, callback); + } + updateSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + ( + | protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + >; + updateSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + | protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest + | undefined, + {} | undefined + > + ): void; + /** + * Updates an SSH public key and returns the profile information. This method + * supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The fingerprint of the public key to update. Public keys are identified by + * their SHA-256 fingerprint. The fingerprint of the public key is in format + * `users/{user}/sshPublicKeys/{fingerprint}`. + * @param {google.cloud.oslogin.common.SshPublicKey} request.sshPublicKey + * Required. The SSH public key and expiration time. + * @param {google.protobuf.FieldMask} request.updateMask + * Mask to control which fields get updated. Updates all if not present. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateSshPublicKey( + request: protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + | protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + | protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.oslogin.common.ISshPublicKey, + ( + | protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.updateSshPublicKey(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified posixAccount resource name string. + * + * @param {string} user + * @param {string} project + * @returns {string} Resource name string. + */ + posixAccountPath(user: string, project: string) { + return this._pathTemplates.posixAccountPathTemplate.render({ + user, + project, + }); + } + + /** + * Parse the user from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the user. + */ + matchUserFromPosixAccountName(posixAccountName: string) { + return this._pathTemplates.posixAccountPathTemplate.match(posixAccountName) + .user; + } + + /** + * Parse the project from PosixAccount resource. + * + * @param {string} posixAccountName + * A fully-qualified path representing PosixAccount resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPosixAccountName(posixAccountName: string) { + return this._pathTemplates.posixAccountPathTemplate.match(posixAccountName) + .project; + } + + /** + * Return a fully-qualified sshPublicKey resource name string. + * + * @param {string} user + * @param {string} fingerprint + * @returns {string} Resource name string. + */ + sshPublicKeyPath(user: string, fingerprint: string) { + return this._pathTemplates.sshPublicKeyPathTemplate.render({ + user, + fingerprint, + }); + } + + /** + * Parse the user from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the user. + */ + matchUserFromSshPublicKeyName(sshPublicKeyName: string) { + return this._pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName) + .user; + } + + /** + * Parse the fingerprint from SshPublicKey resource. + * + * @param {string} sshPublicKeyName + * A fully-qualified path representing SshPublicKey resource. + * @returns {string} A string representing the fingerprint. + */ + matchFingerprintFromSshPublicKeyName(sshPublicKeyName: string) { + return this._pathTemplates.sshPublicKeyPathTemplate.match(sshPublicKeyName) + .fingerprint; + } + + /** + * Return a fully-qualified user resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + userPath(user: string) { + return this._pathTemplates.userPathTemplate.render({ + user, + }); + } + + /** + * Parse the user from User resource. + * + * @param {string} userName + * A fully-qualified path representing User resource. + * @returns {string} A string representing the user. + */ + matchUserFromUserName(userName: string) { + return this._pathTemplates.userPathTemplate.match(userName).user; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.osLoginServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json b/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json new file mode 100644 index 00000000000..23d75dbcd9c --- /dev/null +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_client_config.json @@ -0,0 +1,50 @@ +{ + "interfaces": { + "google.cloud.oslogin.v1.OsLoginService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "DeletePosixAccount": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetLoginProfile": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSshPublicKey": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-oslogin/src/v1/os_login_service_proto_list.json b/packages/google-cloud-oslogin/src/v1/os_login_service_proto_list.json new file mode 100644 index 00000000000..46f125ed586 --- /dev/null +++ b/packages/google-cloud-oslogin/src/v1/os_login_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/oslogin/common/common.proto", + "../../protos/google/cloud/oslogin/v1/oslogin.proto" +] diff --git a/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/common/doc_common.js b/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/common/doc_common.js deleted file mode 100644 index 2fa1e11d0de..00000000000 --- a/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/common/doc_common.js +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The POSIX account information associated with a Google account. - * - * @property {boolean} primary - * Only one POSIX account can be marked as primary. - * - * @property {string} username - * The username of the POSIX account. - * - * @property {number} uid - * The user ID. - * - * @property {number} gid - * The default group ID. - * - * @property {string} homeDirectory - * The path to the home directory for this account. - * - * @property {string} shell - * The path to the logic shell for this account. - * - * @property {string} gecos - * The GECOS (user information) entry for this account. - * - * @property {string} systemId - * System identifier for which account the username or uid applies to. - * By default, the empty value is used. - * - * @property {string} accountId - * Output only. A POSIX account identifier. - * - * @property {number} operatingSystemType - * The operating system type where this account applies. - * - * The number should be among the values of [OperatingSystemType]{@link google.cloud.oslogin.common.OperatingSystemType} - * - * @property {string} name - * Output only. The canonical resource name. - * - * @typedef PosixAccount - * @memberof google.cloud.oslogin.common - * @see [google.cloud.oslogin.common.PosixAccount definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/common/common.proto} - */ -const PosixAccount = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The SSH public key information associated with a Google account. - * - * @property {string} key - * Public key text in SSH format, defined by - * RFC4253 - * section 6.6. - * - * @property {number} expirationTimeUsec - * An expiration time in microseconds since epoch. - * - * @property {string} fingerprint - * Output only. The SHA-256 fingerprint of the SSH public key. - * - * @property {string} name - * Output only. The canonical resource name. - * - * @typedef SshPublicKey - * @memberof google.cloud.oslogin.common - * @see [google.cloud.oslogin.common.SshPublicKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/common/common.proto} - */ -const SshPublicKey = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The operating system options for account entries. - * - * @enum {number} - * @memberof google.cloud.oslogin.common - */ -const OperatingSystemType = { - - /** - * The operating system type associated with the user account information is - * unspecified. - */ - OPERATING_SYSTEM_TYPE_UNSPECIFIED: 0, - - /** - * Linux user account information. - */ - LINUX: 1, - - /** - * Windows user account information. - */ - WINDOWS: 2 -}; \ No newline at end of file diff --git a/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/v1beta/doc_oslogin.js b/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/v1beta/doc_oslogin.js deleted file mode 100644 index 9640fdacd39..00000000000 --- a/packages/google-cloud-oslogin/src/v1beta/doc/google/cloud/oslogin/v1beta/doc_oslogin.js +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The user profile information used for logging in to a virtual machine on - * Google Compute Engine. - * - * @property {string} name - * Required. A unique user ID. - * - * @property {Object[]} posixAccounts - * The list of POSIX accounts associated with the user. - * - * This object should have the same structure as [PosixAccount]{@link google.cloud.oslogin.common.PosixAccount} - * - * @property {Object.} sshPublicKeys - * A map from SSH public key fingerprint to the associated key object. - * - * @typedef LoginProfile - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.LoginProfile definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const LoginProfile = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for deleting a POSIX account entry. - * - * @property {string} name - * Required. A reference to the POSIX account to update. POSIX accounts are identified - * by the project ID they are associated with. A reference to the POSIX - * account is in format `users/{user}/projects/{project}`. - * - * @typedef DeletePosixAccountRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.DeletePosixAccountRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const DeletePosixAccountRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for deleting an SSH public key. - * - * @property {string} name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * - * @typedef DeleteSshPublicKeyRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.DeleteSshPublicKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const DeleteSshPublicKeyRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for retrieving the login profile information for a user. - * - * @property {string} name - * Required. The unique ID for the user in format `users/{user}`. - * - * @property {string} projectId - * The project ID of the Google Cloud Platform project. - * - * @property {string} systemId - * A system ID for filtering the results of the request. - * - * @typedef GetLoginProfileRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.GetLoginProfileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const GetLoginProfileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for retrieving an SSH public key. - * - * @property {string} name - * Required. The fingerprint of the public key to retrieve. Public keys are identified - * by their SHA-256 fingerprint. The fingerprint of the public key is in - * format `users/{user}/sshPublicKeys/{fingerprint}`. - * - * @typedef GetSshPublicKeyRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.GetSshPublicKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const GetSshPublicKeyRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for importing an SSH public key. - * - * @property {string} parent - * The unique ID for the user in format `users/{user}`. - * - * @property {Object} sshPublicKey - * Required. The SSH public key and expiration time. - * - * This object should have the same structure as [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey} - * - * @property {string} projectId - * The project ID of the Google Cloud Platform project. - * - * @typedef ImportSshPublicKeyRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.ImportSshPublicKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const ImportSshPublicKeyRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A response message for importing an SSH public key. - * - * @property {Object} loginProfile - * The login profile information for the user. - * - * This object should have the same structure as [LoginProfile]{@link google.cloud.oslogin.v1beta.LoginProfile} - * - * @typedef ImportSshPublicKeyResponse - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.ImportSshPublicKeyResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const ImportSshPublicKeyResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request message for updating an SSH public key. - * - * @property {string} name - * Required. The fingerprint of the public key to update. Public keys are identified by - * their SHA-256 fingerprint. The fingerprint of the public key is in format - * `users/{user}/sshPublicKeys/{fingerprint}`. - * - * @property {Object} sshPublicKey - * Required. The SSH public key and expiration time. - * - * This object should have the same structure as [SshPublicKey]{@link google.cloud.oslogin.common.SshPublicKey} - * - * @property {Object} updateMask - * Mask to control which fields get updated. Updates all if not present. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateSshPublicKeyRequest - * @memberof google.cloud.oslogin.v1beta - * @see [google.cloud.oslogin.v1beta.UpdateSshPublicKeyRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1beta/oslogin.proto} - */ -const UpdateSshPublicKeyRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_empty.js b/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_empty.js deleted file mode 100644 index 0b446dd9ce4..00000000000 --- a/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_empty.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * The JSON representation for `Empty` is empty JSON object `{}`. - * @typedef Empty - * @memberof google.protobuf - * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} - */ -const Empty = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_field_mask.js b/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_field_mask.js deleted file mode 100644 index 011207b8626..00000000000 --- a/packages/google-cloud-oslogin/src/v1beta/doc/google/protobuf/doc_field_mask.js +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `FieldMask` represents a set of symbolic field paths, for example: - * - * paths: "f.a" - * paths: "f.b.d" - * - * Here `f` represents a field in some root message, `a` and `b` - * fields in the message found in `f`, and `d` a field found in the - * message in `f.b`. - * - * Field masks are used to specify a subset of fields that should be - * returned by a get operation or modified by an update operation. - * Field masks also have a custom JSON encoding (see below). - * - * # Field Masks in Projections - * - * When used in the context of a projection, a response message or - * sub-message is filtered by the API to only contain those fields as - * specified in the mask. For example, if the mask in the previous - * example is applied to a response message as follows: - * - * f { - * a : 22 - * b { - * d : 1 - * x : 2 - * } - * y : 13 - * } - * z: 8 - * - * The result will not contain specific values for fields x,y and z - * (their value will be set to the default, and omitted in proto text - * output): - * - * - * f { - * a : 22 - * b { - * d : 1 - * } - * } - * - * A repeated field is not allowed except at the last position of a - * paths string. - * - * If a FieldMask object is not present in a get operation, the - * operation applies to all fields (as if a FieldMask of all fields - * had been specified). - * - * Note that a field mask does not necessarily apply to the - * top-level response message. In case of a REST get operation, the - * field mask applies directly to the response, but in case of a REST - * list operation, the mask instead applies to each individual message - * in the returned resource list. In case of a REST custom method, - * other definitions may be used. Where the mask applies will be - * clearly documented together with its declaration in the API. In - * any case, the effect on the returned resource/resources is required - * behavior for APIs. - * - * # Field Masks in Update Operations - * - * A field mask in update operations specifies which fields of the - * targeted resource are going to be updated. The API is required - * to only change the values of the fields as specified in the mask - * and leave the others untouched. If a resource is passed in to - * describe the updated values, the API ignores the values of all - * fields not covered by the mask. - * - * If a repeated field is specified for an update operation, new values will - * be appended to the existing repeated field in the target resource. Note that - * a repeated field is only allowed in the last position of a `paths` string. - * - * If a sub-message is specified in the last position of the field mask for an - * update operation, then new value will be merged into the existing sub-message - * in the target resource. - * - * For example, given the target message: - * - * f { - * b { - * d: 1 - * x: 2 - * } - * c: [1] - * } - * - * And an update message: - * - * f { - * b { - * d: 10 - * } - * c: [2] - * } - * - * then if the field mask is: - * - * paths: ["f.b", "f.c"] - * - * then the result will be: - * - * f { - * b { - * d: 10 - * x: 2 - * } - * c: [1, 2] - * } - * - * An implementation may provide options to override this default behavior for - * repeated and message fields. - * - * In order to reset a field's value to the default, the field must - * be in the mask and set to the default value in the provided resource. - * Hence, in order to reset all fields of a resource, provide a default - * instance of the resource and set all fields in the mask, or do - * not provide a mask as described below. - * - * If a field mask is not present on update, the operation applies to - * all fields (as if a field mask of all fields has been specified). - * Note that in the presence of schema evolution, this may mean that - * fields the client does not know and has therefore not filled into - * the request will be reset to their default. If this is unwanted - * behavior, a specific service may require a client to always specify - * a field mask, producing an error if not. - * - * As with get operations, the location of the resource which - * describes the updated values in the request message depends on the - * operation kind. In any case, the effect of the field mask is - * required to be honored by the API. - * - * ## Considerations for HTTP REST - * - * The HTTP kind of an update operation which uses a field mask must - * be set to PATCH instead of PUT in order to satisfy HTTP semantics - * (PUT must only be used for full updates). - * - * # JSON Encoding of Field Masks - * - * In JSON, a field mask is encoded as a single string where paths are - * separated by a comma. Fields name in each path are converted - * to/from lower-camel naming conventions. - * - * As an example, consider the following message declarations: - * - * message Profile { - * User user = 1; - * Photo photo = 2; - * } - * message User { - * string display_name = 1; - * string address = 2; - * } - * - * In proto a field mask for `Profile` may look as such: - * - * mask { - * paths: "user.display_name" - * paths: "photo" - * } - * - * In JSON, the same mask is represented as below: - * - * { - * mask: "user.displayName,photo" - * } - * - * # Field Masks and Oneof Fields - * - * Field masks treat fields in oneofs just as regular fields. Consider the - * following message: - * - * message SampleMessage { - * oneof test_oneof { - * string name = 4; - * SubMessage sub_message = 9; - * } - * } - * - * The field mask can be: - * - * mask { - * paths: "name" - * } - * - * Or: - * - * mask { - * paths: "sub_message" - * } - * - * Note that oneof type names ("test_oneof" in this case) cannot be used in - * paths. - * - * ## Field Mask Verification - * - * The implementation of any API method which has a FieldMask type field in the - * request should verify the included field paths, and return an - * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. - * - * @property {string[]} paths - * The set of field mask paths. - * - * @typedef FieldMask - * @memberof google.protobuf - * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} - */ -const FieldMask = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-oslogin/synth.metadata b/packages/google-cloud-oslogin/synth.metadata index 652d68113f9..abc64c2fa0a 100644 --- a/packages/google-cloud-oslogin/synth.metadata +++ b/packages/google-cloud-oslogin/synth.metadata @@ -1,13 +1,12 @@ { - "updateTime": "2020-02-07T12:29:10.658606Z", + "updateTime": "2020-02-07T20:54:08.367917Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", - "internalRef": "293710856", - "log": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585\nGenerate the Bazel build file for recommendengine public api\n\nPiperOrigin-RevId: 293710856\n\n68477017c4173c98addac0373950c6aa9d7b375f\nMake `language_code` optional for UpdateIntentRequest and BatchUpdateIntentsRequest.\n\nThe comments and proto annotations describe this parameter as optional.\n\nPiperOrigin-RevId: 293703548\n\n16f823f578bca4e845a19b88bb9bc5870ea71ab2\nAdd BUILD.bazel files for managedidentities API\n\nPiperOrigin-RevId: 293698246\n\n2f53fd8178c9a9de4ad10fae8dd17a7ba36133f2\nAdd v1p1beta1 config file\n\nPiperOrigin-RevId: 293696729\n\n052b274138fce2be80f97b6dcb83ab343c7c8812\nAdd source field for user event and add field behavior annotations\n\nPiperOrigin-RevId: 293693115\n\n1e89732b2d69151b1b3418fff3d4cc0434f0dded\ndatacatalog: v1beta1 add three new RPCs to gapic v1beta1 config\n\nPiperOrigin-RevId: 293692823\n\n9c8bd09bbdc7c4160a44f1fbab279b73cd7a2337\nchange the name of AccessApproval service to AccessApprovalAdmin\n\nPiperOrigin-RevId: 293690934\n\n2e23b8fbc45f5d9e200572ca662fe1271bcd6760\nAdd ListEntryGroups method, add http bindings to support entry group tagging, and update some comments.\n\nPiperOrigin-RevId: 293666452\n\n0275e38a4ca03a13d3f47a9613aac8c8b0d3f1f2\nAdd proto_package field to managedidentities API. It is needed for APIs that still depend on artman generation.\n\nPiperOrigin-RevId: 293643323\n\n4cdfe8278cb6f308106580d70648001c9146e759\nRegenerating public protos for Data Catalog to add new Custom Type Entry feature.\n\nPiperOrigin-RevId: 293614782\n\n45d2a569ab526a1fad3720f95eefb1c7330eaada\nEnable client generation for v1 ManagedIdentities API.\n\nPiperOrigin-RevId: 293515675\n\n2c17086b77e6f3bcf04a1f65758dfb0c3da1568f\nAdd the Actions on Google common types (//google/actions/type/*).\n\nPiperOrigin-RevId: 293478245\n\n781aadb932e64a12fb6ead7cd842698d99588433\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293443396\n\ne2602608c9138c2fca24162720e67f9307c30b95\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293442964\n\nc8aef82028d06b7992278fa9294c18570dc86c3d\nAdd cc_proto_library and cc_grpc_library targets for Bigtable protos.\n\nAlso fix indentation of cc_grpc_library targets in Spanner and IAM protos.\n\nPiperOrigin-RevId: 293440538\n\ne2faab04f4cb7f9755072330866689b1943a16e9\ncloudtasks: v2 replace non-standard retry params in gapic config v2\n\nPiperOrigin-RevId: 293424055\n\ndfb4097ea628a8470292c6590a4313aee0c675bd\nerrorreporting: v1beta1 add legacy artman config for php\n\nPiperOrigin-RevId: 293423790\n\nb18aed55b45bfe5b62476292c72759e6c3e573c6\nasset: v1p1beta1 updated comment for `page_size` limit.\n\nPiperOrigin-RevId: 293421386\n\nc9ef36b7956d9859a2fc86ad35fcaa16958ab44f\nbazel: Refactor CI build scripts\n\nPiperOrigin-RevId: 293387911\n\na8ed9d921fdddc61d8467bfd7c1668f0ad90435c\nfix: set Ruby module name for OrgPolicy\n\nPiperOrigin-RevId: 293257997\n\n6c7d28509bd8315de8af0889688ee20099594269\nredis: v1beta1 add UpgradeInstance and connect_mode field to Instance\n\nPiperOrigin-RevId: 293242878\n\nae0abed4fcb4c21f5cb67a82349a049524c4ef68\nredis: v1 add connect_mode field to Instance\n\nPiperOrigin-RevId: 293241914\n\n3f7a0d29b28ee9365771da2b66edf7fa2b4e9c56\nAdds service config definition for bigqueryreservation v1beta1\n\nPiperOrigin-RevId: 293234418\n\n0c88168d5ed6fe353a8cf8cbdc6bf084f6bb66a5\naddition of BUILD & configuration for accessapproval v1\n\nPiperOrigin-RevId: 293219198\n\n39bedc2e30f4778ce81193f6ba1fec56107bcfc4\naccessapproval: v1 publish protos\n\nPiperOrigin-RevId: 293167048\n\n69d9945330a5721cd679f17331a78850e2618226\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080182\n\nf6a1a6b417f39694275ca286110bc3c1ca4db0dc\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080178\n\n29d40b78e3dc1579b0b209463fbcb76e5767f72a\nExpose managedidentities/v1beta1/ API for client library usage.\n\nPiperOrigin-RevId: 292979741\n\na22129a1fb6e18056d576dfb7717aef74b63734a\nExpose managedidentities/v1/ API for client library usage.\n\nPiperOrigin-RevId: 292968186\n\nb5cbe4a4ba64ab19e6627573ff52057a1657773d\nSecurityCenter v1p1beta1: move file-level option on top to workaround protobuf.js bug.\n\nPiperOrigin-RevId: 292647187\n\nb224b317bf20c6a4fbc5030b4a969c3147f27ad3\nAdds API definitions for bigqueryreservation v1beta1.\n\nPiperOrigin-RevId: 292634722\n\nc1468702f9b17e20dd59007c0804a089b83197d2\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 292626173\n\nffdfa4f55ab2f0afc11d0eb68f125ccbd5e404bd\nvision: v1p3beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605599\n\n78f61482cd028fc1d9892aa5d89d768666a954cd\nvision: v1p1beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605125\n\n60bb5a294a604fd1778c7ec87b265d13a7106171\nvision: v1p2beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604980\n\n3bcf7aa79d45eb9ec29ab9036e9359ea325a7fc3\nvision: v1p4beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604656\n\n2717b8a1c762b26911b45ecc2e4ee01d98401b28\nFix dataproc artman client library generation.\n\nPiperOrigin-RevId: 292555664\n\n7ac66d9be8a7d7de4f13566d8663978c9ee9dcd7\nAdd Dataproc Autoscaling API to V1.\n\nPiperOrigin-RevId: 292450564\n\n5d932b2c1be3a6ef487d094e3cf5c0673d0241dd\n- Improve documentation\n- Add a client_id field to StreamingPullRequest\n\nPiperOrigin-RevId: 292434036\n\neaff9fa8edec3e914995ce832b087039c5417ea7\nmonitoring: v3 publish annotations and client retry config\n\nPiperOrigin-RevId: 292425288\n\n70958bab8c5353870d31a23fb2c40305b050d3fe\nBigQuery Storage Read API v1 clients.\n\nPiperOrigin-RevId: 292407644\n\n7a15e7fe78ff4b6d5c9606a3264559e5bde341d1\nUpdate backend proto for Google Cloud Endpoints\n\nPiperOrigin-RevId: 292391607\n\n3ca2c014e24eb5111c8e7248b1e1eb833977c83d\nbazel: Add --flaky_test_attempts=3 argument to prevent CI failures caused by flaky tests\n\nPiperOrigin-RevId: 292382559\n\n9933347c1f677e81e19a844c2ef95bfceaf694fe\nbazel:Integrate latest protoc-java-resource-names-plugin changes (fix for PyYAML dependency in bazel rules)\n\nPiperOrigin-RevId: 292376626\n\nb835ab9d2f62c88561392aa26074c0b849fb0bd3\nasset: v1p2beta1 add client config annotations\n\n* remove unintentionally exposed RPCs\n* remove messages relevant to removed RPCs\n\nPiperOrigin-RevId: 292369593\n\nc1246a29e22b0f98e800a536b5b0da2d933a55f2\nUpdating v1 protos with the latest inline documentation (in comments) and config options. Also adding a per-service .yaml file.\n\nPiperOrigin-RevId: 292310790\n\nb491d07cadaae7cde5608321f913e5ca1459b32d\nRevert accidental local_repository change\n\nPiperOrigin-RevId: 292245373\n\naf3400a8cb6110025198b59a0f7d018ae3cda700\nUpdate gapic-generator dependency (prebuilt PHP binary support).\n\nPiperOrigin-RevId: 292243997\n\n341fd5690fae36f36cf626ef048fbcf4bbe7cee6\ngrafeas: v1 add resource_definition for the grafeas.io/Project and change references for Project.\n\nPiperOrigin-RevId: 292221998\n\n42e915ec2ece1cd37a590fbcd10aa2c0fb0e5b06\nUpdate the gapic-generator, protoc-java-resource-name-plugin and protoc-docs-plugin to the latest commit.\n\nPiperOrigin-RevId: 292182368\n\nf035f47250675d31492a09f4a7586cfa395520a7\nFix grafeas build and update build.sh script to include gerafeas.\n\nPiperOrigin-RevId: 292168753\n\n26ccb214b7bc4a716032a6266bcb0a9ca55d6dbb\nasset: v1p1beta1 add client config annotations and retry config\n\nPiperOrigin-RevId: 292154210\n\n974ee5c0b5d03e81a50dafcedf41e0efebb5b749\nasset: v1beta1 add client config annotations\n\nPiperOrigin-RevId: 292152573\n\ncf3b61102ed5f36b827bc82ec39be09525f018c8\n Fix to protos for v1p1beta1 release of Cloud Security Command Center\n\nPiperOrigin-RevId: 292034635\n\n4e1cfaa7c0fede9e65d64213ca3da1b1255816c0\nUpdate the public proto to support UTF-8 encoded id for CatalogService API, increase the ListCatalogItems deadline to 300s and some minor documentation change\n\nPiperOrigin-RevId: 292030970\n\n" + "internalRef": "293710856" } }, { @@ -27,6 +26,15 @@ "language": "typescript", "generator": "gapic-generator-typescript" } + }, + { + "client": { + "source": "googleapis", + "apiName": "os-login", + "apiVersion": "v1", + "language": "typescript", + "generator": "gapic-generator-typescript" + } } ] } \ No newline at end of file diff --git a/packages/google-cloud-oslogin/synth.py b/packages/google-cloud-oslogin/synth.py index 716b85c9631..f2d2519209a 100644 --- a/packages/google-cloud-oslogin/synth.py +++ b/packages/google-cloud-oslogin/synth.py @@ -22,7 +22,7 @@ logging.basicConfig(level=logging.DEBUG) gapic = gcp.GAPICMicrogenerator() -versions = ['v1beta'] +versions = ['v1beta', 'v1'] for version in versions: library = gapic.typescript_library( 'os-login', diff --git a/packages/google-cloud-oslogin/test/gapic-os_login_service-v1.ts b/packages/google-cloud-oslogin/test/gapic-os_login_service-v1.ts new file mode 100644 index 00000000000..aec6afe6753 --- /dev/null +++ b/packages/google-cloud-oslogin/test/gapic-os_login_service-v1.ts @@ -0,0 +1,374 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const osloginserviceModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +describe('v1.OsLoginServiceClient', () => { + it('has servicePath', () => { + const servicePath = + osloginserviceModule.v1.OsLoginServiceClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + osloginserviceModule.v1.OsLoginServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = osloginserviceModule.v1.OsLoginServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + fallback: true, + }); + assert(client); + }); + describe('deletePosixAccount', () => { + it('invokes deletePosixAccount without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deletePosixAccount = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deletePosixAccount(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deletePosixAccount with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IDeletePosixAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deletePosixAccount = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deletePosixAccount(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteSshPublicKey', () => { + it('invokes deleteSshPublicKey without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteSshPublicKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteSshPublicKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteSshPublicKey with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IDeleteSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteSshPublicKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteSshPublicKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getLoginProfile', () => { + it('invokes getLoginProfile without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getLoginProfile = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getLoginProfile(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getLoginProfile with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IGetLoginProfileRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getLoginProfile = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getLoginProfile(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getSshPublicKey', () => { + it('invokes getSshPublicKey without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getSshPublicKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getSshPublicKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getSshPublicKey with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IGetSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getSshPublicKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getSshPublicKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('importSshPublicKey', () => { + it('invokes importSshPublicKey without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importSshPublicKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.importSshPublicKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes importSshPublicKey with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IImportSshPublicKeyRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importSshPublicKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.importSshPublicKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateSshPublicKey', () => { + it('invokes updateSshPublicKey without error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateSshPublicKey = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateSshPublicKey(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateSshPublicKey with error', done => { + const client = new osloginserviceModule.v1.OsLoginServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.oslogin.v1.IUpdateSshPublicKeyRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateSshPublicKey = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateSshPublicKey(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); +});