• This repository has been archived on 12/Jun/2019
  • Stars
    star
    7
  • Rank 2,294,772 (Top 46 %)
  • Language
    Crystal
  • License
    Other
  • Created about 8 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight Crystal wrapper around OVH's APIs.

crystal-ovh Build Status

Lightweight Crystal wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing.

Installation

Add this to your application's shard.yml:

dependencies:
  ovh:
    github: ovh/crystal-ovh

Usage

require "ovh"

begin
  client = Ovh::Client.new("ovh-eu", "<key>", "<secret>", "<consumer_key>")
  client.get("/cloud/project").each do |id|
    puts "Project id : #{id}"
  end
rescue err : Ovh::RequestFailed
  puts "Error raised : #{err}"
end

Getting application credentials

1. Create an application

To interact with APIs of a particular OVH service, your application needs to identify itself using an application key and an application secret. To get them, you need to register your application.

Depending on the service you plan to use, visit:

2. Configure your application

In order to configure your application you can either :

  • Use credentials direclty as literals.
  • Use environment variables.
  • Use a configuration file.

The easiest and safest way to use your application's credentials is to create an ovh.conf file :

[default]
; general configuration: default endpoint
endpoint=ovh-eu

[ovh-eu]
; configuration specific to 'ovh-eu' endpoint
application_key=my_app_key
application_secret=my_app_secret
;consumer_key=my_consumer_key

Depending on the API you want to use, you may set the endpoint to:

  • ovh-eu for OVH Europe API
  • ovh-ca for OVH North-America API
  • soyoustart-eu for So you Start Europe API
  • soyoustart-ca for So you Start North America API
  • kimsufi-eu for Kimsufi Europe API
  • kimsufi-ca for Kimsufi North America API
  • runabove-ca for RunAbove API

The configuration loader will try to find this configuration file in multiple places. Lookups are achieved in the following order :

  1. Current working directory: ./ovh.conf
  2. Current user's home directory ~/.ovh.conf
  3. System wide configuration /etc/ovh.conf

If you decide to hold your configuration in the environment, the following variables are expected :

  • OVH_ENDPOINT
  • OVH_APPLICATION_KEY
  • OVH_APPLICATION_SECRET
  • OVH_CONSUMER_KEY

This configuration will be shared by all applications.

Now you can use :

  # Using a specific endpoint
  client = Ovh::Client.new("ovh-eu")

Or

  # Using default endpoint
  client = Ovh::Client.new()

3. Authorize your application

To allow your application to access a customer account using the API on your behalf, you need a consumer key. When requesting this consumer key, you can set access rules to certain request paths.

Here is an example :

require "ovh"

begin
  # Create an application from configuration
  client = Ovh::Client.new("ovh-eu")

  # Allow GET and POST & PUT requests for all "/cloud" calls
  ck_req = client.consumer_request()
  ck_req.add_rule("/cloud/*", Ovh::Rule::Read | Ovh::Rule::Write)

  # Allow DELETE requests for all "/domain" calls
  ck_req.add_rule("/domain/*", Ovh::Rule::Delete)

  # Register this application as a consumer.
  ck_req.execute() do |ck_rep|
    puts "Application consumer key is #{ck_rep.consumer_key}"
    puts "Visit #{ck_rep.validation_url} to activate it and press enter to continue..."
    gets
  end
rescue err: Ovh::ConfigurationError | Ovh::RequestFailed
  puts "Error raised : #{err}"
end

Returned consumer key should then be saved in your configuration to avoid re-authenticating your end-user on each use.

Hacking

Make sure to use the latest version of crystal and to follow the contribution guidelines.

Code formatting

Code must be formatted with crystal tool format.

Tests

If you develop a new feature, you must write tests for it. These are located in the spec/ directory.

You can run them with crystal spec -v.

Supported APIs

OVH Europe

OVH North America

So you Start Europe

So you Start North America

Kimsufi Europe

Kimsufi North America

RunAbove

License

3-Clause BSD

More Repositories

1

cds

Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform
Go
4,572
star
2

the-bastion

Authentication, authorization, traceability and auditability for SSH accesses.
Perl
1,514
star
3

utask

µTask is an automation engine that models and executes business processes declared in yaml. ✏️📋
Go
1,197
star
4

venom

🐍 Manage and run your integration tests with efficiency - Venom run executors (script, HTTP Request, web, imap, etc... ) and assertions
Go
1,043
star
5

debian-cis

PCI-DSS compliant Debian 10/11/12 hardening
Shell
731
star
6

celery-director

Simple and rapid framework to build workflows with Celery
Python
535
star
7

svfs

The Swift Virtual File System
Go
374
star
8

php-ovh

Lightweight PHP wrapper for OVH APIs. That's the easiest way to use OVH.com APIs in your PHP applications.
PHP
287
star
9

python-ovh

Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing.
Python
270
star
10

docs

Official repository containing all docs & guides of OVH Group
HTML
224
star
11

manager

OVHcloud Control Panel
JavaScript
213
star
12

overthebox

OverTheBox - Aggregate and encrypt your multiple internet connections.
Shell
197
star
13

public-cloud-roadmap

Agile roadmap for OVHcloud Public Cloud services. Discover the features our product teams are working on, comment and influence our backlog.
187
star
14

terraform-provider-ovh

Terraform OVH provider
Go
183
star
15

ai-training-examples

Jupyter Notebook
138
star
16

metronome

Metronome is a distributed and fault-tolerant event scheduler
Go
136
star
17

go-ovh

Simple go wrapper for the OVH API
Go
127
star
18

node-ovh

Node.js wrapper for the OVH APIs
JavaScript
125
star
19

symmecrypt

Golang symmetric encryption library
Go
115
star
20

ovh-ttyrec

Enhanced (but compatible) version of the classic ttyrec
C
112
star
21

overthebox-feeds

OverTheBox - LEDE/OpenWrt feed
JavaScript
106
star
22

sv2chisel

(System)Verilog to Chisel translator
Scala
104
star
23

overthebox-openwrt

OverTheBox - OpenWrt fork
C
98
star
24

celery-dyrygent

Celery extension which allows to orchestrate 100/1000/10000 tasks combined into a complex workflow
Python
97
star
25

tat

Tat Engine - Text And Tags
Go
89
star
26

beamium

Prometheus to Warp10 metrics forwarder
Rust
84
star
27

ip-reputation-monitoring

Monitor the reputation of your IP ranges
Python
83
star
28

depc

QoS Measurement & Dependency Graph Platform
Python
80
star
29

configstore

Golang configuration management library
Go
65
star
30

erlenmeyer

Erlenmeyer is a proxy used to parse common Open Source TimeSeries DataBase query endpoints like OpenTSDB, Prometheus/PromQL, InfluxQL or Graphite. Parsed queries are translated into WarpScript to produce native Warp 10 queries.
Go
60
star
31

ovh-ui-kit

OVHcloud UI Kit - Master UI Framework
JavaScript
58
star
32

tsl

TSL is a HTTP proxy which generate WarpScript or a PromQl script based on a TSL query.
Go
56
star
33

noderig

Export OS stats as Sensision Metrics
Go
55
star
34

terraform-ovh-commons

This repo contains commons resources to interact with OVH Public Cloud using Terraform.
HTML
54
star
35

php-ovh-sms

PHP for ovh sms API
PHP
48
star
36

ovh-cli

OVH Command Line Interface
Python
42
star
37

infrastructure-roadmap

Agile roadmap for OVHcloud for Baremetal, Network and Storage IaaS services. Discover the features our product teams are working on, comment and influence our backlog.
38
star
38

the-bastion-ansible-wrapper

Using Ansible through The Bastion
Python
35
star
39

summit2016-RankingPredict

Deprecated, No more maintained - Deprecated, no longer maintained
R
34
star
40

ovh-warp10-datasource

Grafana datasource for Warp10 platform
TypeScript
33
star
41

csharp-ovh

Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing
C#
28
star
42

order-cart-examples

Example code snippets demonstrating how to use new order with cart on api.ovh.com
PHP
26
star
43

ldp-tail

OVH Logs Data Platform - Tail CLI tooling
Go
25
star
44

design-system

A collection of assets, guidelines and UI components for building consistent user experiences across OVHcloud products.
SCSS
22
star
45

public-cloud-examples

Jupyter Notebook
22
star
46

haproxy-exporter

Export HAProxy stats as Sensision Metrics
Go
21
star
47

fossil

Fossil is a proxy for securing unencrypted Graphite metrics collection
Go
20
star
48

python-apispec-fromfile

APISpec plugin to import OpenAPI specifications from a file
Python
19
star
49

terraform-ovh-publiccloud-network

HCL
19
star
50

tatwebui

Tat Web UI - Text And Tags
JavaScript
19
star
51

java-ovh

Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing
Java
19
star
52

pulumi-ovh

Pulumi provider for OVHcloud
Java
17
star
53

cerberus-ux

HTML
16
star
54

cerberus-core

Cerberus is a toolkit to receive, parse, process and automate abuse reports handling received by ISP or hosting providers.
Python
15
star
55

public-cloud-databases-examples

OVHcloud Public Cloud Databases Training examples
HCL
14
star
56

lxd-puppet-module

Ruby
14
star
57

osarchiver

OpenStack databases archiver
Python
14
star
58

jerem

Jerem is a golang bot that scrap JIRA project to extract Metrics. Those Metrics can then be send to a Warp 10 Backend.
Go
14
star
59

website-evidence-collector-batch

A tool to launch website-evidence-collector on several URLs or Sitemaps and generate a full report.
JavaScript
13
star
60

distronaut

Find distribution installers all across the web !
Go
13
star
61

rtm

RTM (OVH Real Time Monitoring)
Perl
13
star
62

ovh-ui-kit-bs

A bootstrap theme for the OVH managers, based on ovh-ui-kit
Less
13
star
63

prescience-client

Desktop python client for using OVH Prescience service
Jupyter Notebook
13
star
64

gulp-drupal-stack

OVH Gulp tasks for Drupal themes and modules
JavaScript
12
star
65

serving-runtime

Exposes a serialized machine learning model through a HTTP API.
Java
12
star
66

swift-ovh

This Swift package is a lightweight wrapper for OVH APIs. That's the easiest way to use OVH.com APIs in your Swift applications. Apple platforms supported: iOS, OSX, tvOS, watchOS.
Swift
11
star
67

metronome-ui

User interface for Metronome
JavaScript
11
star
68

private-cloud-roadmap

Agile roadmap for OVHcloud Hosted Private Cloud services. Discover the features our product teams are working on, comment and influence our backlog.
11
star
69

telephony-example-cti-dashboard

Shows signaling events provided by OVH France telephony services CTI
CSS
11
star
70

drucker

Drucker is a lightweight Drupal Developer Environment.
Shell
10
star
71

phishing-mitigation

Tilera-based phishing mitigation layer
JavaScript
10
star
72

lhasa

List and map micro-services-based information system and observe how they interact. Track their activities, then gamify their continuous improvement.
Go
10
star
73

python-logging-gelf

A python logging bundle to send logs using GELF
Python
9
star
74

webpaas-cli

PHP
8
star
75

overthebox-lede

OverTheBox - OpenWRT fork
C
8
star
76

terraform-provider-mimirtool

Terraform provider for Grafana Mimir
Go
8
star
77

owstats-ui

JavaScript
7
star
78

vbridge

X11 cloud desktop software
C
7
star
79

djehouty

Djehouty intends to be a set of logging formatters and handlers to easily send log entries.
Python
7
star
80

ovhdata-cli

Rust
7
star
81

python-warp10client

Python
7
star
82

data-processing-spark-submit

Spark CLI wrapper to run your jobs on OVHcloud Data Processing
Go
7
star
83

docs-rendering

[DEPRECATED] Official rendering engine for static generation of OVH Docs platform
HTML
7
star
84

interpretability-engine

Interpret Machine Learning black-box models deployed on Serving Engine
Python
6
star
85

yubico-piv-checker

Go
6
star
86

webhosting-ssh-bashrc

Shell
6
star
87

puppet-thebastion

Puppet module for Thebastion management.
Ruby
6
star
88

public-cloud-databases-operator

This operator allow you to automaticaly authorize your Kubernetes cluster IP on your OVHcloud cloud databases service.
Go
6
star
89

docs-developer-env

Easy to deploy developer environment, for writing/testing guides & documentations for docs.ovh.com
Shell
6
star
90

tat-contrib

Go
6
star
91

bringyourownlinux

Shell
6
star
92

terraform-ovh-publiccloud-docker-swarm

HCL
5
star
93

terraform-ovh-publiccloud-spark

HCL
5
star
94

summit2016-webhosting-example-rondcoin

PHP
5
star
95

collectd-write-warp10

Python
5
star
96

fiowebviewer

Python
5
star
97

puppet-mimir

Ruby
4
star
98

pingdom-to-graphite

A tool for copying metrics from Pingdom to Graphite.
JavaScript
4
star
99

ovh-winston-ldp

A graylog2 TCP/TLS transport for winston library
JavaScript
4
star
100

okms-sdk-go

The Golang SDK to interact with your OVHcloud KMS services.
Go
4
star