Cloud OS Login V1beta API - Class Google::Cloud::OsLogin::V1beta::OsLoginService::Client (v0.6.0)

Reference documentation and code samples for the Cloud OS Login V1beta API class Google::Cloud::OsLogin::V1beta::OsLoginService::Client.

Client for the OsLoginService service.

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.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the OsLoginService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all OsLoginService clients
::Google::Cloud::OsLogin::V1beta::OsLoginService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the OsLoginService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_ssh_public_key

def create_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
def create_ssh_public_key(parent: nil, ssh_public_key: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey

Create an SSH public key

Overloads
def create_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to create_ssh_public_key via a request object, either of type CreateSshPublicKeyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::CreateSshPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_ssh_public_key(parent: nil, ssh_public_key: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to create_ssh_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::CreateSshPublicKeyRequest.new

# Call the create_ssh_public_key method.
result = client.create_ssh_public_key request

# The returned object is of type Google::Cloud::OsLogin::Common::SshPublicKey.
p result

#delete_posix_account

def delete_posix_account(request, options = nil) -> ::Google::Protobuf::Empty
def delete_posix_account(name: nil) -> ::Google::Protobuf::Empty

Deletes a POSIX account.

Overloads
def delete_posix_account(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_posix_account via a request object, either of type DeletePosixAccountRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::DeletePosixAccountRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_posix_account(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_posix_account via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::DeletePosixAccountRequest.new

# Call the delete_posix_account method.
result = client.delete_posix_account request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_ssh_public_key

def delete_ssh_public_key(request, options = nil) -> ::Google::Protobuf::Empty
def delete_ssh_public_key(name: nil) -> ::Google::Protobuf::Empty

Deletes an SSH public key.

Overloads
def delete_ssh_public_key(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_ssh_public_key via a request object, either of type DeleteSshPublicKeyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::DeleteSshPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_ssh_public_key(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_ssh_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::DeleteSshPublicKeyRequest.new

# Call the delete_ssh_public_key method.
result = client.delete_ssh_public_key request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_login_profile

def get_login_profile(request, options = nil) -> ::Google::Cloud::OsLogin::V1beta::LoginProfile
def get_login_profile(name: nil, project_id: nil, system_id: nil, view: nil) -> ::Google::Cloud::OsLogin::V1beta::LoginProfile

Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.

Overloads
def get_login_profile(request, options = nil) -> ::Google::Cloud::OsLogin::V1beta::LoginProfile
Pass arguments to get_login_profile via a request object, either of type GetLoginProfileRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::GetLoginProfileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_login_profile(name: nil, project_id: nil, system_id: nil, view: nil) -> ::Google::Cloud::OsLogin::V1beta::LoginProfile
Pass arguments to get_login_profile via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The unique ID for the user in format users/{user}.
  • project_id (::String) — The project ID of the Google Cloud Platform project.
  • system_id (::String) — A system ID for filtering the results of the request.
  • view (::Google::Cloud::OsLogin::V1beta::LoginProfileView) — The view configures whether to retrieve security keys information.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::GetLoginProfileRequest.new

# Call the get_login_profile method.
result = client.get_login_profile request

# The returned object is of type Google::Cloud::OsLogin::V1beta::LoginProfile.
p result

#get_ssh_public_key

def get_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
def get_ssh_public_key(name: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey

Retrieves an SSH public key.

Overloads
def get_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to get_ssh_public_key via a request object, either of type GetSshPublicKeyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::GetSshPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_ssh_public_key(name: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to get_ssh_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::GetSshPublicKeyRequest.new

# Call the get_ssh_public_key method.
result = client.get_ssh_public_key request

# The returned object is of type Google::Cloud::OsLogin::Common::SshPublicKey.
p result

#import_ssh_public_key

def import_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse
def import_ssh_public_key(parent: nil, ssh_public_key: nil, project_id: nil, view: nil) -> ::Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse

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.

Overloads
def import_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse
Pass arguments to import_ssh_public_key via a request object, either of type ImportSshPublicKeyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_ssh_public_key(parent: nil, ssh_public_key: nil, project_id: nil, view: nil) -> ::Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse
Pass arguments to import_ssh_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyRequest.new

# Call the import_ssh_public_key method.
result = client.import_ssh_public_key request

# The returned object is of type Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new OsLoginService client object.

Yields
  • (config) — Configure the OsLoginService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new do |config|
  config.timeout = 10.0
end

#update_ssh_public_key

def update_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
def update_ssh_public_key(name: nil, ssh_public_key: nil, update_mask: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey

Updates an SSH public key and returns the profile information. This method supports patch semantics.

Overloads
def update_ssh_public_key(request, options = nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to update_ssh_public_key via a request object, either of type UpdateSshPublicKeyRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsLogin::V1beta::UpdateSshPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_ssh_public_key(name: nil, ssh_public_key: nil, update_mask: nil) -> ::Google::Cloud::OsLogin::Common::SshPublicKey
Pass arguments to update_ssh_public_key via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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}.
  • ssh_public_key (::Google::Cloud::OsLogin::Common::SshPublicKey, ::Hash) — Required. The SSH public key and expiration time.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Mask to control which fields get updated. Updates all if not present.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_login/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::OsLogin::V1beta::OsLoginService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsLogin::V1beta::UpdateSshPublicKeyRequest.new

# Call the update_ssh_public_key method.
result = client.update_ssh_public_key request

# The returned object is of type Google::Cloud::OsLogin::Common::SshPublicKey.
p result