### Setup and Run Gridscale Python Client Tests Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Instructions for setting up a Python virtual environment, installing dependencies from 'dev-requirements.txt', and running tests using pytest. This ensures the client library functions correctly. ```shell python -m venv .venv source .venv/bin/activate python -m pip install -r dev-requirements.txt pytest ``` -------------------------------- ### Install gridscale API Client Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Installs the gridscale API client library using pip. This is a prerequisite for using the Python wrapper to manage gridscale resources. ```shell pip3 install gs_api_client ``` -------------------------------- ### Python API Client Basic Server Operations Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Provides examples of basic server management operations using the gridscale Python API client. It demonstrates how to retrieve all servers, create a new server with specified configurations, update an existing server's details, and delete a server. ```python from pprint import pprint # Get all servers pprint(async_api.get_servers()) # Create a server pprint(async_api.create_server({'name':'test', 'cores': 1, 'memory': 2})) # Update a server pprint(async_api.update_server('', { 'name':'windows production Server', 'cores': 2, 'memory': 4 })) # Delete a server pprint(client.delete_storage('')) ``` -------------------------------- ### Manage Gridscale Templates with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Provides functions to retrieve, create, update, and delete templates in the Gridscale environment. Also includes functionality to get template events and deleted templates. ```python client.templates.get_templates() client.templates.get_template(template_id) client.templates.create_template(data) client.templates.update_template(template_id, data) client.templates.delete_template(template_id) client.templates.get_template_events(template_id) client.templates.get_deleted_templates() ``` -------------------------------- ### Python API Client Authentication and Initialization Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Demonstrates how to set up authentication credentials (API token and user UUID) and initialize both synchronous and asynchronous clients for the gridscale API. It shows the necessary imports and configuration steps. ```python from gs_api_client import Configuration from gs_api_client import SyncGridscaleApiClient, GridscaleApiClient # Initiate the configuration config = Configuration() config.api_key['X-Auth-Token'] = "AUTH_TOKEN" config.api_key['X-Auth-UserId'] = "USER_UUID" # Setup the client sync_api = SyncGridscaleApiClient(configuration=config) async_api = GridscaleApiClient(configuration=config) ``` -------------------------------- ### Manage Gridscale Marketplace Applications with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Enables management of marketplace applications, including retrieval, creation, updates, deletion, and event fetching. This allows users to interact with applications available in the Gridscale marketplace. ```python client.marketplace_applications.get_marketplace_applications() client.marketplace_applications.get_marketplace_application(app_id) client.marketplace_applications.create_marketplace_application(data) client.marketplace_applications.update_marketplace_application(app_id, data) client.marketplace_applications.delete_marketplace_application(app_id) client.marketplace_applications.get_marketplace_application_events(app_id) ``` -------------------------------- ### Manage Gridscale ISO Images with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Provides functionality to manage ISO images, including CRUD operations, retrieving events, and accessing records of deleted ISO images. This is useful for managing bootable media. ```python client.isoimages.get_isoimages() client.isoimages.get_isoimage(iso_id) client.isoimages.create_isoimage(data) client.isoimages.update_isoimage(iso_id, data) client.isoimages.delete_isoimage(iso_id) client.isoimages.get_isoimage_events(iso_id) client.isoimages.get_deleted_isoimages() ``` -------------------------------- ### Manage Gridscale PaaS Services with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Comprehensive management for Platform as a Service (PaaS) offerings, including service operations, credential renewal, metrics retrieval, and security zone management. It also covers PaaS service templates and deleted services. ```python client.paas.get_paas_services() client.paas.get_paas_service(service_id) client.paas.create_paas_service(data) client.paas.update_paas_service(service_id, data) client.paas.delete_paas_service(service_id) client.paas.renew_paas_service_credentials(service_id) client.paas.get_paas_service_metrics(service_id) client.paas.get_paas_security_zones(service_id) client.paas.get_paas_security_zone(zone_id) client.paas.create_paas_security_zone(service_id, data) client.paas.update_paas_security_zone(zone_id, data) client.paas.delete_paas_security_zone(zone_id) client.paas.get_paas_service_templates(service_id) client.paas.get_deleted_paas_services() ``` -------------------------------- ### Manage Gridscale Object Storage with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md APIs for managing object storage, including retrieving buckets and access keys, and creating/deleting access keys. Essential for data storage operations. ```python client.object_storage.get_buckets() client.object_storage.get_access_keys() client.object_storage.get_access_key(key_id) client.object_storage.create_access_key(data) client.object_storage.delete_access_key(key_id) ``` -------------------------------- ### Manage Gridscale Certificates with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Functions for managing SSL/TLS certificates, including retrieval, creation, and deletion. This is vital for securing network communications. ```python client.certificates.get_certificates() client.certificates.create_certificate(data) client.certificates.get_certificate(cert_id) client.certificates.delete_certificate(cert_id) ``` -------------------------------- ### Manage Gridscale Firewalls with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md API functions for managing firewall rules, including creation, retrieval, updates, deletion, and fetching associated events. This allows for granular control over network traffic. ```python client.firewalls.get_firewalls() client.firewalls.get_firewall(firewall_id) client.firewalls.create_firewall(data) client.firewalls.update_firewall(firewall_id, data) client.firewalls.delete_firewall(firewall_id) client.firewalls.get_firewall_events(firewall_id) ``` -------------------------------- ### Retrieve Gridscale Usage Statistics with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Endpoints to fetch usage statistics at both the project and contract levels for various resources including servers, storage, snapshots, and more. This helps in monitoring resource consumption. ```python client.usages.project_level_usage_get() client.usages.project_level_server_usage_get() client.usages.project_level_distributed_storage_usage_get() client.usages.project_level_rocket_storage_usage_get() client.usages.project_level_storage_backup_usage_get() client.usages.project_level_snapshot_usage_get() client.usages.project_level_template_usage_get() client.usages.project_level_isoimage_usage_get() client.usages.project_level_ip_usage_get() client.usages.project_level_loadbalancer_usage_get() client.usages.project_level_paas_service_usage_get() client.usages.contract_level_usage_get() client.usages.contract_level_server_usage_get() client.usages.contract_level_distributed_storage_usage_get() client.usages.contract_level_rocket_storage_usage_get() client.usages.contract_level_storage_backup_usage_get() client.usages.contract_level_snapshot_usage_get() client.usages.contract_level_template_usage_get() client.usages.contract_level_isoimage_usage_get() client.usages.contract_level_ip_usage_get() client.usages.contract_level_loadbalancer_usage_get() client.usages.contract_level_paas_service_usage_get() ``` -------------------------------- ### Manage Gridscale Load Balancers with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Functions to manage load balancers, covering their lifecycle (create, read, update, delete) and event retrieval. It also allows access to records of deleted load balancers. ```python client.loadbalancers.get_loadbalancers() client.loadbalancers.get_loadbalancer(lb_id) client.loadbalancers.create_loadbalancer(data) client.loadbalancers.update_loadbalancer(lb_id, data) client.loadbalancers.delete_loadbalancer(lb_id) client.loadbalancers.get_loadbalancer_events(lb_id) client.loadbalancers.get_deleted_loadbalancers() ``` -------------------------------- ### Manage Gridscale SSH Keys with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Functions for managing SSH keys, including creation, retrieval, updates, deletion, and event fetching. This is crucial for secure server access. ```python client.ssh_keys.get_ssh_keys() client.ssh_keys.get_ssh_key(key_id) client.ssh_keys.create_ssh_key(data) client.ssh_keys.update_ssh_key(key_id, data) client.ssh_keys.delete_ssh_key(key_id) client.ssh_keys.get_ssh_key_events(key_id) ``` -------------------------------- ### Manage Gridscale Labels with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Simple API endpoints for retrieving labels associated with resources in Gridscale. This allows for categorization and organization of resources. ```python client.labels.get_labels() client.labels.get_label(label_id) ``` -------------------------------- ### Manage Gridscale Networks with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Functions for managing network resources, including CRUD operations, retrieving network events, and managing deleted networks. It also supports pinning servers to networks and updating/deleting these pinned associations. ```python client.networks.get_network(network_id) client.networks.get_networks() client.networks.create_network(data) client.networks.update_network(network_id, data) client.networks.delete_network(network_id) client.networks.get_network_events(network_id) client.networks.get_deleted_networks() client.networks.get_network_pinned_servers(network_id) client.networks.update_network_pinned_server(network_id, server_id, data) client.networks.delete_network_pinned_server(network_id, server_id) ``` -------------------------------- ### Retrieve Gridscale Events with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md An endpoint to retrieve all events across the Gridscale platform. This provides a centralized view of activity and changes. ```python client.events.event_get_all() ``` -------------------------------- ### Manage Gridscale IP Addresses with Python Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md API endpoints for managing IP addresses, including retrieval, creation, updates, deletion, and fetching associated events. Also provides access to deleted IP records. ```python client.ips.get_ips() client.ips.get_ip(ip_id) client.ips.create_ip(data) client.ips.update_ip(ip_id, data) client.ips.delete_ip(ip_id) client.ips.get_ip_events(ip_id) client.ips.get_deleted_ips() ``` -------------------------------- ### Python API Client Access Response Headers Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Configures the gridscale API clients to return detailed response information, including the response body, status code, and headers. This is useful for inspecting API call results and metadata. ```python sync_api = SyncGridscaleApiClient(http_info=True) async_api = GridscaleApiClient(http_info=True) ``` -------------------------------- ### Python API Client Debugging Source: https://github.com/gridscale/gridscale_api_client_python/blob/develop/README.md Enables debug mode for the gridscale API client. When enabled, it outputs additional information that can be helpful for troubleshooting API requests and responses. ```python config.debug = True ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.