GithubHelp home page GithubHelp logo

alks-go's Introduction

alks-go

alks-go is a Go client library for accessing the ALKS API.

Documentation: GoDoc

Build Status: Build Status

alks-go requires Go version 1.7 or greater.

Usage

import "github.com/Cox-Automotive/alks-go"

Construct a new ALKS client, then use the various services on the client to access different parts of the ALKS API. Please note that session creation requires username and password. IAM role CRUD operations can work with either username and password or an STS session.

Username/Password Authentication

client, err := alks.NewClient("http://my.alks.url/rest", "username", "password", "my-acct", "my-role")

// create new STS
resp, err := client.CreateSession(2, false)

log.Printf("Session: %v ~~ %v ~~ %v", resp.AccessKey, resp.SecretKey, resp.SessionToken)

STS Authentication - Currently only used for IAM role CRUD

client, err := alks.NewSTSClient("http://my.alks.url/rest", "accessKey", "secretKey", "sessionToken", "account")

// create new role
resp, err := client.CreateIamRole("myRole", "Amazon EC2", false)

log.Printf("Role ARN: %v ~~ Role IP ARN: %v", resp.roleArn, resp.roleIPArn)
client, err := alks.NewSTSClient("http://my.alks.url/rest", "accessKey", "secretKey", "sessionToken", "account")

// create new trust role
resp, err := client.CreateIamTrustRole("myRole", "Cross Account", "arn:aws:iam::123456789123:role/test-role")

log.Printf("Role ARN: %v ~~ Role IP ARN: %v", resp.roleArn, resp.roleIPArn)

Some API methods don't require an account and role to be provided.

client, err := alks.NewClient("http://my.alks.url/rest", "username", "password", "", "")

// list all available account/roles
resp, err := client.GetAccounts()

for _,acct := range resp.Accounts{
    log.Printf("Account %v Role %v IAM %v", acct.Account, acct.Role, acct.IamActive)
}

Unit Tests

You can run the test with Make

make test

alks-go's People

Contributors

brianantonelli avatar ranga543 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.