https://github.com/structed/ovh-sharp
Library Wrapper and CLI tool to interface with the OVH API
https://github.com/structed/ovh-sharp
Last synced: 8 months ago
JSON representation
Library Wrapper and CLI tool to interface with the OVH API
- Host: GitHub
- URL: https://github.com/structed/ovh-sharp
- Owner: Structed
- License: mit
- Created: 2019-10-15T22:00:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:59:10.000Z (about 3 years ago)
- Last Synced: 2025-03-25T19:50:06.743Z (10 months ago)
- Language: C#
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
This repository contains a Solution with two projects:
* ovh-sharp (`netstandard1.6`)
* ovh-cli (`netcoreapp1.1`)
## ovh-sharp ("The Library")
This is a .NET Standard library project written in C# to wrap the OVH API for .NET Standard.
This was originally developed in 2017, as there was no .NET library available to interface with the OVH API.
## ovh-cli
This is a .NET Core Console Application to actually work with the OVH API via CLI by using the ovh-sharp Library.
## Building
To build the library and the Client, use the build script with the appropriate task/target, which is written using [Cake](https://cakebuild.net), using the build script bootstrapper for PowerShell. You can get a list of targets by executing the bootstrapper without arguments (first time launch will take a while because it needs to download build tool dependencies):
`: .\build.ps1`
## How to use ovh-cli
### Prerequisites
* Account with OVH
* Set up OVH API access (see [OVH API documentation](https://docs.ovh.com/gb/en/customer/first-steps-with-ovh-api)), which yields these three keys:
* Application Secret
* Application Key
* Consumer Key
* .NET Core 1.1 (with SDK). You should use [this LTS release](https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.2-download.md).
### Preparation
Once you have the keys/secrets from OVH, you need to decide how you want to use them. You have two options:
* Set environment variables (preferred). The application will look for the following environment variables:
* `OVH_API_APPLICATION_KEY`
* `OVH_API_APPLICATION_SECRET`
* `OVH_API_CONSUMER_KEY`
* Set them as command line parameters on each use (discouraged because it will be logged to the console history):
* `--ovh-application-key`
* `--ovh-application-secret`
* `--ovh-consumer-key`
### Getting help
In the client's directory (`/src/ovh-cli`) run the program with the `--help` option:
`dotnet run -- --help`
You can run all sub-commands with the `--help` option to get further help on that command, e.g. `dotnet run -- create-cname --help`
### Command examples
#### To create CNAMES
* `dotnet run -- create-cname -z example.com -s sub-domain-name -t actual-host.example.net.`
#### To search CNAME entries that have 'search_string' in their CNAME record:
`dotnet run -- show-records example.com CNAME %search_string%`
#### To remove found entry with ID '1337':
`dotnet run -- delete-record example.com 1337`
#### To Clean CNAME records whose `target` properties start with `foo`:
`dotnet run -- clean-cnames --zone example.com --targetStartsWith "foo"`
# Contributing
Please read [CONTRIBUTING.md](CONTRIBUTING.md)
# Acknowledgement
This project was originally developed at [RE'FLEKT](https://re-flekt.com).
# License
All code and other resources in this repository are licensed under the [MIT License](https://spdx.org/licenses/MIT.html)