Opendataclient
Classes¶
OpenDataClient ¶
OpenDataClient(
rucio_host=None,
auth_host=None,
account=None,
ca_cert=None,
auth_type=None,
creds=None,
timeout=600,
user_agent="rucio-clients",
vo=None,
logger=LOG,
)
Functions¶
get_opendata_host ¶
get_opendata_host(*, public)
Get the Opendata host URL for the public or private endpoint. The private opendata host is the regular rucio server, while the public opendata host can be configured separately (defaults to the same as the private one).
Parameters: public: If True, return the public Opendata host URL. If False, return the private Opendata host URL.
Returns: The Opendata host URL.
list_opendata_dids ¶
list_opendata_dids(*, state=None, public=False)
Return a list of Opendata DIDs, optionally filtered by state and access type.
Parameters: state: The state to filter DIDs by. If None, all states are included. public: If True, queries the public Opendata endpoint. Defaults to False.
Returns: A dictionary containing the list of Opendata DIDs.
Raises:
ValueError: If both state
and public=True
are provided.
Exception: If the request fails or the server returns an error.
add_opendata_did ¶
add_opendata_did(*, scope, name)
Adds an existing Rucio DID (Data Identifier) to the Opendata catalog.
Parameters: scope: The scope under which the DID is registered. name: The name of the DID.
Returns: True if the DID was successfully added to the Opendata catalog, otherwise raises an exception.
Raises: Exception: If the request fails or the server returns an error.
remove_opendata_did ¶
remove_opendata_did(*, scope, name)
Remove an existing Opendata DID from the Opendata catalog.
Parameters: scope: The scope under which the DID is registered. name: The name of the DID.
Returns: True if the DID was successfully removed, otherwise raises an exception.
Raises: Exception: If the request fails or the server returns an error.
update_opendata_did ¶
update_opendata_did(
*, scope, name, state=None, meta=None, doi=None
)
Update an existing Opendata DID in the Opendata catalog.
Parameters: scope: The scope under which the DID is registered. name: The name of the DID. state: The new state to set for the DID. meta: Metadata to update for the DID. Must be a valid JSON object. doi: DOI to associate with the DID. Must be a valid DOI string (e.g., "10.1234/foo.bar").
Returns: True if the update was successful.
Raises: ValueError: If none of 'meta', 'state', or 'doi' are provided. Exception: If the request fails or the server returns an error.
get_opendata_did ¶
get_opendata_did(
*,
scope,
name,
include_files=False,
include_metadata=False,
include_doi=True,
public=False
)
Retrieve information about an OpenData DID (Data Identifier).
Parameters: scope: The scope under which the DID is registered. name: The name of the DID. include_files: If True, include a list of associated files. Defaults to False. include_metadata: If True, include extended metadata. Defaults to False. include_doi: If True, include DOI (Digital Object Identifier) information. Defaults to True. public: If True, only return data if the DID is publicly accessible. Defaults to False.
Returns: A dictionary containing metadata about the specified DID. May include file list, extended metadata, and DOI details depending on the parameters.