Skip to main content

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 with string arguments (backward compatibility)
result = client.run(command="restart-server", connection="server-connection", args="--force")
print(result)

# Execute a command with array arguments (recommended)
result = client.run(command="restart-server", connection="server-connection", args=["--force", "--timeout", "30"])
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: Union[List[str], str] = ""): Execute a command in the OpsBeacon workspace. The args parameter can be either a list of strings or a space-separated string.

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

opsbeacon-1.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opsbeacon-1.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file opsbeacon-1.1.0.tar.gz.

File metadata

  • Download URL: opsbeacon-1.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.3

File hashes

Hashes for opsbeacon-1.1.0.tar.gz
Algorithm Hash digest
SHA256 83adf1d9962fb43b0c54c3427dfb3be57634019bcb62e363e89e1659b8b163f9
MD5 410cb939262ed4d39bbe9c73887606c7
BLAKE2b-256 8e6605e337a83d45b8c1951a69f56c3e2106ca9c3cd66644b6ec06f204933048

See more details on using hashes here.

File details

Details for the file opsbeacon-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: opsbeacon-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.3

File hashes

Hashes for opsbeacon-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e7dc5a038d27ca647019057f9e7399ac478d2e6b8311ebf272198a764394f4a
MD5 cd4dd40590cb3f1afc2069560fed51e8
BLAKE2b-256 ffb68fadcfedf1867463ef71086c74fa9c0a4dbb6c0e5d01cd05187bacd8fadc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page