Giter Club home page Giter Club logo

go-arty's Introduction

go-arty

GoDoc Go Report Card codecov

go-arty is a Go client library for accessing the Artifactory and Xray API.

Artifactory

Usage

With Go Modules

import "github.com/target/go-arty/v2/artifactory"

Without Go Modules

import "github.com/target/go-arty/artifactory"

Construct a new Artifactory client, then use the various services on the client to access different parts of the Artifactory API. For example:

client, _ := artifactory.NewClient("artifactory.company.com", nil)

// list all users from the artifactory server
users, _, err := client.Users.GetAllSecurity()

Authentication

The artifactory package allows you to pass basic auth or an API Key.

Example using basic auth:

client, _ := artifactory.NewClient("artifactory.company.com", nil)

client.Authentication.SetBasicAuth("username", "password")

Example using API Key:

client, _ := artifactory.NewClient("artifactory.company.com", nil)

client.Authentication.SetTokenAuth("token")

Xray

Usage

With Go Modules

import "github.com/target/go-arty/v2/xray"

Without Go Modules

import "github.com/target/go-arty/xray"

Construct a new Xray client, then use the various services on the client to access different parts of the Xray API. For example:

client, _ := xray.NewClient("artifactory.company.com", nil)

// list all users from the xray server
users, _, err := client.Users.GetAll()

Authentication

The xray package allows you to pass basic auth or a token.

NOTE: To get the token for Xray, you have to hit an API endpoint that returns the token. See the docs for more info.

Example using basic auth:

client, _ := xray.NewClient("xray.company.com", nil)

client.Authentication.SetBasicAuth("username", "password")

Example using token:

client, _ := xray.NewClient("xray.company.com", nil)

client.Authentication.SetTokenAuth("token")

Creating/Updating Resources

All structs in this library use pointer values for all non-repeated fields. This allows distinguishing between unset fields and those set to a zero-value. Helper functions have been provided to easily create these pointers for string, bool, and int values. For example:

// create a new user named "admin"
user := &artifactory.SecurityUser{
	Name:     artifactory.String("admin"),
	Email:    artifactory.String("[email protected]"),
	Password: artifactory.String("secretPassword"),
	Admin:    artifactory.Bool(true),
}

client.Users.CreateSecurity(user)

Users who have worked with protocol buffers should find this pattern familiar.

Versioning

In general, go-arty follows semantic versioning as closely as we can for tagging releases of the package. For self-contained libraries, the application of semantic versioning is relatively straightforward and generally understood. But because go-arty is a client library for the Artifactory API and the Xray API, which both change behavior frequently, we've adopted the following versioning policy:

  • We increment the major version with any incompatible change to either package (artifactory or xray) in this library, including changes to the exported Go API surface or behavior of the API.
  • We increment the minor version with any backwards-compatible changes to functionality.
  • We increment the patch version with any backwards-compatible bug fixes.

Road map

This library was initially developed for internal applications at Target, so API methods will likely be added in the order that they are required.

Contributing

We always welcome new PRs! See Contributing for further instructions.

Bugs and Feature Requests

Found something that doesn't seem right or have a feature request? Please open a new issue.

Copyright and License

license

Copyright (c) 2018 Target Brands, Inc.

go-arty's People

Contributors

collisonchris avatar delta592 avatar dependabot[bot] avatar jbrockopp avatar joeh90 avatar jordansussman avatar kneal avatar

Watchers

 avatar

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.