Accountclient
AccountClient(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)
¶
Account client class for working with rucio accounts
Constructor of the BaseClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rucio_host
|
Optional[str]
|
The address of the rucio server, if None it is read from the config file. |
None
|
rucio_port
|
The port of the rucio server, if None it is read from the config file. |
required | |
auth_host
|
Optional[str]
|
The address of the rucio authentication server, if None it is read from the config file. |
None
|
auth_port
|
The port of the rucio authentication server, if None it is read from the config file. |
required | |
account
|
Optional[str]
|
The account to authenticate to rucio. |
None
|
use_ssl
|
Enable or disable ssl for commucation. Default is enabled. |
required | |
ca_cert
|
Optional[str]
|
The path to the rucio server certificate. |
None
|
auth_type
|
Optional[str]
|
The type of authentication (e.g.: 'userpass', 'kerberos' ...) |
None
|
creds
|
Optional[dict[str, Any]]
|
Dictionary with credentials needed for authentication. |
None
|
user_agent
|
Optional[str]
|
Indicates the client. |
'rucio-clients'
|
vo
|
Optional[str]
|
The VO to authenticate into. |
None
|
logger
|
Logger
|
Logger object to use. If None, use the default LOG created by the module |
LOG
|
add_account(account, type_, email)
¶
Sends the request to create a new account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
the name of the account. |
required |
type_
|
str
|
The account type |
required |
email
|
str
|
The Email address associated with the account. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if account was created successfully else False. |
Raises:
Type | Description |
---|---|
Duplicate
|
if account already exists. |
delete_account(account)
¶
Sends the request to disable an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
the name of the account. |
required |
Returns:
Type | Description |
---|---|
bool
|
True is account was disabled successfully. False otherwise. |
Raises:
Type | Description |
---|---|
AccountNotFound
|
if account doesn't exist. |
get_account(account)
¶
Sends the request to get information about a given account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
the name of the account. |
required |
Returns:
Type | Description |
---|---|
Optional[dict[str, Any]]
|
a list of attributes for the account. None if failure. |
Raises:
Type | Description |
---|---|
AccountNotFound
|
if account doesn't exist. |
update_account(account, key, value)
¶
Update a property of an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
Name of the account. |
required |
key
|
str
|
Account property like status. |
required |
value
|
Any
|
Property value. |
required |
list_accounts(account_type=None, identity=None, filters=None)
¶
Sends the request to list all rucio accounts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
The account type |
required | |
identity
|
Optional[str]
|
The identity key name. For example x509 DN, or a username. |
None
|
filters
|
Optional[dict[str, Any]]
|
A dictionary key:account attribute to use for the filtering |
None
|
Returns:
Type | Description |
---|---|
Iterator[dict[str, Any]]
|
a list containing account info dictionary for all rucio accounts. |
Raises:
Type | Description |
---|---|
AccountNotFound
|
if account doesn't exist. |
whoami()
¶
Get information about account whose token is used
Returns:
Type | Description |
---|---|
Optional[dict[str, Any]]
|
a list of attributes for the account. None if failure. |
Raises:
Type | Description |
---|---|
AccountNotFound
|
if account doesn't exist. |
add_identity(account, identity, authtype, email, default=False, password=None)
¶
Adds a membership association between identity and account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
identity
|
str
|
The identity key name. For example x509 DN, or a username. |
required |
authtype
|
str
|
The type of the authentication (x509, gss, userpass). |
required |
default
|
bool
|
If True, the account should be used by default with the provided identity. |
False
|
email
|
str
|
The Email address associated with the identity. |
required |
password
|
Optional[str]
|
Password if authtype is userpass. |
None
|
del_identity(account, identity, authtype)
¶
Delete an identity's membership association with an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
identity
|
str
|
The identity key name. For example x509 DN, or a username. |
required |
authtype
|
str
|
The type of the authentication (x509, gss, userpass). |
required |
default
|
If True, the account should be used by default with the provided identity. |
required |
list_identities(account)
¶
List all identities on an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
list_account_rules(account)
¶
List the associated rules of an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
get_account_limits(account, rse_expression, locality)
¶
Return the correct account limits for the given locality.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse_expression
|
str
|
Valid RSE expression |
required |
locality
|
str
|
The scope of the account limit. 'local' or 'global'. |
required |
get_global_account_limit(account, rse_expression)
¶
List the account limit for the specific RSE expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse_expression
|
str
|
The rse expression. |
required |
get_global_account_limits(account)
¶
List all RSE expression limits of this account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
get_local_account_limits(account)
¶
List the account rse limits of this account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
get_local_account_limit(account, rse)
¶
List the account rse limits of this account for the specific rse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse
|
str
|
The rse name. |
required |
get_local_account_usage(account, rse=None)
¶
List the account usage for one or all rses of this account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse
|
Optional[str]
|
The rse name. |
None
|
get_global_account_usage(account, rse_expression=None)
¶
List the account usage for one or all RSE expressions of this account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse_expression
|
Optional[str]
|
The rse expression. |
None
|
get_account_usage_history(account, rse)
¶
List the account usage history of this account on rse.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
rse
|
str
|
The rse name. |
required |
list_account_attributes(account)
¶
List the attributes for an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
add_account_attribute(account, key, value)
¶
Adds an attribute to an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
key
|
str
|
The attribute key. |
required |
value
|
Any
|
The attribute value. |
required |
delete_account_attribute(account, key)
¶
Delete an attribute for an account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account
|
str
|
The account name. |
required |
key
|
str
|
The attribute key. |
required |