Get the 1&1 Cloud Server Fog Library

SDK Version: 1.0.0

Table of Contents

Overview

Fog is an open-source, community Ruby library used for interacting with popular cloud infrastructure providers through a single, unified API.

This guide will show you how to programmatically use the 1&1 provider in Fog to perform common management tasks available in the 1&1 Cloud Panel.

The Fog library wraps the 1&1 REST API. All API operations are performed over SSL and authenticated using your 1&1 credentials. The API can be accessed within an instance running in 1&1 or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.

The Fog library provides two methods of interacting with 1&1. The first method utilizes an abstracted collection and model layer that is similar across all cloud providers within Fog.

A collection is a group of similar resources such as servers, images, or firewalls and allows basic CRUD (create/read/update/delete) operations on collections and models. This guide will cover interactions with the 1&1 environment solely using collections and models.

While out of scope of this guide, the second Fog method provides direct request methods that specifically match provider API methods. In the case of the 1&1 provider, the request methods map to the 1&1 REST API endpoints and parameters. More details on requests can be found at the Fog website.

To view or contribute to this project, visit the GitHub repository.

Getting Started

Before you begin you will need to have signed up for a 1&1 account. The credentials you create during sign-up will be used to authenticate against the API.

Installation

You can install the latest stable version using:

gem install fog-oneandone

Authentication

Connecting to 1&1 can be done by creating a compute connection with the provider.

ruby
require 'fog-oneandone'

compute = Fog::Compute::OneAndOne.new({
  :oneandone_api_key => '<API-TOKEN>'
})

Credentials can be specified as shown above or placed in a .fog file located in the home directory.

bash
$ less ~/.fog
default:
  oneandone_api_key: <API-TOKEN>

Updated 6/22/2017

Comments

Tags: Fog