this repository contains all needed bash functions to interact with OVH API

Virgil Ollivier baf0810254 fix typo bin/vpsReinstall 1 month ago
bin baf0810254 fix typo bin/vpsReinstall 1 month ago
etc e8937454f0 rename etc/ovh.conf 1 month ago
.gitignore 7050e0a76a update repo , gitignore 1 month ago
Makefile d02c1721a1 add function upgrade or uninstall a specific version 1 month ago
README.md 2260f288c7 update readme 1 month ago
make.env 8371117880 bump version to 0.0.4 1 month ago

README.md

OVHCLI

This is a simple OVH API wrapper in BASH

All API specifications is here : OVH API

It use the same configuration file as for the go-ovh wrapper

Token creation

You need to follow : createApp And add the Application_key,secret_key and consumer_key to the ovh.conf

How to use

Examples

  1. Get all VPS

    ./ovhcli get vps
    
    [
    "vps-3e2da6b4.vps.ovh.net",
    "vps-556c9180.vps.ovh.net",
    "vps-59e2e922.vps.ovh.net",
    "vps-76fdb68a.vps.ovh.net",
    "vps-89819518.vps.ovh.net",
    "vps-b280dcff.vps.ovh.net",
    "vps-f31d3392.vps.ovh.net"
    ]
    
  2. Get all records for a DNS Zone "linuxforward.com"

    ./ovhcli get domain/zone/linuxforward.com/record/
    [
    5344790631,
    5344790632,
    5344790633,
    5344790634,
    5344790635,
    5344790636,
    5344790637,
    [...]
    5344790668,
    5344790669,
    5344790670,
    5344790671
    ]
    
  3. Get info from a specific DNS Zone record

    ./ovhcli get domain/zone/linuxforward.com/record/5344790650
    {
    "fieldType": "A",
    "id": 5344790650,
    "subDomain": "demodev",
    "target": "51.91.101.38",
    "ttl": 0,
    "zone": "linuxforward.com"
    }
    
    
  4. List all details from all VPS

    ./ovhcli get vps | jq -r '.[]' | while read vps;  do ./ovhcli get vps/${vps} | jq  '[.name, .model.name, .model.version, .model.disk, .model.memory]|@tsv' ; done | column -t
    vps-3e2da6b4.vps.ovh.net  vps-value-1-2-40    2019v1  40  2048
    vps-556c9180.vps.ovh.net  vps-value-1-2-40    2019v1  40  2048
    vps-59e2e922.vps.ovh.net  vps-value-1-2-40    2019v1  40  2048
    vps-76fdb68a.vps.ovh.net  vps-starter-1-2-20  2019v1  20  2048
    vps-89819518.vps.ovh.net  vps-value-1-2-40    2019v1  40  2048
    vps-b280dcff.vps.ovh.net  vps-value-1-2-40    2019v1  40  2048
    vps-f31d3392.vps.ovh.net  vps-starter-1-2-20  2019v1  20  2048
    
  5. If credentials are revoked

    ./ovhcli get vps
    {
    "class": "Client::Forbidden",
    "message": "This credential is not valid",
    "httpCode": "403 Forbidden",
    "errorCode": "INVALID_CREDENTIAL"
    }