OpsBeacon python client library to interact with the OpsBeacon API
Project description
OpsBeacon Python Client
Installation
To install the OpsBeacon Python client, you can use pip:
pip install opsbeacon-client
Usage
To use the OpsBeacon client, you need to have your API domain and API token. You can obtain these from the OpsBeacon dashboard.
from opsbeacon_client import OpsBeaconClient
client = OpsBeaconClient(api_domain="your-api-domain.opsbeacon.com", api_token="your-api-token")
# Fetch a list of commands
commands = client.commands()
print(commands)
# Fetch a list of connections
connections = client.connections()
print(connections)
# Fetch a list of users
users = client.users()
print(users)
# Add a new user
new_user = {
"name": "John Doe",
"email": "john.doe@example.com"
}
client.add_user(new_user)
# Delete a user
client.delete_user("user-id")
# Fetch a list of groups
groups = client.groups()
print(groups)
# Add a new group
new_group = {
"name": "Admin Group",
"description": "Group for admin users"
}
client.add_group(new_group)
# Delete a group
client.delete_group("admin-group")
# Upload a file
client.file_upload(file_content="some,csv,data", file_name="example.csv")
# Download a file
client.file_download("example.csv", "downloaded_file.csv")
# Execute a command
result = client.run(command="restart-server", connection="server-connection", args="--force")
print(result)
API Reference
The OpsBeacon Python client provides the following methods:
commands(): Fetch a list of available commands in the workspace.connections(): Retrieve a list of connections in the workspace.users(): Fetch a list of users in the workspace.add_user(user: Dict[str, Any]): Add a new user to the workspace.delete_user(user_id: str): Delete a user from the workspace by user ID.groups(): Fetch a list of groups defined in the workspace.add_group(group: Dict[str, Any]): Add a new group to the workspace.delete_group(group_name: str): Delete a group from the workspace by group name.file_upload(file_content: str = None, file_name: str = None, input_file: str = None): Upload a file to the OpsBeacon workspace.get_file_download_url(file_id: str): Get a download URL for a specified file.file_download(file_name: str, destination_path: str = None): Download a file from OpsBeacon and save it to the specified destination.run(command_text: str = "", connection: str = "", command: str = "", args: str = ""): Execute a command in the OpsBeacon workspace.
Please refer to the docstrings in the code for more detailed information about each method.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opsbeacon-1.0.0.tar.gz.
File metadata
- Download URL: opsbeacon-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f03ffe55a7b11ca3347b4ff14083ea3439e82cec08b2826a0a0c296d8df1c50
|
|
| MD5 |
e16a7f45ba31180ca5d147baf514604f
|
|
| BLAKE2b-256 |
e362e94f0a5d662b6fa391f2a5ff2424c01adb86cf33a6fccf4fb6a6de8741b6
|
File details
Details for the file opsbeacon-1.0.0-py3-none-any.whl.
File metadata
- Download URL: opsbeacon-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab5319e833025657b0436eec909464f1c530a3b02dfaf616672c3cb0a77ba277
|
|
| MD5 |
fad4c0ec4396da82289c84188c7ed878
|
|
| BLAKE2b-256 |
956e4da2cd2cf289ec8f5396d2d146ade6fbc1dc435692c29fbfe8ee271e3bc9
|