bluemix

package module
v0.0.0-...-b49bb61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2017 License: Apache-2.0 Imports: 4 Imported by: 272

README

Bluemix SDK for Go

Installing

  1. Install the SDK using the following command

    go get github.com/IBM-Bluemix/bluemix-go

  2. Update the SDK to the latest version using the following command

    go get -u github.com/IBM-Bluemix/bluemix-go

Using the SDK

You must a have working Bluemix account to use the APIs. Sign up if you don't have one.

The SDK has examples folder which cites few examples on how to use the SDK. First you need to create a session.

import "github.com/IBM-Bluemix/bluemix-go/session"

   func main(){

    s := session.New()

   }
   .....

Creating session in this way creates a default configuration which reads the value from the environment variables. You must export the following environment variables.

  • IBMID - This is the IBM ID
  • IBMID_PASSWORD - This is the password for the above ID

OR

  • BM_API_KEY/BLUEMIX_API_KEY - This is the Bluemix API Key. Login to Bluemix to create one if you don't already have one. Follow Manage -> Account -> Users. Click on Bluemix API Keys

The default region is us_south. You can override it in the Config struct. You can also provide the value via environment variables; either via BM_REGION or BLUEMIX_REGION. Valid regions are -

  • us-south
  • eu-gb
  • eu-de
  • au-syd

Documentation

Index

Constants

View Source
const (
	//ErrMissingRegionCode ..
	ErrMissingRegionCode = "MissingRegion"

	//ErrInvalidConfigurationCode ..
	ErrInvalidConfigurationCode = "InvalidConfiguration"

	//ErrInsufficientCredentials ..
	ErrInsufficientCredentials = "InsufficientCredentials"
)
View Source
const Version = "0.1"

Version is the SDK version

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IBMID string

	IBMIDPassword string

	BluemixAPIKey string

	IAMAccessToken  string
	IAMRefreshToken string
	UAAAccessToken  string
	UAARefreshToken string

	//Region is optional. If region is not provided then endpoint must be provided
	Region string
	//Endpoint is optional. If endpoint is not provided then endpoint must be obtained from region via EndpointLocator
	Endpoint *string
	//TokenProviderEndpoint is optional. If endpoint is not provided then endpoint must be obtained from region via EndpointLocator
	TokenProviderEndpoint *string
	EndpointLocator       endpoints.EndpointLocator
	MaxRetries            *int
	RetryDelay            *time.Duration

	HTTPTimeout time.Duration

	Debug bool

	HTTPClient *http.Client

	SSLDisable bool
}

Config ...

func (*Config) Copy

func (c *Config) Copy(mccpgs ...*Config) *Config

Copy allows the configuration to be overriden or added Typically the endpoints etc

func (*Config) ValidateConfigForService

func (c *Config) ValidateConfigForService(svc ServiceName) error

ValidateConfigForService ...

type ServiceName

type ServiceName string

ServiceName ..

const (
	//AccountService ...
	AccountService ServiceName = ServiceName("account")
	//AccountServicev1 ...
	AccountServicev1 ServiceName = ServiceName("accountv1")
	//MccpService ...
	MccpService ServiceName = ServiceName("mccp")
	//ContainerService ...
	ContainerService ServiceName = ServiceName("container")
	//UAAService ...
	UAAService ServiceName = ServiceName("uaa")
	//IAMService ...
	IAMService ServiceName = ServiceName("iam")
	//IAMPAPService
	IAMPAPService ServiceName = ServiceName("iampap")
)

Directories

Path Synopsis
api
Package client provides a generic client to be used by all services
Package client provides a generic client to be used by all services
examples
mccp/app command
mccp/route command
mccp/service command
mccp/space command
mccp/spacequota command
Sending request:
Sending request:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL