Skip to main content

Cacholong CLI, manage cloud environments at Cacholong!

Project description

CLI frontend

The API client library for managing various resources.

Client Library Documentation

Getting started

To install this package you need to take a few steps before this works correctly

  1. Create an virtual environment: python3 -m venv
  2. Activate the environment: /bin/activate
  3. Now install the package: pip install cacholong-cloud-cli
  4. Or upgrade the package: pip install cacholong-cloud-cli --upgrade

Now you can use the command ccloud on the system. Please note, make sure to activate the virtual environment before running the command ccloud.

You will need an API-token. This token can be created using our panel at https://cp.cacholong.eu/#/user/settings/api. You can create an api token within your profile under API.

When running the command ccloud for the first time it will ask you for an API-token.

After that you will be able to run the following command:

ccloud accounts list

This will give you an overview of accounts where you have access to.

Usage

Overview of the possibilities:

ccloud --help

To fetch an overview of the dns-zones for an account:

ccloud dns-zones list --account <account uuid>

Creating a DNS-record:

ccloud dns-records create --dns-zone <dns-zone uuid> \
    --name localhost.example.com \
    --dns-record-type A \
    --content 127.0.0.1 \
    --ttl 300

Updating a DNS-record:

ccloud dns-records update <dns-record uuid> \
    --content 127.0.0.1

Deleting a DNS-record:

ccloud dns-records delete <dns-record uuid>

Every command includes an option --help which will give an overview of the possibilities.

Advanced usage

Its also possible to create your own command line utility to handle various parts. Here are the same examples as above but now using python.

Fetching DNS-zones

import asyncio

from cacholong_sdk.connection import connection
from cacholong_sdk import ResourceTuple, Inclusion, Filter
from cacholong_sdk import DnsZone, DnsZoneModel, DnsRecord, DnsRecordModel

async def main():
    async with connection('https://api.cacholong.eu/api/v1/', 'YOUR-API-TOKEN') as api:
        searchfilter = Filter(account="UUID_OF_ACCOUNT")
        DnsZoneCtrl = DnsZone(api)
        async for zone in DnsZoneCtrl.fetch_all(searchfilter):
            print(zone["domain"])

# Execute main function
asyncio.run(main())

Create a DNS-record

import asyncio

from cacholong_sdk.connection import connection
from cacholong_sdk import ResourceTuple, Inclusion, Filter
from cacholong_sdk import DnsZone, DnsZoneModel, DnsRecord, DnsRecordModel

async def main():
    async with connection('https://api.cacholong.eu/api/v1/', 'YOUR-API-TOKEN') as api:
        DnsRecordCtrl = DnsRecord(api)

        dns_record = DNSRecordCtrl.create()
        dns_record["dns-zone"] = ResourceTuple("UUID_DNS_ZONE", "dns-zones")
        dns_record["name"] = "localhost.example.nl"
        dns_record["dns_record_type"] = "A"
        dns_record["content"] = "127.0.0.1"
        dns_record["ttl"] = 300
        await DNSRecordCtrl.store(dns_record)

# Execute main function
asyncio.run(main())

Update a DNS-record

import asyncio

from cacholong_sdk.connection import connection
from cacholong_sdk import ResourceTuple, Inclusion, Filter
from cacholong_sdk import DnsZone, DnsZoneModel, DnsRecord, DnsRecordModel

async def main():
    async with connection('https://api.cacholong.eu/api/v1/', 'YOUR-API-TOKEN') as api:
        DnsRecordCtrl = DnsRecord(api)

        dns_record = await DnsRecordCtrl.fetch("UUID_OF_DNS_RECORD")
        dns_record["content"] = "127.0.0.1"

        # Be careful: the above change will be applied automatically

# Execute main function
asyncio.run(main())

Delete a DNS-record

import asyncio

from cacholong_sdk.connection import connection
from cacholong_sdk import ResourceTuple, Inclusion, Filter
from cacholong_sdk import DnsZone, DnsZoneModel, DnsRecord, DnsRecordModel

async def main():
    async with connection('https://api.cacholong.eu/api/v1/', 'YOUR-API-TOKEN') as api:
        DnsRecordCtrl = DnsRecord(api)

        await DnsRecordCtrl.destroy("UUID_OF_DNS_RECORD")

# Execute main function
asyncio.run(main())

Support

Questions, feedback, or suggestions? Send us an email at [ccloud-support@cacholong.nl].

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

cacholong_cloud_cli-1.1.0.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

cacholong_cloud_cli-1.1.0-py3-none-any.whl (86.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cacholong_cloud_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.13 Linux/6.1.0-42-amd64

File hashes

Hashes for cacholong_cloud_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4ded58290e0cb2084a977c8863c40fd8a283c00124e59fe5674a244dd5b317e3
MD5 c6522905ef1f560a930e412001eb85c7
BLAKE2b-256 f7b20a67b04a138161feb1d6159f6e9c0e467a0b58d1709e3bf7fb310a272279

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cacholong_cloud_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 86.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.13 Linux/6.1.0-42-amd64

File hashes

Hashes for cacholong_cloud_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 014dc8c29c8833ca09c58504982ee4b1865885d89e22e58fb1d0a32bcec15d79
MD5 2c0a25d804e766cce90f5afac11307c7
BLAKE2b-256 9dcba71bcb3d605463ab77f55c54f981952e11ee84b9073e3ceca55d8462c9d2

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