ibmcloud

package
v0.0.0-...-e35233a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AccessPolicyTemplate = `` /* 544-byte string literal not displayed */
View Source
const CloudDirectoryUserTemplate = `{"active":true, "emails":[{"value":"%s", "primary":true}], "userName":"%s", "password":"%s"}`
View Source
const ClusterConfigTemplate = `` /* 216-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPolicy

type AccessPolicy struct {
	TotalResults int       `json:"total_results"`
	Limit        int       `json:"limit"`
	Resources    []IAMUser `json:"resources"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Configuration) *Client

func (*Client) CreateAccessPolicy

func (c *Client) CreateAccessPolicy(accountID, userID, clusterID string) (string, error)

CreateAccessPolicy creates an access policy for the cluster and assigns it to the user. Returns the id of the created policy.

func (*Client) CreateCloudDirectoryUser

func (c *Client) CreateCloudDirectoryUser(username string) (*CloudDirectoryUser, error)

CreateCloudDirectoryUser creates a new cloud directory user with the given username and generated email and password. If the given username is an empty string then it will be generated too.

func (*Client) CreateCluster

func (c *Client) CreateCluster(name, zone string, noSubnet bool) (*IBMCloudClusterRequest, error)

CreateCluster creates a cluster Returns the cluster ID

func (*Client) DeleteAccessPolicy

func (c *Client) DeleteAccessPolicy(id string) error

DeleteAccessPolicy deletes the access policy with the specified ID.

func (*Client) DeleteCloudDirectoryUser

func (c *Client) DeleteCloudDirectoryUser(id string) error

DeleteCloudDirectoryUser deletes the cloud directory user with the given ID.

func (*Client) DeleteCluster

func (c *Client) DeleteCluster(id string) error

DeleteCluster deletes the cluster with the given ID/name

func (*Client) DeleteIAMUser

func (c *Client) DeleteIAMUser(id string) error

DeleteIAMUser deletes the AIM user with the corresponding id (IAMUser.ID).

func (*Client) GetCluster

func (c *Client) GetCluster(id string) (*Cluster, error)

GetCluster fetches the cluster with the given ID/name

func (*Client) GetIAMUserByUserID

func (c *Client) GetIAMUserByUserID(userID string) (*IAMUser, error)

GetIAMUserByUserID fetches the AIM user with the corresponding user_id. Returns a Not Found Error if the user is not found.

func (*Client) GetToken

func (c *Client) GetToken() TokenSet

func (*Client) GetVlans

func (c *Client) GetVlans(zone string) ([]Vlan, error)

GetVlans fetches the list of vlans available in the zone

func (*Client) GetZones

func (c *Client) GetZones() ([]Location, error)

GetZones fetches the list of zones (data centers)

func (*Client) Token

func (c *Client) Token() (TokenSet, error)

Token returns IBM Cloud Token. If the token is expired or not obtained yet it will obtain a new one.

func (*Client) UpdateCloudDirectoryUserPassword

func (c *Client) UpdateCloudDirectoryUserPassword(id string) (*CloudDirectoryUser, error)

UpdateCloudDirectoryUserPassword sets a new generated password for the user with the given ID

type CloudDirectoryUser

type CloudDirectoryUser struct {
	ID        string  `json:"id"`
	Username  string  `json:"userName"`
	Emails    []Value `json:"emails"`
	ProfileID string  `json:"profileId"`
	Password  string
}

func (*CloudDirectoryUser) Email

func (u *CloudDirectoryUser) Email() string

type Cluster

type Cluster struct {
	ID                string  `json:"id"`
	Name              string  `json:"name"`
	Region            string  `json:"region"`
	CreatedDate       string  `json:"createdDate"`
	MasterKubeVersion string  `json:"masterKubeVersion"`
	WorkerCount       int     `json:"workerCount"`
	Location          string  `json:"location"`
	Datacenter        string  `json:"datacenter"`
	State             string  `json:"state"`
	Type              string  `json:"type"`
	Crn               string  `json:"crn"`
	Ingress           Ingress `json:"ingress"`
	MasterURL         string  `json:"masterURL"`
}

type Configuration

type Configuration interface {
	GetIBMCloudAPIKey() string
	GetIBMCloudApiCallRetrySec() int
	GetIBMCloudApiCallTimeoutSec() int
	GetIBMCloudAccountID() string
	GetIBMCloudTenantID() string
	GetIBMCloudIDPName() string
}

type IAMUser

type IAMUser struct {
	ID     string `json:"id"`
	IAMID  string `json:"iam_id"`
	UserID string `json:"user_id"`
	Email  string `json:"email"`
}

type IAMUserResult

type IAMUserResult struct {
	TotalResults int       `json:"total_results"`
	Limit        int       `json:"limit"`
	Resources    []IAMUser `json:"resources"`
}

type IBMCloudClusterRequest

type IBMCloudClusterRequest struct {
	ClusterID   string
	RequestID   string
	PublicVlan  string
	PrivateVlan string
}

type ICClient

type ICClient interface {
	GetVlans(zone string) ([]Vlan, error)
	GetZones() ([]Location, error)
	CreateCluster(name, zone string, noSubnet bool) (*IBMCloudClusterRequest, error)
	GetCluster(id string) (*Cluster, error)
	DeleteCluster(id string) error
	CreateCloudDirectoryUser(username string) (*CloudDirectoryUser, error)
	UpdateCloudDirectoryUserPassword(id string) (*CloudDirectoryUser, error)
	GetIAMUserByUserID(userID string) (*IAMUser, error)
	CreateAccessPolicy(accountID, userID, clusterID string) (string, error)
	DeleteAccessPolicy(id string) error
}

type ID

type ID struct {
	ID string `json:"id"`
}

type Ingress

type Ingress struct {
	Hostname string `json:"hostname"`
}

type Location

type Location struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Kind        string `json:"kind"`
	DisplayName string `json:"display_name"`
}

type TokenSet

type TokenSet struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	Expiration   int64  `json:"expiration"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
}

TokenSet represents a set of Access and Refresh tokens

type Value

type Value struct {
	Value string `json:"value"`
}

type Vlan

type Vlan struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

Jump to

Keyboard shortcuts

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