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.
Inheritance
builtins.object > google.cloud.oslogin_v1.gapic.os_login_service_client.OsLoginServiceClient > OsLoginServiceClientMethods
OsLoginServiceClient
OsLoginServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
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 |
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 |
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=<object object>, timeout=<object object>, metadata=None)
Deletes a POSIX account.
.. rubric:: Example
from google.cloud import oslogin_v1
client = oslogin_v1.OsLoginServiceClient()
name = client.project_path('[USER]', '[PROJECT]')
client.delete_posix_account(name)
Name | Description |
name |
str
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_ssh_public_key
delete_ssh_public_key(name, retry=<object object>, timeout=<object object>, metadata=None)
Deletes an SSH public key.
.. rubric:: Example
from google.cloud import oslogin_v1
client = oslogin_v1.OsLoginServiceClient()
name = client.fingerprint_path('[USER]', '[FINGERPRINT]')
client.delete_ssh_public_key(name)
Name | Description |
name |
str
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
fingerprint_path
fingerprint_path(user, fingerprint)
Return a fully-qualified fingerprint string.
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
OsLoginServiceClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
OsLoginServiceClient | The constructed client. |
get_login_profile
get_login_profile(name, retry=<object object>, timeout=<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)
Name | Description |
name |
str
The unique ID for the user in format |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_ssh_public_key
get_ssh_public_key(name, retry=<object object>, timeout=<object object>, metadata=None)
Retrieves an SSH public key.
.. rubric:: Example
from google.cloud import oslogin_v1
client = oslogin_v1.OsLoginServiceClient()
name = client.fingerprint_path('[USER]', '[FINGERPRINT]')
response = client.get_ssh_public_key(name)
Name | Description |
name |
str
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
import_ssh_public_key
import_ssh_public_key(parent, ssh_public_key, project_id=None, retry=<object object>, timeout=<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]')
TODO: Initialize
ssh_public_key
:ssh_public_key = {}
response = client.import_ssh_public_key(parent, ssh_public_key)
Name | Description |
parent |
str
The unique ID for the user in format |
ssh_public_key |
Union[dict, SshPublicKey]
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 |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
project_path
project_path(user, project)
Return a fully-qualified project string.
update_ssh_public_key
update_ssh_public_key(name, ssh_public_key, update_mask=None, retry=<object object>, timeout=<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.fingerprint_path('[USER]', '[FINGERPRINT]')
TODO: Initialize
ssh_public_key
:ssh_public_key = {}
response = client.update_ssh_public_key(name, ssh_public_key)
Name | Description |
name |
str
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 |
ssh_public_key |
Union[dict, SshPublicKey]
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 |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
user_path
user_path(user)
Return a fully-qualified user string.