Giter Site home page Giter Site logo

docker-openapi-php-client's Introduction

OpenAPIClient-php

The Engine API is an HTTP API served by Docker Engine. It is the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can be done with the API.

Most of the client's commands map directly to API endpoints (e.g. docker ps is GET /containers/json). The notable exception is running containers, which consists of several API calls.

Errors

The API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:

{
  \"message\": \"page not found\"
}

Versioning

The API is usually changed in each release, so API calls are versioned to ensure that clients don't break. To lock to a specific version of the API, you prefix the URL with its version, for example, call /v1.30/info to use the v1.30 version of the /info endpoint. If the API version specified in the URL is not supported by the daemon, a HTTP 400 Bad Request error message is returned.

If you omit the version-prefix, the current version of the API (v1.40) is used. For example, calling /info is the same as calling /v1.40/info. Using the API without a version-prefix is deprecated and will be removed in a future release.

Engine releases in the near future should support this version of the API, so your client will continue to work even if it is talking to a newer Engine.

The API uses an open schema model, which means server may add extra properties to responses. Likewise, the server will ignore any extra query parameters and request body properties. When you write clients, you need to ignore additional properties in responses to ensure they do not break when talking to newer daemons.

Authentication

Authentication for registries is handled client side. The client has to send authentication details to various endpoints that need to communicate with registries, such as POST /images/(name)/push. These are sent as X-Registry-Auth header as a Base64 encoded (JSON) string with the following structure:

{
  \"username\": \"string\",
  \"password\": \"string\",
  \"email\": \"string\",
  \"serveraddress\": \"string\"
}

The serveraddress is a domain/IP without a protocol. Throughout this structure, double quotes are required.

If you have already got an identity token from the /auth endpoint, you can just pass this instead of credentials:

{
  \"identitytoken\": \"9cbaf023786cd7...\"
}

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.40
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 7.1 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new OpenAPI\Client\Api\ConfigApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = new \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE(); // \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE | 

try {
    $result = $apiInstance->configCreate($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ConfigApi->configCreate: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to http://localhost/v1.40

Class Method HTTP request Description
ConfigApi configCreate POST /configs/create Create a config
ConfigApi configDelete DELETE /configs/{id} Delete a config
ConfigApi configInspect GET /configs/{id} Inspect a config
ConfigApi configList GET /configs List configs
ConfigApi configUpdate POST /configs/{id}/update Update a Config
ContainerApi containerArchive GET /containers/{id}/archive Get an archive of a filesystem resource in a container
ContainerApi containerArchiveInfo HEAD /containers/{id}/archive Get information about files in a container
ContainerApi containerAttach POST /containers/{id}/attach Attach to a container
ContainerApi containerAttachWebsocket GET /containers/{id}/attach/ws Attach to a container via a websocket
ContainerApi containerChanges GET /containers/{id}/changes Get changes on a container’s filesystem
ContainerApi containerCreate POST /containers/create Create a container
ContainerApi containerDelete DELETE /containers/{id} Remove a container
ContainerApi containerExport GET /containers/{id}/export Export a container
ContainerApi containerInspect GET /containers/{id}/json Inspect a container
ContainerApi containerKill POST /containers/{id}/kill Kill a container
ContainerApi containerList GET /containers/json List containers
ContainerApi containerLogs GET /containers/{id}/logs Get container logs
ContainerApi containerPause POST /containers/{id}/pause Pause a container
ContainerApi containerPrune POST /containers/prune Delete stopped containers
ContainerApi containerRename POST /containers/{id}/rename Rename a container
ContainerApi containerResize POST /containers/{id}/resize Resize a container TTY
ContainerApi containerRestart POST /containers/{id}/restart Restart a container
ContainerApi containerStart POST /containers/{id}/start Start a container
ContainerApi containerStats GET /containers/{id}/stats Get container stats based on resource usage
ContainerApi containerStop POST /containers/{id}/stop Stop a container
ContainerApi containerTop GET /containers/{id}/top List processes running inside a container
ContainerApi containerUnpause POST /containers/{id}/unpause Unpause a container
ContainerApi containerUpdate POST /containers/{id}/update Update a container
ContainerApi containerWait POST /containers/{id}/wait Wait for a container
ContainerApi putContainerArchive PUT /containers/{id}/archive Extract an archive of files or folders to a directory in a container
DistributionApi distributionInspect GET /distribution/{name}/json Get image information from the registry
ExecApi containerExec POST /containers/{id}/exec Create an exec instance
ExecApi execInspect GET /exec/{id}/json Inspect an exec instance
ExecApi execResize POST /exec/{id}/resize Resize an exec instance
ExecApi execStart POST /exec/{id}/start Start an exec instance
ImageApi buildPrune POST /build/prune Delete builder cache
ImageApi imageBuild POST /build Build an image
ImageApi imageCommit POST /commit Create a new image from a container
ImageApi imageCreate POST /images/create Create an image
ImageApi imageDelete DELETE /images/{name} Remove an image
ImageApi imageGet GET /images/{name}/get Export an image
ImageApi imageGetAll GET /images/get Export several images
ImageApi imageHistory GET /images/{name}/history Get the history of an image
ImageApi imageInspect GET /images/{name}/json Inspect an image
ImageApi imageList GET /images/json List Images
ImageApi imageLoad POST /images/load Import images
ImageApi imagePrune POST /images/prune Delete unused images
ImageApi imagePush POST /images/{name}/push Push an image
ImageApi imageSearch GET /images/search Search images
ImageApi imageTag POST /images/{name}/tag Tag an image
NetworkApi networkConnect POST /networks/{id}/connect Connect a container to a network
NetworkApi networkCreate POST /networks/create Create a network
NetworkApi networkDelete DELETE /networks/{id} Remove a network
NetworkApi networkDisconnect POST /networks/{id}/disconnect Disconnect a container from a network
NetworkApi networkInspect GET /networks/{id} Inspect a network
NetworkApi networkList GET /networks List networks
NetworkApi networkPrune POST /networks/prune Delete unused networks
NodeApi nodeDelete DELETE /nodes/{id} Delete a node
NodeApi nodeInspect GET /nodes/{id} Inspect a node
NodeApi nodeList GET /nodes List nodes
NodeApi nodeUpdate POST /nodes/{id}/update Update a node
PluginApi getPluginPrivileges GET /plugins/privileges Get plugin privileges
PluginApi pluginCreate POST /plugins/create Create a plugin
PluginApi pluginDelete DELETE /plugins/{name} Remove a plugin
PluginApi pluginDisable POST /plugins/{name}/disable Disable a plugin
PluginApi pluginEnable POST /plugins/{name}/enable Enable a plugin
PluginApi pluginInspect GET /plugins/{name}/json Inspect a plugin
PluginApi pluginList GET /plugins List plugins
PluginApi pluginPull POST /plugins/pull Install a plugin
PluginApi pluginPush POST /plugins/{name}/push Push a plugin
PluginApi pluginSet POST /plugins/{name}/set Configure a plugin
PluginApi pluginUpgrade POST /plugins/{name}/upgrade Upgrade a plugin
SecretApi secretCreate POST /secrets/create Create a secret
SecretApi secretDelete DELETE /secrets/{id} Delete a secret
SecretApi secretInspect GET /secrets/{id} Inspect a secret
SecretApi secretList GET /secrets List secrets
SecretApi secretUpdate POST /secrets/{id}/update Update a Secret
ServiceApi serviceCreate POST /services/create Create a service
ServiceApi serviceDelete DELETE /services/{id} Delete a service
ServiceApi serviceInspect GET /services/{id} Inspect a service
ServiceApi serviceList GET /services List services
ServiceApi serviceLogs GET /services/{id}/logs Get service logs
ServiceApi serviceUpdate POST /services/{id}/update Update a service
SessionApi session POST /session Initialize interactive session
SwarmApi swarmInit POST /swarm/init Initialize a new swarm
SwarmApi swarmInspect GET /swarm Inspect swarm
SwarmApi swarmJoin POST /swarm/join Join an existing swarm
SwarmApi swarmLeave POST /swarm/leave Leave a swarm
SwarmApi swarmUnlock POST /swarm/unlock Unlock a locked manager
SwarmApi swarmUnlockkey GET /swarm/unlockkey Get the unlock key
SwarmApi swarmUpdate POST /swarm/update Update a swarm
SystemApi systemAuth POST /auth Check auth configuration
SystemApi systemDataUsage GET /system/df Get data usage information
SystemApi systemEvents GET /events Monitor events
SystemApi systemInfo GET /info Get system information
SystemApi systemPing GET /_ping Ping
SystemApi systemPingHead HEAD /_ping Ping
SystemApi systemVersion GET /version Get version
TaskApi taskInspect GET /tasks/{id} Inspect a task
TaskApi taskList GET /tasks List tasks
TaskApi taskLogs GET /tasks/{id}/logs Get task logs
VolumeApi volumeCreate POST /volumes/create Create a volume
VolumeApi volumeDelete DELETE /volumes/{name} Remove a volume
VolumeApi volumeInspect GET /volumes/{name} Inspect a volume
VolumeApi volumeList GET /volumes List volumes
VolumeApi volumePrune POST /volumes/prune Delete unused volumes

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

docker-openapi-php-client's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.