bluemix

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

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

Go to latest
Published: Nov 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 269

README

IBM Cloud SDK for Go

Build Status GoDoc

bluemix-go provides the Go implementation for operating the IBM Cloud platform, which is based on the Cloud Foundry API.

Installing

  1. Install the SDK using the following command
go get github.com/IBM-Cloud/bluemix-go
  1. Update the SDK to the latest version using the following command
go get -u github.com/IBM-Cloud/bluemix-go

Using the SDK

You must have a working IBM Cloud 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-Cloud/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

  • IC_API_KEY/IBMCLOUD_API_KEY - This is the Bluemix API Key. Login to IBMCloud to create one if you don't already have one. See instructions below for creating an API Key.

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 IC_REGION or IBMCLOUD_REGION. Valid regions are -

  • us-south
  • us-east
  • eu-gb
  • eu-de
  • au-syd
  • jp-tok

The maximum retries is 3. You can override it in the Config struct. You can also provide the value via environment variable; via MAX_RETRIES

Creating an IBM Cloud API Key

First, navigate to the IBM Cloud console and use the Manage toolbar to access IAM.

Access IAM from the Manage toolbar

On the left, click "IBM Cloud API Keys"

Click IBM Cloud API Keys

Press "Create API Key"

Press Create API Key

Pick a name and description for your key

Set name and description

You have created a key! Press the eyeball to show the key. Copy or save it because keys can't be displayed or downloaded twice.

Your key is now created

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
	//ResourceGroupID
	ResourceGroup 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
	Visibility    string
	EndpointsFile string
	UserAgent     string
}

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")
	//CertificateManager ...
	CertificateManager ServiceName = ServiceName("certificate-manager")
	//CisService ...
	CisService ServiceName = ServiceName("cis")
	//ContainerService ...
	ContainerService ServiceName = ServiceName("container")
	//ContainerService ...
	VpcContainerService ServiceName = ServiceName("containerv2")
	//RegistryService ...
	ContainerRegistryService ServiceName = ServiceName("container-registry")
	//GlobalSearchService ...
	GlobalSearchService ServiceName = ServiceName("global-search")
	//GlobalTaggingService ...
	GlobalTaggingService ServiceName = ServiceName("global-tagging")
	//IAMService ...
	IAMService ServiceName = ServiceName("iam")
	//IAMPAPService
	IAMPAPService ServiceName = ServiceName("iampap")
	//IAMUUMService ...
	IAMUUMService ServiceName = ServiceName("iamuum")
	//IAMUUMServicev2 ...
	IAMUUMServicev2 ServiceName = ServiceName("iamuumv2")
	//IAMPAPServicev2 ...
	IAMPAPServicev2 ServiceName = ServiceName("iampapv2")
	//ICDService ...
	ICDService ServiceName = ServiceName("icd")
	//MccpService ...
	MccpService ServiceName = ServiceName("mccp")
	//resourceManagementService
	ResourceManagementService ServiceName = ServiceName("resource-management")
	//resourceManagementService
	ResourceManagementServicev2 ServiceName = ServiceName("resource-managementv2")
	//resourceControllerService
	ResourceControllerService ServiceName = ServiceName("resource-controller")
	//resourceControllerServicev2
	ResourceControllerServicev2 ServiceName = ServiceName("resource-controllerv2")
	//resourceCatalogService
	ResourceCatalogrService ServiceName = ServiceName("resource-catalog ")
	//UAAService ...
	UAAService ServiceName = ServiceName("uaa")
	//CSEService
	CseService ServiceName = ServiceName("cse")
	//SchematicsService ...
	SchematicsService ServiceName = ServiceName("schematics")
	//UserManagement ...
	UserManagement ServiceName = ServiceName("user-management")
	//HPCService ...
	HPCService ServiceName = ServiceName("hpcs")
	//FunctionsService ...
	FunctionsService ServiceName = ServiceName("functions")
)

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
Sending request:
Sending request:

Jump to

Keyboard shortcuts

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