Expand description
This crate provides a library for calling Rest Api functions on the Transip endpoint.
More information on the rest api can be obtained from Transip API.
Only part of the api is implemented. The main reason for writing this library is the ability
to CRUD dns records for a particular domain. This functionality can be used to respond to DNS01 challenges
from the Let's Encrypt servers.
This type of challenge is needed to get wildcard certificates.
Usage
This crate is on crates.io and can
be used by adding transip to your depencies in your projects Cargo.toml.
Before running a program using this library a private key should be download from the
Transip control panel and stored in a file.
[dependencies]
transip = "0.1.0"
Example
use transip::{configuration_from_environment, Client, api::general::GeneralApi};
let mut client = configuration_from_environment().and_then(Client::try_from).unwrap();
let pong = client.api_test().unwrap();
assert_eq!(pong.as_str(), "pong");Environment variables
The following environment variables should be set!.
TRANSIP_API_USERNAME
This is the username used in authentication
Example
export TRANSIP_API_USERNAME=paulusminus
TRANSIP_API_PRIVATE_KEY
This is the name of the file that holds the pem encoded private key used in authentication
Example
export TRANSIP_API_PRIVATE_KEY=/etc/transip/private.pem
TRANSIP_API_READONLY
Can be ‘true’ or ‘false’. If you wan’t to prevent accidental modifications set this to ‘true’.
Example
export TRANSIP_API_READONLY=false
TRANSIP_API_WHITELISTED_ONLY
Can be ‘true’ or ‘false’.
TRANSIP_API_TOKEN_EXPIRATION
Authentication means receiving a token. The interval in which the received will expired can be controlled.
Example 1
export TRANSIP_API_TOKEN_EXPIRATION=5 minutes
Example 2
export TRANSIP_API_TOKEN_EXPIRATION=55 seconds
Example 3
export TRANSIP_API_TOKEN_EXPIRATION=1 hour
Modules
Structs
- Client is the main entry for this library. Creation is done by using Client::try_from(configuration). After creation of a client, this client can be used to call a Transip API call. Each call starts with a check to see if we have a valid JWT token If the token is expired or non existant then the Transip API call for requesting a new token is called Tokens are persisted to disk on exit and reused if not expired on application startup
Enums
- All failable functions in this crate should use this Error
Traits
Functions
- get configuration from environment variables