Code Monkey home page Code Monkey logo

golang-zhmcclient's Introduction

golang-zhmcclient

zhmcclient - A golang client library for the IBM Z HMC Web Services API

Generate Fake APIs

cd ./pkg/zhmcclient
go get github.com/maxbrunsfeld/counterfeiter/v6
export COUNTERFEITER_NO_GENERATE_WARNING=true
go generate ./...

Build

make sample-build
make sample-build-mac
make sample-build-docker

Unit Test

# 'FILE' corresponds to the filename w/o .go extentsion
# 'PKG' package to be tested
# If only PKG is provided all files (go modules) under the package will be tested
make unit-test PKG=pkg/zhmcclient FILE=lpar

Sample Usage

make sample-build
export HMC_ENDPOINT="https://192.168.195.118:6794"
export HMC_USERNAME=${username}
export HMC_PASSWORD=${password}
./bin/sample

or

make sample-build-mac
export HMC_ENDPOINT="https://192.168.195.118:6794"
export HMC_USERNAME=${username}
export HMC_PASSWORD=${password}
./bin/sample-mac

Contributing

Third party contributions to this project are welcome!

In order to contribute, create a Git pull request, considering this:

  • Test is required.
  • Each commit should only contain one "logical" change.
  • A "logical" change should be put into one commit, and not split over multiple commits.
  • Large new features should be split into stages.
  • The commit message should not only summarize what you have done, but explain why the change is useful.
  • The commit message must follow the format explained below.

What comprises a "logical" change is subject to sound judgement. Sometimes, it makes sense to produce a set of commits for a feature (even if not large). For example, a first commit may introduce a (presumably) compatible API change without exploitation of that feature. With only this commit applied, it should be demonstrable that everything is still working as before. The next commit may be the exploitation of the feature in other components.

For further discussion of good and bad practices regarding commits, see:

License

The zhmcclient package is licensed under the Apache 2.0 License.

golang-zhmcclient's People

Contributors

ajaypvictor avatar andy-maier avatar bjzhangl avatar carychencn avatar d-jeffries avatar huoqifeng avatar irappa-pattar avatar jiangphcn avatar liudalibj avatar rahulb3521 avatar rahulbhalla3521 avatar raja-sekhar-r avatar samyuanatibm avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

golang-zhmcclient's Issues

Fix lint errors

Fix the golangci-lint errors in https://github.com/zhmcclient/golang-zhmcclient/actions/runs/6333842494/job/17202544924, as below:

run golangci-lint
Running [/home/runner/golangci-lint-1.54.2-linux-amd64/golangci-lint run --out-format=colored-line-number,github-actions] in [] ...
Error: pkg/zhmcclient/client.go:370:10: Error return value of c.Logon is not checked (errcheck)
c.Logon()
^
Error: pkg/zhmcclient/client.go:371:18: Error return value of c.executeUpload is not checked (errcheck)
c.executeUpload(requestType, url.String(), requestData)
^
Error: pkg/zhmcclient/client.go:403:10: Error return value of c.Logon is not checked (errcheck)
c.Logon()
^
pkg/zhmcclient/client.go:1: File is not gofmt-ed with -s (gofmt)

Error: sample.go:401:6: ineffectual assignment to processorMode (ineffassign)
var processorMode zhmcclient.PartitionProcessorMode = ""
^
Error: pkg/zhmcclient/model.go:24:2: SA9004: only the first constant in this group has an explicit type (staticcheck)
ADAPTER_FAMILY_HIPERSOCKET AdapterFamily = "hipersockets"
^
Error: pkg/zhmcclient/model.go:35:2: SA9004: only the first constant in this group has an explicit type (staticcheck)
ADAPTER_TYPE_CRYPTO AdapterType = "crypto"
^
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA9004: only the first constant in this group has an explicit type (staticcheck)
Error: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)

Error: issues found
Ran golangci-lint in 3663ms

Setup PR checks

  • Setup GHA for PR
  • Do golang lint
  • Do unit test for each PR
  • Do vulnerability check

Settings to protect the default branch

  • Set master as default branch
  • Disable direct push and force push for master branch
  • Enable PR for master branch and enforce at least approval from 2 writers or maintainers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.