systemlink.clients.core¶
- class systemlink.clients.core.ApiError[source]¶
Represents the standard error structure for SystemLink API responses.
- property args: List[str]¶
The list of positional arguments formatted into the error.
- Return type
List
[str
]
- property code: Optional[int]¶
The numeric code associated with the error.
- Return type
Optional
[int
]
- property message: Optional[str]¶
The error message.
- Return type
Optional
[str
]
- property name: Optional[str]¶
The name of the error.
- Return type
Optional
[str
]
- property resource_id: Optional[str]¶
The ID of the resource associated with the error, if any.
Set
resource_type
when setting this property.- Return type
Optional
[str
]
- property resource_type: Optional[str]¶
The type of resource associated with the error, if any.
Set this when setting
resource_id
.- Return type
Optional
[str
]
- exception systemlink.clients.core.ApiException(message=None, error=None, http_status_code=None, inner=None)[source]¶
Represents errors that occur when calling SystemLink APIs.
- __init__(message=None, error=None, http_status_code=None, inner=None)[source]¶
Initialize an exception.
- Parameters
message (
Optional
[str
]) – The message describing the error.error (
Optional
[ApiError
]) – The error returned by the API.http_status_code (
Optional
[int
]) – The HTTP status code, if this exception was the result of an HTTP error.inner (
Optional
[Exception
]) – The inner exception that caused the error.
- property error: Optional[ApiError]¶
The error information returned by the SystemLink API, or None if the API did not return one or the error occurred trying to call the API.
- Return type
Optional
[ApiError
]
- property http_status_code: Optional[int]¶
The HTTP status code, if this exception was the result of an HTTP error.
- Return type
Optional
[int
]
- property inner_exception: Optional[Exception]¶
The exception that caused this failure, if any.
- Return type
Optional
[Exception
]
- property message: Optional[str]¶
The error message.
- Return type
Optional
[str
]
- with_traceback()¶
Exception.with_traceback(tb) – set self.to tb and return self.
- class systemlink.clients.core.CloudHttpConfiguration(api_key)[source]¶
An
HttpConfiguration
specifically for use with SystemLink Cloud.- DEFAULT_TIMEOUT_MILLISECONDS = 60000¶
The default value of
timeout_milliseconds
to use when making API calls.
- __init__(api_key)[source]¶
Initialize a configuration for SystemLink Cloud using API key-based authentication.
- Parameters
api_key (
str
) – The API key to send with requests.- Raises
ValueError – if
api_key
is empty.
- property api_keys: Optional[Dict[str, str]]¶
The available API keys to use for authorization, or None if none were provided.
- Return type
Optional
[Dict
[str
,str
]]
- property cert_path: Optional[Path]¶
Local path to an SSL certificate file.
- Return type
Optional
[pathlib.Path
]
- property password: Optional[str]¶
The password to use for HTTP authentication, or None if none was provided.
- Return type
Optional
[str
]
- property server_uri: str¶
The
urllib.parse.urlparse().scheme
,urllib.parse.urlparse().hostname
, andurllib.parse.urlparse().port
of the web server hosting the SystemLink service to connect to.Additional Uri properties such as
urllib.parse.urlparse().path
andurllib.parse.urlparse().query
are ignored.- Return type
str
- property timeout_milliseconds: int¶
The number of milliseconds before a request times out with an error.
Changing the timeout will not affect APIs that have already read the configuration.
- Return type
int
- property user_agent: Optional[str]¶
The string to pass the web server as the product name or names making the request, or None to use a library-specific default.
Changing the user-agent will not affect APIs that have already read the configuration.
- Return type
Optional
[str
]
- property username: Optional[str]¶
The username to use for HTTP authentication, or None if none was provided.
- Return type
Optional
[str
]
- class systemlink.clients.core.HttpConfiguration(server_uri, api_key=None, username=None, password=None, cert_path=None)[source]¶
Represents the configuration for accessing a SystemLink service over HTTP.
- DEFAULT_TIMEOUT_MILLISECONDS = 60000¶
The default value of
timeout_milliseconds
to use when making API calls.
- __init__(server_uri, api_key=None, username=None, password=None, cert_path=None)[source]¶
Initialize a configuration.
If neither
api_key
norusername
andpassword
are set, the configuration will use anonymous access, and any API calls that require authorization will fail.- Parameters
server_uri (
str
) – The scheme, host, and port (if not default) of the web server hosting the SystemLink service to connect to. Additional Uri properties such asurllib.parse.urlparse().path
andurllib.parse.urlparse().query
are ignored.api_key (
Optional
[str
]) – The API key to send with requests.username (
Optional
[str
]) – The name of the user to use when authorization is required.password (
Optional
[str
]) – The user’s password to use when authorization is required.cert_path (
Optional
[pathlib.Path
]) – Local path to an SSL certificate file.
- Raises
ValueError – if
server_uri
is missing scheme or host information.ValueError – if
username
orpassword
is set, but not both.
- property api_keys: Optional[Dict[str, str]]¶
The available API keys to use for authorization, or None if none were provided.
- Return type
Optional
[Dict
[str
,str
]]
- property cert_path: Optional[Path]¶
Local path to an SSL certificate file.
- Return type
Optional
[pathlib.Path
]
- property password: Optional[str]¶
The password to use for HTTP authentication, or None if none was provided.
- Return type
Optional
[str
]
- property server_uri: str¶
The
urllib.parse.urlparse().scheme
,urllib.parse.urlparse().hostname
, andurllib.parse.urlparse().port
of the web server hosting the SystemLink service to connect to.Additional Uri properties such as
urllib.parse.urlparse().path
andurllib.parse.urlparse().query
are ignored.- Return type
str
- property timeout_milliseconds: int¶
The number of milliseconds before a request times out with an error.
Changing the timeout will not affect APIs that have already read the configuration.
- Return type
int
- property user_agent: Optional[str]¶
The string to pass the web server as the product name or names making the request, or None to use a library-specific default.
Changing the user-agent will not affect APIs that have already read the configuration.
- Return type
Optional
[str
]
- property username: Optional[str]¶
The username to use for HTTP authentication, or None if none was provided.
- Return type
Optional
[str
]
- class systemlink.clients.core.HttpConfigurationManager[source]¶
Factory for
HttpConfiguration
objects.- HTTP_LOCALHOST_CONFIGURATION_ID = 'SYSTEMLINK_LOCALHOST'¶
The default ID of the SystemLink Server’s configuration on the SystemLink Server itself.
- HTTP_MASTER_CONFIGURATION_ID = 'SYSTEMLINK_MASTER'¶
The default ID of the SystemLink Server’s configuration on systems registered using SystemLink Client.
- classmethod get_configuration(id=None, enable_fallbacks=True)[source]¶
Get the requested or default configuration.
- Parameters
id (
Optional
[str
]) – The ID of the configuration to find.enable_fallbacks (
Optional
[bool
]) – Whether or not to fallback to other known configurations, ifid
is unavailable.
- Return type
- Returns
The configuration.
- Raises
ValueError – if
id
is None andenable_fallbacks
is False.ApiException – if the specified (or default) configuration is not found.