https://github.com/operator-framework/go-appr
Go client bindings for App Registry
https://github.com/operator-framework/go-appr
Last synced: 4 months ago
JSON representation
Go client bindings for App Registry
- Host: GitHub
- URL: https://github.com/operator-framework/go-appr
- Owner: operator-framework
- Created: 2018-09-14T17:22:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T11:53:35.000Z (almost 6 years ago)
- Last Synced: 2024-12-25T20:26:17.662Z (6 months ago)
- Homepage:
- Size: 30.3 KB
- Stars: 5
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-appr
This package is a collection of `go-swagger` generated client bindings for `App Registry` which can be used to talk to `quay.io` or [appr](https://github.com/app-registry/appr) to pull down application packages.Swagger spec file has been obtained from here - [appr-api-swagger.yaml](https://github.com/app-registry/appr/blob/master/Documentation/server/appr-api-swagger.yaml)
### Example
Below is an example of how you can use the client bindings to connect to an `app registry` server and invoke its APIs. This example assumes that an instance of `appr` is running on your machine (`localhost:5000`). For more information on how to run `appr` server on local environment visit https://github.com/app-registry/appr```go
package mainimport (
"log"httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
apprclient "github.com/operator-framework/go-appr/appregistry"
"github.com/operator-framework/go-appr/appregistry/package_appr"models "github.com/operator-framework/go-appr/models"
)func main() {
client := apprclient.New(httptransport.New("localhost:5000", "/cnr", []string{"http"}), strfmt.Default)packages, err := listPackages(client)
if err != nil {
log.Fatalf("error - %v", err)
}log.Printf("success - found [%d] package(s)\n", len(packages))
}func listPackages(client *apprclient.Appregistry) (models.Packages, error) {
params := package_appr.NewListPackagesParams()packages, err := client.PackageAppr.ListPackages(params)
if err != nil {
return nil, err
}return packages.Payload, nil
}
```## Generate Client Bindings
```
This section is applicable if you want to regenerate the client bindings.
```[go-swagger](https://github.com/go-swagger/go-swagger) is a prerequisite before you can generate client bindings.
First, install `go-swagger`.
```bash
go get -u github.com/go-swagger/go-swagger/cmd/swagger
```Next, run `go-swagger` to generate client bindings, as shown below.
```bash
# change directory to the root of the go-appr repo.
swagger generate client --spec=./appr.spec.yaml --name=appregistry --api-package=appr --client-package=appregistry
```