posh-providers/digitalocean/doctl
2024-07-16 22:47:34 +02:00
..
cluster.go feat: add digitalocean/doctl 2023-11-23 13:44:20 +01:00
command.go feat: add digitalocean/doctl 2023-11-23 13:44:20 +01:00
config.go feat: add digitalocean/doctl 2023-11-23 13:44:20 +01:00
doctl.go feat(digitalocean/doctl): print folder 2024-07-16 22:47:34 +02:00
README.md docs: simplify docs 2023-12-05 14:10:17 +01:00

POSH doctl provider

Usage

Plugin

package main

type Plugin struct {
  l        log.Logger
  cache    cache.Cache
  doctl    *doctl.Doctl
  kubectl  *kubectl.Kubectl
  commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  var err error
  inst := &Plugin{
    l:        l,
    cache:    &cache.MemoryCache{},
    commands: command.Commands{},
  }

  // ...

  inst.kubectl, err = kubectl.New(l, inst.cache)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create kubectl")
  }

  inst.doctl, err = doctl.New(l, inst.cache)
	if err != nil {
    return nil, errors.Wrap(err, "failed to create doctl")
  }

  // ...

  inst.commands.Add(doctl.NewCommand(l, inst.cache, inst.doctl, inst.kubectl))

  // ...

  return inst, nil
}

Config

## doctl
doctl:
  configPath: .posh/config/doctl.yaml
  clusters:
    prod:
      name: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Ownbrew

To install binary locally, add:

ownbrew:
  packages:
    ## https://github.com/digitalocean/doctl/releases
    - name: doctl
      tap: foomo/tap/digitalocean/doctl
      version: 1.100.0