A Simple library to deal with API REST
Technology | Project | How to Run | License
The objective of this project is to develop a an HTTP client library for defined REST API. You can found this the problem definition in the following links
The library is built using
- Go
- UUID
It provides a cohesive and straightforward interface to interact with a REST API, focusing on Deployments
resource.
kube-client
is an HTTP client library for a REST API that manages Deployments
resources. It supports POST
, GET
, and DELETE
operations and offers custom error handling for better user experience.
- Simple Client Initialization: Easily create a new instance of the client with custom configurations.
- CRUD Operations: Perform
POST
,GET
, andDELETE
operations onDeployments
. - Custom Error Handling: Receive detailed error messages to understand and debug issues better.
go get github.com/rafaelmgr12/kube-client
- Initialize the Client:
import "github.com/rafaelmgr12/kube-client/kube"
client := kube.NewClient(kube.WithBaseURL("http://api-url.com"), kube.WithTimeout(30))
- Create a Deployment
deployment := &deployment.Deployment{
Name: "example-deployment",
Namespace: "default",
Replicas: 3,
}
createdDeployment, err := client.CreateDeployment(deployment)
- Retrieve a Deployment:
deploymentID := "uuid-of-deployment"
retrievedDeployment, err := client.GetDeployment(deploymentID)
- Delete a Deployment:
deploymentID := "uuid-of-deployment"
err := client.DeleteDeployment(deploymentID)
For more detailed documentation, please refer to the Detailed Documentation.
The projects is under the MIT license. See the file LICENSE fore more details