cli

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hdc_dir     = ".hdc"
	Config_file = "config"
)

Variables

View Source
var (
	FlDebug = cli.BoolFlag{
		Name:   "debug",
		Usage:  "debug mode",
		EnvVar: "DEBUG",
	}
	FlCBServer = cli.StringFlag{
		Name:   "server",
		Usage:  "server address",
		EnvVar: "CB_SERVER_ADDRESS",
	}
	FlCBUsername = cli.StringFlag{
		Name:   "username",
		Usage:  "user name (e-mail address)",
		EnvVar: "CB_USER_NAME",
	}
	FlCBPassword = cli.StringFlag{
		Name:   "password",
		Usage:  "password",
		EnvVar: "CB_PASSWORD",
	}
	FlCBInputJson = cli.StringFlag{
		Name:  "cli-input-json",
		Usage: "user provided file with json content",
	}
	FlCBClusterName = cli.StringFlag{
		Name:  "cluster-name",
		Usage: "name of a cluster",
	}
	FlCBWait = cli.StringFlag{
		Name:  "wait",
		Usage: "wait for the operation to finish",
	}
)
View Source
var (
	Version   string
	BuildTime string
)
View Source
var ClusterSkeletonListHeader []string = []string{"Cluster Name", "Status", "HDP Version", "Cluster Type"}
View Source
var LoggedTransportConfig = httplogger.NewLoggedTransport(TransportConfig, newLogger())
View Source
var PREFIX_TRIM []string = []string{"http://", "https://"}
View Source
var SECURITY_GROUP_DEFAULT_PORTS = []string{"22", "443", "9443"}
View Source
var TransportConfig = &http.Transport{
	Proxy:           http.ProxyFromEnvironment,
	TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	Dial: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).Dial,
	TLSHandshakeTimeout:   10 * time.Second,
	ExpectContinueTimeout: 1 * time.Second,
}

This is nearly identical with http.DefaultTransport

Functions

func Configure

func Configure(c *cli.Context) error

func CreateCluster

func CreateCluster(c *cli.Context) error

func DescribeCluster

func DescribeCluster(c *cli.Context) error

func GenerateCreateClusterSkeleton

func GenerateCreateClusterSkeleton(c *cli.Context) error

func GetHomeDirectory

func GetHomeDirectory() string

func ListBlueprints

func ListBlueprints(c *cli.Context) error

func ListClusters

func ListClusters(c *cli.Context) error

func SafeInt32Convert

func SafeInt32Convert(value *int32) int32

func SafeStringConvert

func SafeStringConvert(value *string) string

func TerminateCluster

func TerminateCluster(c *cli.Context) error

func ValidateCreateClusterSkeleton

func ValidateCreateClusterSkeleton(c *cli.Context) error

func WriteConfigToFile

func WriteConfigToFile(server string, username string, password string) error

func WriteTable

func WriteTable(header []string, tableRows []TableRow)

Types

type Cloudbreak

type Cloudbreak struct {
	Cloudbreak *apiclient.Cloudbreak
}

func NewOAuth2HTTPClient

func NewOAuth2HTTPClient(address string, username string, password string) (*Cloudbreak, error)

NewHTTPClient creates a new cloudbreak HTTP client.

func (*Cloudbreak) CopyDefaultCredential

func (c *Cloudbreak) CopyDefaultCredential(skeleton ClusterSkeleton, channel chan int64, wg *sync.WaitGroup)

func (*Cloudbreak) CopyDefaultNetwork

func (c *Cloudbreak) CopyDefaultNetwork(skeleton ClusterSkeleton, channel chan int64, wg *sync.WaitGroup)

func (*Cloudbreak) CreateCredential

func (c *Cloudbreak) CreateCredential(defaultCredential models.CredentialResponse, existingKey string) int64

func (*Cloudbreak) CreateNetwork

func (c *Cloudbreak) CreateNetwork(defaultNetwork models.NetworkJSON) int64

func (*Cloudbreak) CreateSecurityGroup

func (c *Cloudbreak) CreateSecurityGroup(skeleton ClusterSkeleton, channel chan int64, wg *sync.WaitGroup)

func (*Cloudbreak) CreateTemplate

func (c *Cloudbreak) CreateTemplate(skeleton ClusterSkeleton, channel chan int64, wg *sync.WaitGroup)

func (*Cloudbreak) GetBlueprintId

func (c *Cloudbreak) GetBlueprintId(name string) int64

func (*Cloudbreak) GetCredential

func (c *Cloudbreak) GetCredential(name string) models.CredentialResponse

func (*Cloudbreak) GetNetwork

func (c *Cloudbreak) GetNetwork(name string) models.NetworkJSON

func (*Cloudbreak) GetSecurityDetails

func (c *Cloudbreak) GetSecurityDetails(client *Cloudbreak, stack *models.StackResponse) (securityMap map[string][]*models.SecurityRule, err error)

type ClusterSkeleton

type ClusterSkeleton struct {
	ClusterName              string         `json:"ClusterName" yaml:"ClusterName"`
	HDPVersion               string         `json:"HDPVersion" yaml:"HDPVersion"`
	ClusterType              string         `json:"ClusterType" yaml:"ClusterType"`
	Master                   InstanceConfig `json:"Master" yaml:"Master"`
	Worker                   InstanceConfig `json:"Worker" yaml:"Worker"`
	InstanceCount            int32          `json:"InstanceCount" yaml:"InstanceCount"`
	SSHKeyName               string         `json:"SSHKeyName" yaml:"SSHKeyName"`
	RemoteAccess             string         `json:"RemoteAccess" yaml:"RemoteAccess"`
	WebAccess                bool           `json:"WebAccess" yaml:"WebAccess"`
	ClusterAndAmbariUser     string         `json:"ClusterAndAmbariUser" yaml:"ClusterAndAmbariUser"`
	ClusterAndAmbariPassword string         `json:"ClusterAndAmbariPassword" yaml:"ClusterAndAmbariPassword"`

	Status       string `json:"Status,omitempty" yaml:"Status,omitempty"`
	StatusReason string `json:"StatusReason,omitempty" yaml:"StatusReason,omitempty"`
}

func AssembleClusterSkeleton

func AssembleClusterSkeleton(c *cli.Context) ClusterSkeleton

func FetchCluster

func FetchCluster(client *Cloudbreak, stack *models.StackResponse) (*ClusterSkeleton, error)

func (*ClusterSkeleton) DataAsStringArray

func (c *ClusterSkeleton) DataAsStringArray() []string

func (*ClusterSkeleton) Json

func (c *ClusterSkeleton) Json() string

func (*ClusterSkeleton) JsonPretty

func (c *ClusterSkeleton) JsonPretty() string

func (*ClusterSkeleton) Validate

func (s *ClusterSkeleton) Validate() error

func (*ClusterSkeleton) Yaml

func (c *ClusterSkeleton) Yaml() string

type Config

type Config struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	Server   string `json:"server" yaml:"server"`
}

func ReadConfig

func ReadConfig() (*Config, error)

func (Config) Json

func (c Config) Json() string

func (Config) Yaml

func (c Config) Yaml() string

type ErrorMessage

type ErrorMessage struct {
	Message         string            `json:"message"`
	ValidationError map[string]string `json:"validationErrors"`
}

func (*ErrorMessage) String

func (e *ErrorMessage) String() string

type GenericRow

type GenericRow struct {
	Data []string
}

func (*GenericRow) DataAsStringArray

func (r *GenericRow) DataAsStringArray() []string

type InstanceConfig

type InstanceConfig struct {
	InstanceType string `json:"InstanceType" yaml:"InstanceType"`
	VolumeType   string `json:"VolumeType" yaml:"VolumeType"`
	VolumeSize   int32  `json:"VolumeSize" yaml:"VolumeSize"`
	VolumeCount  int32  `json:"VolumeCount" yaml:"VolumeCount"`
	// contains filtered or unexported fields
}

type TableRow

type TableRow interface {
	DataAsStringArray() []string
}

Jump to

Keyboard shortcuts

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