Skip to content

Commit

Permalink
Add order example (#11)
Browse files Browse the repository at this point in the history
* Add order example

  * Add section links
  * Move usage to USAGE.md
  • Loading branch information
TheoBrigitte authored Nov 7, 2024
1 parent f732557 commit aea563c
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 68 deletions.
96 changes: 28 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ This is my playground to learn how the OVH API works, it is then ported into a T

## Features <img src="./assets/star.svg" width="24">

- List available servers from OVH Eco catalog
- Check availability of a specific server in one or multiple datacenters
- Send notifications to OpsGenie and/or Telegram when a server is available
- [List available servers](#list-available-servers) from OVH Eco catalog
- [Check availability](#check-availability) of a specific server in one or multiple datacenters
- Send [notifications](#notifications-) to OpsGenie and/or Telegram when a server is available
- [Order a server](#order-a-server) directly from the command line

## Quickstart <img src="./assets/rocket.svg" width="24">

Expand Down Expand Up @@ -111,68 +112,7 @@ $ bin/check.sh --plan-code 24ska01
> sent Telegram notification
```

## Usage <img src="./assets/bash.svg" width="24">

```
$ bin/list.sh -h
Usage: list.sh
List servers from OVH Eco (including Kimsufi) catalog
Arguments
--category Server category (default all)
Allowed values: kimsufi, soyoustart, rise, uncategorized
-c, --country Country code (required)
Allowed values with -e ovh-eu : CZ, DE, ES, FI, FR, GB, IE, IT, LT, MA, NL, PL, PT, SN, TN
Allowed values with -e ovh-ca : ASIA, AU, CA, IN, QC, SG, WE, WS
Allowed values with -e ovh-us : US
-e, --endpoint OVH API endpoint (default: ovh-eu)
Allowed values: ovh-eu, ovh-ca, ovh-us
-d, --debug Enable debug mode (default: false)
-h, --help Display this help message
Arguments can also be set as environment variables see config.env.example
Command line arguments take precedence over environment variables
Example:
list.sh --country FR
list.sh --country FR --category kimsufi
```

```
$ bin/check.sh -h
Usage: check.sh
Check OVH Eco (including Kimsufi) server availability
Arguments
-p, --plan-code Plan code to check (e.g. 24ska01)
--datacenters Comma-separated list of datacenters to check availability for (default all)
Example values: bhs, ca, de, fr, fra, gb, gra, lon, pl, rbx, sbg, waw (non exhaustive list)
-e, --endpoint OVH API endpoint (default: ovh-eu)
Allowed values: ovh-eu, ovh-ca, ovh-us
-d, --debug Enable debug mode (default: false)
-h, --help Display this help message
Arguments can also be set as environment variables see config.env.example
Command line arguments take precedence over environment variables
Environment variables
DISCORD_WEBHOOK Webhook URL to use for Discord notification service
GOTIFY_URL URL to use for Gotify notification service
GOTIFY_TOKEN token to use for Gotify notification service
GOTIFY_PRIORITY prority for Gotify notification service
OPSGENIE_API_KEY API key for OpsGenie to receive notifications
TELEGRAM_BOT_TOKEN Bot token for Telegram to receive notifications
TELEGRAM_CHAT_ID Chat ID for Telegram to receive notifications
HEALTHCHECKS_IO_UUID UUID for healthchecks.io to ping after successful run
Example:
check.sh --plan-code 24ska01
check.sh --plan-code 24ska01 --datacenters fr,gra,rbx,sbg
```

### Examples
### Examples <img src="./assets/bash.svg" width="24">

#### List available servers

Expand Down Expand Up @@ -205,7 +145,27 @@ PlanCode Category Name Price (EUR)
Check availability of a specific server in all datacenters.

```
$ bin/check.sh --plan-code 24ska01
> checking 24ska01 availability in all datacenters
> checked 24ska01 unavailable in fr,gra,rbx,sbg
$ bin/check.sh --plan-code 24sk50
> checking 24sk50 availability in all datacenters
> checked 24sk50 available in bhs,fra,gra,rbx,sbg,waw datacenter(s)
```

#### Order a server

Place an order a specific server, the order is only placed and not payed for. The order can then be completed by following the URL provided in the output.

```
$ bin/order.sh --plan-code 24sk50 --datacenter fra --item-configuration region=europe
> cart created id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> cart updated with item id=xxxxxxxxx
> item auto-configuration dedicated_os=none_64.en
> item user-configuration region=europe
> item user-configuration dedicated_datacenter=fra
> item option ram-32g-ecc-2400-24sk50
> item option bandwidth-300-24sk
> item option softraid-2x2000sa-24sk50
> cart assigned to account
> order completed url=https://www.ovh.com/cgi-bin/order/display-order.cgi?orderId=xxxxxxxxx&orderPassword=xxxxxxxxxx
```

More info on scripts usage can be found in [USAGE.md](USAGE.md).
98 changes: 98 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Usage <img src="./assets/bash.svg" width="24">

## List available servers

```
$ bin/list.sh -h
Usage: list.sh
List servers from OVH Eco (including Kimsufi) catalog
Arguments
--category Server category (default all)
Allowed values: kimsufi, soyoustart, rise, uncategorized
-c, --country Country code (required)
Allowed values with -e ovh-eu : CZ, DE, ES, FI, FR, GB, IE, IT, LT, MA, NL, PL, PT, SN, TN
Allowed values with -e ovh-ca : ASIA, AU, CA, IN, QC, SG, WE, WS
Allowed values with -e ovh-us : US
-e, --endpoint OVH API endpoint (default: ovh-eu)
Allowed values: ovh-eu, ovh-ca, ovh-us
-d, --debug Enable debug mode (default: false)
-h, --help Display this help message
Arguments can also be set as environment variables see config.env.example
Command line arguments take precedence over environment variables
Example:
list.sh --country FR
list.sh --country FR --category kimsufi
```

## Check availability

```
$ bin/check.sh -h
Usage: check.sh
Check OVH Eco (including Kimsufi) server availability
Arguments
-p, --plan-code Plan code to check (e.g. 24ska01)
--datacenters Comma-separated list of datacenters to check availability for (default all)
Example values: bhs, ca, de, fr, fra, gb, gra, lon, pl, rbx, sbg, waw (non exhaustive list)
-e, --endpoint OVH API endpoint (default: ovh-eu)
Allowed values: ovh-eu, ovh-ca, ovh-us
-d, --debug Enable debug mode (default: false)
-h, --help Display this help message
Arguments can also be set as environment variables see config.env.example
Command line arguments take precedence over environment variables
Environment variables
DISCORD_WEBHOOK Webhook URL to use for Discord notification service
GOTIFY_URL URL to use for Gotify notification service
GOTIFY_TOKEN token to use for Gotify notification service
GOTIFY_PRIORITY prority for Gotify notification service
OPSGENIE_API_KEY API key for OpsGenie to receive notifications
TELEGRAM_BOT_TOKEN Bot token for Telegram to receive notifications
TELEGRAM_CHAT_ID Chat ID for Telegram to receive notifications
HEALTHCHECKS_IO_UUID UUID for healthchecks.io to ping after successful run
Example:
check.sh --plan-code 24ska01
check.sh --plan-code 24ska01 --datacenters fr,gra,rbx,sbg
```

## Order a server

```
$ bin/order.sh -h
Usage: order.sh
Place an order for a servers from OVH Eco (including Kimsufi) catalog
Arguments
-c, --country Country code (required)
Allowed values with -e ovh-eu : CZ, DE, ES, FI, FR, GB, IE, IT, LT, MA, NL, PL, PT, SN, TN
Allowed values with -e ovh-ca : ASIA, AU, CA, IN, QC, SG, WE, WS
Allowed values with -e ovh-us : US
--datacenter Datacenter code (default: from config when only one is set)
Example values: bhs, ca, de, fr, fra, gb, gra, lon, pl, rbx, sbg, waw (non exhaustive list)
-e, --endpoint OVH API endpoint (default: ovh-eu)
Allowed values: ovh-eu, ovh-ca, ovh-us
-i, --item-configuration
Item configuration in the form 'label=value'
-d, --debug Enable debug mode (default: false)
-h, --help Display this help message
-q, --quantity Quantity of items to order (default: 1)
--price-mode Billing price type (default: default)
--price-duration Billing duration (default: P1M)
Arguments can also be set as environment variables see config.env.example
Command line arguments take precedence over environment variables
Example:
order.sh
order.sh --item-configuration region=europe
order.sh --item-configuration region=europe --datacenter fra
```

0 comments on commit aea563c

Please sign in to comment.