Class OsLoginServiceClient (0.3.2)

OsLoginServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

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.

Methods

OsLoginServiceClient

OsLoginServiceClient(
    transport=None,
    channel=None,
    credentials=None,
    client_config=None,
    client_info=None,
    client_options=None,
)

Constructor.

Parameters
NameDescription
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

credentials google.auth.credentials.Credentials

The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

client_config dict

DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

client_options Union[dict, google.api_core.client_options.ClientOptions]

Client options used to set user options on the client. API Endpoint should be set through client_options.

delete_posix_account

delete_posix_account(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes a POSIX account.

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

name = client.posix_account_path('[USER]', '[PROJECT]')

client.delete_posix_account(name)

Parameters
NameDescription
name str

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}.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

delete_ssh_public_key

delete_ssh_public_key(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Deletes an SSH public key.

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

name = client.ssh_public_key_path('[USER]', '[FINGERPRINT]')

client.delete_ssh_public_key(name)

Parameters
NameDescription
name str

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}.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

from_service_account_file

from_service_account_file(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
OsLoginServiceClientThe constructed client.

from_service_account_json

from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
OsLoginServiceClientThe constructed client.

get_login_profile

get_login_profile(name, project_id=None, system_id=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

name = client.user_path('[USER]')

response = client.get_login_profile(name)

Parameters
NameDescription
name str

Required. The unique ID for the user in format users/{user}.

project_id str

The project ID of the Google Cloud Platform project.

system_id str

A system ID for filtering the results of the request.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

get_ssh_public_key

get_ssh_public_key(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

Retrieves an SSH public key.

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

name = client.ssh_public_key_path('[USER]', '[FINGERPRINT]')

response = client.get_ssh_public_key(name)

Parameters
NameDescription
name str

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}.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

import_ssh_public_key

import_ssh_public_key(parent, ssh_public_key=None, project_id=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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.

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

parent = client.user_path('[USER]')

response = client.import_ssh_public_key(parent)

Parameters
NameDescription
parent str

Required. The unique ID for the user in format users/{user}.

ssh_public_key Union[dict, SshPublicKey]

Optional. The SSH public key and expiration time. If a dict is provided, it must be of the same form as the protobuf message SshPublicKey

project_id str

The project ID of the Google Cloud Platform project.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

posix_account_path

posix_account_path(user, project)

Return a fully-qualified posix_account string.

ssh_public_key_path

ssh_public_key_path(user, fingerprint)

Return a fully-qualified ssh_public_key string.

update_ssh_public_key

update_ssh_public_key(name, ssh_public_key, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)

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

.. rubric:: Example

from google.cloud import oslogin_v1

client = oslogin_v1.OsLoginServiceClient()

name = client.ssh_public_key_path('[USER]', '[FINGERPRINT]')

TODO: Initialize ssh_public_key:

ssh_public_key = {}

response = client.update_ssh_public_key(name, ssh_public_key)

Parameters
NameDescription
name str

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 Union[dict, SshPublicKey]

Required. The SSH public key and expiration time. If a dict is provided, it must be of the same form as the protobuf message SshPublicKey

update_mask Union[dict, FieldMask]

Mask to control which fields get updated. Updates all if not present. If a dict is provided, it must be of the same form as the protobuf message FieldMask

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

user_path

user_path(user)

Return a fully-qualified user string.