uaktags/ngcsv1

1and1 NGCS API v1 PHP 5.4+ library

v1.0-beta 2017-04-06 00:29 UTC

This package is not auto-updated.

Last update: 2024-05-11 16:20:28 UTC


README

A PHP5.4 wrapper for 1&1's New CloudServer API. Based off of DigitalOceanV2 by toin0u.

Status

API Documentation Status
Servers (https://github.com/uaktags/NGCSv1#servers) [100%]
Images (https://github.com/uaktags/NGCSv1#images) [100%]
Shared Storages (https://github.com/uaktags/NGCSv1#shared_storages) [100%]
Firewall Policies (https://github.com/uaktags/NGCSv1#firewall_policies) [100%]
PublicIPs (https://github.com/uaktags/NGCSv1#public_ips) [100%]
Private Networks (https://github.com/uaktags/NGCSv1#private_networks) [90%]
Monitoring Center (https://github.com/uaktags/NGCSv1#monitoring_center) [100%]
Monitoring Policies 50%
Logs 100%
Users 100%
Usages 0%
Server Appliances 0%
DVD ISO 0%
Load Balancers 0%

Installation

The recommended way to install this is through composer.

Run these commands to install composer, the library and its dependencies:

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require uaktags/ngcsv1:~1.0

You then need to install one of the following:

$ php composer.phar require nategood/httpful:~0.10

Or edit composer.json and add:

{
    "require": {
        "uaktags/ngcsv1": "~1.0"
    }
}

And then add the following:

{
   "require": {
           "nategood/httpful": "0.2.19"
    },
}

Adapter

I have added a simple HTTPFul adapter, but if you'd like to port Buzz or Guzzle as it was found in the original Digitalocean wrapper, be mindful of the API changes.

You can also build your own adapter by extending AbstractAdapter and implementing AdapterInterface.

Example

<?php

require 'vendor/autoload.php';

use NGCSv1\Adapter\HttpAdapter;
use NGCSv1\NGCSv1;

// create an adapter with your user's API Token
// found in your CloudPanel under "Users"
$adapter = new HttpAdapter('');

// create a ngcs object with the previous adapter
$ngcs = new NGCSv1($adapter);

// ...

Entities

Every entity has the getUnknownProperties method which will return an array of properties set with unknown properties by the entity. This is here only as a fail-safe until the API is fully ported.

Server

// ...
// initialize the Server Entity
$server = $ngcs->server();
// Get All Servers in your account
$servers = $server->getAll();
// Specify a particular server by it's ID
$aserver = $server->getById("9954B9CB401E0A8361AF73E8563FCE5F");

[TO BE CONTINUED]

Contributing

I welcome any contributions to make this Library fully functional for all. Please keep the TODO in mind as well.

Credits

[NGCSv1]

[Original DigitalOcean PHP Library, used as base]

Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/

License

NGCSv1 uses the same MIT License as the original project DigitalOceanV2.

DigitalOceanV2 is released under the MIT License. See the bundled LICENSE file for details.