github.com/goharbor/go-client@v0.210.0/README.md (about)

     1  # go-client
     2  Client library with golang for accessing Harbor API.
     3  
     4  ## Download swagger spec by version
     5  
     6  Currently, the default Harbor version is `v2.10.0`.
     7  
     8  *NOTE* Default version need to be updated manually inside [Makefile](Makefile)
     9  
    10  To download swagger spec:
    11  
    12  ```sh
    13  make update-spec
    14  ```
    15  
    16  To download swagger spec from previous Harbor version, add `VERSION` as an argument:
    17  
    18  ```sh
    19  make update-spec VERSION=v2.10.0
    20  ```
    21  
    22  ## Generate Clients
    23  
    24  ```sh
    25  make gen-harbor-api VERSION=v2.10.0
    26  ```
    27  
    28  ## Check all available make commands
    29  
    30  ```sh
    31  make
    32  ```
    33  
    34  ## To use the Clients
    35  
    36  There is `ClientSet` defined inside `pkg/harbor/client.go` to construct Clients
    37  
    38  Create a `Config` first then use it to create `ClientSet`
    39  
    40  For Example:
    41  
    42  ```go
    43  c := Config{
    44  	URL: url,
    45  	Transport: tr,
    46  	AuthInfo: ai,
    47  }
    48  
    49  cs := NewClientSet(c)
    50  
    51  cs.V2() // v2 client
    52  ```