定制 alsalty/argocd-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alsalty/argocd-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require alsalty/argocd-sdk

包简介

PHP library for Argo CD

README 文档

README

This PHP SDK library provides an easy way to interact with Argo CD's API, allowing you to manage applications, clusters, and more.

Features

  • Authenticate with Argo CD API using username and password
  • Manage applications with project and namespace filters
  • Fetch information and names of applications

Installation

Using Composer

You can install the library via Composer. Run the following command in your terminal:

composer require alsalty/argocd-sdk

Usage

Basic Example

require 'vendor/autoload.php';

use Alsalty\Argocd\Core\Auth;
use Alsalty\Argocd\Core\Managers\ApplicationsManager;

try {
    // Set your Argo CD API credentials
    $apiUrl = 'https://your-argocd-api-url';
    $username = 'your-username';
    $password = 'your-password';

    // Create an Auth instance and authenticate
    $auth = new Auth($apiUrl, $username, $password);
    $auth->authenticate();

    // Create an ApplicationsManager instance
    $appManager = new ApplicationsManager($auth);

    // Set projects and namespace filters
    $appManager->setProjects(['project1', 'project2']);
    $appManager->setAppNamespace('namespace1');

    // Fetch and print application names
    $applicationNames = $appManager->getApplicationsNames();
    print_r($applicationNames);

} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Filtering Applications

You can filter applications by projects and namespaces:

  • Projects: Set multiple projects to filter applications by those projects.
  • Namespace: Set a namespace to filter applications by a specific namespace.
$appManager->setProjects(['project1', 'project2']);
$appManager->setAppNamespace('namespace1');

Configuration

You can configure the following parameters:

  • API URL: The URL of your Argo CD API server.
  • Username: Your Argo CD username.
  • Password: Your Argo CD password.

Development

Structure

  • src/Core: Contains core classes such as Auth and managers.
  • src/Helpers: Contains helper classes like Curl.
  • tests: Contains test cases.

Contributing

Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-03