Nothing has been indexed for 1.0.2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  lester:
    github: GrottoPress/lester
    version: ~> 1.0.2

Then run:

shards install

shard.yml

No shard.yml has been indexed for 1.0.2. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

Lester

Lester is a low-level API client for LXD. It features an intuitive interface that maps directly to the LXD API.

Usage Examples

  1. Create client:

    lxd = Lester.new(socket: "/var/snap/lxd/common/lxd/unix.socket")
    
    # OR:
    #
    # lxd = Lester.new(
    #   base_uri: "https://1.2.3.4:8443",
    #   private_key: "priv.key",
    #   certificate: "cert.pem",
    #   # ca_certificates: "ca.pem",
    #   # verify_mode: "none"
    # )
  2. Add new trusted certificate:

    lxd.certificates.add(
      certificate: "X509 PEM certificate...",
      name: "castiana",
      password: "secret",
      # ...
    ) do |response|
      return puts response.message unless response.success?
    
      puts response.type
      puts response.code
    end
  3. List all images:

    lxd.images.list(project: "default") do |response|
      return puts response.message unless response.success?
    
      response.metadata.try &.each do |image|
        puts image.architecture
        puts image.auto_update?
        puts image.cached?
        # ...
      end
    end
  4. Download instance backup:

    lxd.instances.backups.export(
      instance_name: "instance-04",
      name: "backup0",
      destination: "/home/user/Downloads/backup.zip"
    ) do |response|
      puts response.message
    end
  5. Add new storage pool:

    lxd.pools.create(
      project: "default",
      target: "lxd0",
      config: {"volume.block.filesystem": "ext4", "volume.size": "50GiB"},
      description: "Local SSD pool",
      driver: "zfs",
      name: "local",
      # ...
    ) do |response|
      return puts response.message unless response.success?
    
      puts response.type
      puts response.code
    end

Documentation

Find the complete documentation in the docs/ directory of this repository.

Development

  1. Create a .env.sh file:

    #!/bin/bash
    #
    
    export LXD_SOCKET='/var/snap/lxd/common/lxd/unix.socket'
    
    # Set these if you need to test against a remote LXD server
    export LXD_BASE_URI='https://1.2.3.4:8443'
    export LXD_TLS_KEY_PATH='priv.key'
    export LXD_TLS_CERT_PATH='cert.pem'
    export LXD_TLS_CA_PATH=''
    export LXD_TLS_VERIFY_MODE='none'

    Update the file with your own details.

  2. Run tests with source .env.sh && crystal spec.

Contributing

  1. Fork it
  2. Switch to the master branch: git checkout master
  3. Create your feature branch: git checkout -b my-new-feature
  4. Make your changes, updating changelog and documentation as appropriate.
  5. Commit your changes: git commit
  6. Push to the branch: git push origin my-new-feature
  7. Submit a new Pull Request against the GrottoPress:master branch.