Local Endpoints#

Unlike SDK functionality for accessing Globus APIs, the locally available Globus Endpoints require special treatment. These accesses are not authenticated via Globus Auth, and may rely upon the state of the local filesystem, running processes, and the permissions of local users.

Globus Connect Server#

class globus_sdk.LocalGlobusConnectServer(*, info_path='/var/lib/globus-connect-server/info.json')[source]#

A LocalGlobusConnectServer object represents the available SDK methods for inspecting and controlling a running Globus Connect Server installation.

These objects do not inherit from BaseClient and do not provide methods for interacting with any Globus Service APIs.

Parameters:

info_path (str | pathlib.Path) – The path to the info file used to inspect the local system

property info_dict: dict[str, Any] | None#

The info.json data for the local Globus Connect Server, as a dict.

If the info.json file is not present or cannot be parsed, the data is None. This indicates that there is no local Globus Connect Server node, or if there is one, it cannot be used or examined by the SDK. For example, containerized applications using the SDK may not be able to interact with Globus Connect Server on the container host.

property endpoint_id: str | None#

The endpoint ID of the local Globus Connect Server endpoint. None if the data cannot be loaded or is malformed.

property domain_name: str | None#

The domain name of the local Globus Connect Server endpoint. None if the data cannot be loaded or is malformed.

Globus Connect Personal#

Globus Connect Personal endpoints belonging to the current user may be accessed via instances of the following class:

class globus_sdk.LocalGlobusConnectPersonal(*, config_dir=None)[source]#

A LocalGlobusConnectPersonal object represents the available SDK methods for inspecting and controlling a running Globus Connect Personal installation.

These objects do not inherit from BaseClient and do not provide methods for interacting with any Globus Service APIs.

Parameters:

config_dir (str | None) – Path to a non-default configuration directory. On Linux, this is the same as the value passed to Globus Connect Personal’s -dir flag (i.e. the default value is ~/.globusonline).

property config_dir: str#

The config_dir for this endpoint.

If no directory was given during initialization, this will be computed based on the current platform and environment.

get_owner_info() globus_sdk.GlobusConnectPersonalOwnerInfo | None[source]#
get_owner_info(auth_client: None) globus_sdk.GlobusConnectPersonalOwnerInfo | None
get_owner_info(auth_client: globus_sdk.AuthClient) dict[str, Any] | None

Look up the local GCP information, returning a GlobusConnectPersonalOwnerInfo object. The result may have an id or username set (depending on the underlying data).

If you pass an AuthClient, this method will return a dict from the Get Identities API instead of the info object. This can fail (e.g. with network errors if there is no connectivity), so passing this value should be coupled with additional error handling.

In either case, the result may be None if the data is missing or cannot be parsed.

Note

The data returned by this method is not checked for accuracy. It is possible for a user to modify the files used by GCP to list a different user.

Parameters:

auth_client – An AuthClient to use to lookup the full identity information for the GCP owner

Examples

Getting a username:

>>> from globus_sdk import LocalGlobusConnectPersonal
>>> local_gcp = LocalGlobusConnectPersonal()
>>> local_gcp.get_owner_info()
GlobusConnectPersonalOwnerInfo(username='foo@globusid.org')

or you may get back an ID:

>>> local_gcp = LocalGlobusConnectPersonal()
>>> local_gcp.get_owner_info()
GlobusConnectPersonalOwnerInfo(id='7deda7cc-077b-11ec-a137-67523ecffd4b')

Check the result easily by looking to see if these values are None:

>>> local_gcp = LocalGlobusConnectPersonal()
>>> info = local_gcp.get_owner_info()
>>> has_username = info.username is not None
property endpoint_id: str | None#

The endpoint ID of the local Globus Connect Personal endpoint installation.

This value is loaded whenever it is first accessed, but saved after that.

Note

This attribute is not checked for accuracy. It is possible for a user to modify the files used by GCP to list a different endpoint_id.

Usage:

>>> from globus_sdk import TransferClient, LocalGlobusConnectPersonal
>>> local_ep = LocalGlobusConnectPersonal()
>>> ep_id = local_ep.endpoint_id
>>> tc = TransferClient(...)  # needs auth details
>>> for f in tc.operation_ls(ep_id):
>>>     print("Local file: ", f["name"])

You can also reset the value, causing it to load again on next access, with del local_ep.endpoint_id

class globus_sdk.GlobusConnectPersonalOwnerInfo(*, config_dn)[source]#

Information about the owner of the local Globus Connect Personal endpoint.

Users should never create these objects directly, but instead rely upon LocalGlobusConnectPersonal.get_owner_info().

The info object contains ether id or username. Parsing an info object from local data cannot guarantee that the id or username value will be found. Whichever one is present will be set and the other attribute will be None.

Variables:
  • id (str or None) – The Globus Auth ID of the endpoint owner

  • username (str or None) – The Globus Auth Username of the endpoint owner

Parameters:

config_dn (str) – A DN value from GCP configuration, which will be parsed into username or ID