argocd-dotnet-client
is a .NET REST client designed for ArgoCD API v1. It allows .NET applications to interact with ArgoCD instances, performing various operations such as managing applications, clusters, projects, user sessions, and more. This client aims to simplify the integration with ArgoCD within the .NET ecosystem, providing developers with a type-safe and easy-to-use interface to automate and manage ArgoCD resources.
argocd-dotnet-client
provides comprehensive support for ArgoCD API v1, with key features including:
- Version Management: Access ArgoCD's version information.
- System Settings: Manage ArgoCD's system configurations and settings.
- Notification Service: Interact with ArgoCD's notification system.
- Account Management: Handle user account and authentication-related operations.
- Session Management: Create and manage user sessions.
- Cluster Management: Register, update, and delete Kubernetes clusters.
- Certificate Management: Manage TLS certificates used by ArgoCD for cluster communication.
- GPG Key Management: Manage GPG keys used for signing and verifying Git commits.
- Repository Credential Management: Configure and manage access credentials for Git repositories.
- Repository Management: Add, update, and delete Git repositories.
- Application Management: Create, deploy, synchronize, and manage ArgoCD applications.
- ApplicationSet Management: Manage ArgoCD ApplicationSets.
- Project Management: Define and manage ArgoCD projects, including resource limits and role bindings.
- Strongly-Typed Client: Provides type-safe C# interfaces, simplifying API calls.
- RESTful Architecture: Designed based on RESTful principles, easy to understand and integrate.
Since argocd-dotnet-client
is a .NET client library, you can add it to your .NET project via the NuGet package manager. Currently, this project has not been published to the official NuGet feed, so you may need to reference it as a local package or build it from source.
Building from Source (Recommended for Development):
- Clone the repository:
git clone https://github.com/huhouhua/argocd-dotnet-client.git cd argocd-dotnet-client
- Build the project:
dotnet build
Via NuGet Package Manager (To be published):
Once published to NuGet, you can install it using the following command:
dotnet add package ArgoCD.Client
The following is a simple example demonstrating how to connect to an ArgoCD instance using argocd-dotnet-client
and retrieve version information. Please note that you need to replace your_argocd_url
and your_auth_token
with your actual values.
First, you need to create an ArgoCDClient
instance:
- if you have auth token:
var client = new ArgoCDClient("https://argocd.example.com", "your_auth_token");
using ArgoCD.Client;
using ArgoCD.Client.Models.Version.Responses;
using System;
using System.Threading.Tasks;
public class Program
{
public static async Task Main(string[] args)
{
string argocdUrl = "https://argocd.example.com"; // Replace with your ArgoCD instance URL
string authToken = "your_auth_token"; // Replace with your authentication token
// Create ArgoCD client instance
IArgoCDClient argoCDClient = new ArgoCDClient(argocdUrl, authToken);
// Get ArgoCD version information
1VersionMessage version = await argoCDClient.Version.GetVersionAsync();
Console.WriteLine($"ArgoCD Version: {version.BuildDate}");
Console.WriteLine($"ArgoCD Git Commit: {version.GitCommit}");
Console.WriteLine($"ArgoCD Go Version: {version.GoVersion}");
}
}
More Usage:
The IArgoCDClient
interface provides access to various ArgoCD APIs. You can call the corresponding client interfaces as needed to perform operations, for example:
- Application Management:
argoCDClient.Application.CreateAsync(...)
,argoCDClient.Application.GetAsync(...)
,argoCDClient.Application.SyncAsync(...)
- Cluster Management:
argoCDClient.Cluster.CreateAsync(...)
,argoCDClient.Cluster.DeleteAsync(...)
- Project Management:
argoCDClient.Project.CreateAsync(...)
,argoCDClient.Project.GetAsync(...)
Please refer to the interface definition files (IAccountClient.cs
, IApplicationClient.cs
, etc.) in the src/ArgoCD.Client
directory for all available methods and parameters.
- This library is still in the development stage, and most of the resources are not completed test. Everyone contribute is very much needed. 🙋♂️
If you have an issue: report it on the issue tracker
Licensed under the MIT License. See LICENSE for details.