github.com/pivotal-cf/go-pivnet/v6@v6.0.2/README.md (about)

     1  [![GoDoc](https://godoc.org/github.com/pivotal-cf/go-pivnet?status.svg)](https://godoc.org/github.com/pivotal-cf/go-pivnet)
     2  
     3  
     4  # go-pivnet API library
     5  
     6  A golang library for [Pivotal Network](https://network.pivotal.io).
     7  
     8  **NOTE**
     9  This library is intended to be used by pivnet-cli and pivnet-resource. If you are using this library on its own, be aware of possible breaking changes following new releases of pivnet-cli/resource.
    10  
    11  See also: [pivnet-cli](https://github.com/pivotal-cf/pivnet-cli)
    12  and [pivnet-resource](https://github.com/pivotal-cf/pivnet-resource).
    13  
    14  ## Usage
    15  
    16  See [example](https://github.com/pivotal-cf/go-pivnet/blob/master/example/main.go)
    17  for an executable example.
    18  
    19  ```go
    20  import pivnet github.com/pivotal-cf/go-pivnet/v5
    21  
    22  [...]
    23  
    24  config := pivnet.ClientConfig{
    25    Host:      pivnet.DefaultHost,
    26    Token:     "token-from-pivnet",
    27    UserAgent: "user-agent",
    28  }
    29  
    30  stdoutLogger := log.New(os.Stdout, "", log.LstdFlags)
    31  stderrLogger := log.New(os.Stderr, "", log.LstdFlags)
    32  
    33  verbose := false
    34  logger := logshim.NewLogShim(stdoutLogger, stderrLogger, verbose)
    35  
    36  client := pivnet.NewClient(config, logger)
    37  
    38  products, _ := client.Products.List()
    39  
    40  fmt.Printf("products: %v", products)
    41  ```
    42  
    43  ### Running the tests
    44  
    45  Install the ginkgo executable with:
    46  
    47  ```
    48  go get -u github.com/onsi/ginkgo/ginkgo
    49  ```
    50  
    51  The tests require a valid Pivotal Network API token and host.
    52  
    53  Refer to the
    54  [official docs](https://network.pivotal.io/docs/api#how-to-authenticate)
    55  for more details on obtaining a Pivotal Network API token.
    56  
    57  It is advised to run the acceptance tests against the Pivotal Network integration
    58  environment endpoint i.e. `HOST='https://pivnet-integration.cfapps.io'`.
    59  
    60  Run the tests with the following command:
    61  
    62  ```
    63  API_TOKEN=my-token \
    64  HOST='https://pivnet-integration.cfapps.io' \
    65  ./bin/test_all
    66  ```
    67  
    68  **NOTE**
    69   - If dependencies are not correct, the tests may not run correctly. You will have to run `GO111MODULE=on go mod vendor` first in this case.
    70  
    71  ### Contributing
    72  
    73  Please make all pull requests to the `develop` branch, and
    74  [ensure the tests pass locally](https://github.com/pivotal-cf/go-pivnet#running-the-tests).
    75  
    76  ### Project management
    77  
    78  The CI for this project can be found
    79  [here](https://p-concourse.wings.cf-app.com/teams/system-team-pivnet-resource-pivnet-resource-657d)
    80  and the scripts can be found in the
    81  [pivnet-resource-ci repo](https://github.com/pivotal-cf/pivnet-resource-ci).
    82  
    83  The roadmap is captured in [Pivotal Tracker](https://www.pivotaltracker.com/projects/1474244).