Skip to content

flownative/harbor-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT license Maintenance level: Love

Harbor OpenAPI client

This package provides a client for Harbor. It was auto-generated with Jane based on the Harbor API v2.

Feature coverage

This library only provides subset of the resources provided by the Harbor API. The included API paths are defined in .jane-openapi. If further resources are needed, you can adjust the configuration as needed and rebuild the client library.

Rebuilding the client library

Jane provides commands for generating the client code. Switch to this package's directory and install Composer dependencies. You can then run a command for generating the code:

composer update
bin/jane-openapi-generate

Usage

The client is instantiated using the create() factory method. The following example shows how to create a project, authenticating with username and password of a Harbor robot user:

use Http\Client\Common\Plugin\AddHostPlugin;
use Http\Client\Common\Plugin\AddPathPlugin;
use Http\Client\Common\Plugin\AuthenticationPlugin;
use Http\Message\Authentication\BasicAuth;
use Flownative\Harbor\Api\Model\ProjectReq;

…

$client = \Flownative\Harbor\Api\Client::create(
    null,
    [
        new AddHostPlugin(
            $endpointUri
        ),
        new AddPathPlugin(
            $endpointUri
        ),
        new AuthenticationPlugin(
            new BasicAuth(
                $username,
                $password,
            )
        )
    ]
);

$projectRequest = new ProjectReq();
$projectRequest
    ->setProjectName((string)$projectName)
    ->setPublic(false);

$client->createProject($projectRequest);

About

This package provides API models and a client for Harbor

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages