Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: apisix http client #147

Merged
merged 15 commits into from
Jan 8, 2021
Merged

Conversation

tokers
Copy link
Contributor

@tokers tokers commented Dec 30, 2020

Add package pkg/apisix.

Add Interface apisix.APISIX as the unique APISIX client interface.

The simple use example:

cli, err := apisix.NewForOptions(&apisix.ClusterOptions{
    Name: "default",
    BaseURL: "http://127.0.0.1:9080/apisix/admin",
    AdminKey: "0x123fff"
})
if err != nil {
    log.Errorf("failed to create apisix client: %s", err)
    return
}

// Resource operations.
cli.Cluster("default").Route().List()
cli.Cluster("default").Route().Create(ctx, route)
cli.Cluster("default").Route().Update(ctx, route)
cli.Cluster("default").Route().Delete(ctx, route)

// Cluster oerations
cli.AddCluster(clusterOptions)
cli.ListClusters()

@tokers tokers marked this pull request as draft December 30, 2020 07:47
@codecov-io
Copy link

codecov-io commented Dec 30, 2020

Codecov Report

Merging #147 (3f45041) into master (2a8e8a7) will increase coverage by 14.81%.
The diff coverage is 55.96%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #147       +/-   ##
===========================================
+ Coverage   34.55%   49.36%   +14.81%     
===========================================
  Files          28       29        +1     
  Lines        1314     1333       +19     
===========================================
+ Hits          454      658      +204     
+ Misses        830      594      -236     
- Partials       30       81       +51     
Impacted Files Coverage Δ
pkg/apisix/client.go 0.00% <0.00%> (ø)
pkg/seven/conf/conf.go 0.00% <0.00%> (ø)
pkg/seven/state/builder.go 0.00% <0.00%> (ø)
pkg/seven/state/service_worker.go 0.00% <0.00%> (ø)
pkg/seven/state/solver.go 3.38% <0.00%> (-0.12%) ⬇️
pkg/apisix/stub.go 37.31% <37.31%> (ø)
pkg/apisix/route.go 61.01% <61.01%> (ø)
pkg/apisix/ssl.go 63.79% <63.79%> (ø)
pkg/apisix/service.go 65.45% <65.45%> (ø)
cmd/ingress/ingress.go 78.35% <71.42%> (-0.54%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a8e8a7...3f45041. Read the comment docs.

pkg/apisix/resource_test.go Show resolved Hide resolved
pkg/apisix/stub.go Outdated Show resolved Hide resolved
pkg/apisix/resource.go Outdated Show resolved Hide resolved
pkg/ingress/controller/controller.go Show resolved Hide resolved
@tokers tokers merged commit e34e12b into apache:master Jan 8, 2021
@tokers tokers deleted the chore/apisix-http-client branch January 8, 2021 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants