utils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecodeFields = map[string]string{
	"ID":            "id",
	"Type":          "type",
	"Username":      "username",
	"Password":      "password",
	"Token":         "token",
	"Host":          "host",
	"Tenant":        "tenant",
	"AuthURL":       "auth_url",
	"AuthVersion":   "auth_version",
	"Domain":        "domain",
	"ServiceRegion": "service_region",
}

DecodeFields ..

Functions

func MakeRequest

func MakeRequest(request Request) (body []byte, statusCode int, err error)

MakeRequest function based on inputs

Types

type Conf

type Conf struct {
	Im           ConfIM           `yaml:"im"`
	Cloud        ConfCloud        `yaml:"cloud"`
	AllowRefresh TokenRefreshConf `yaml:"allowrefresh,omitempty"`
}

Conf ..

func (*Conf) CreateInf

func (clientConf *Conf) CreateInf(template []byte) (infID string, err error)

CreateInf is a wrapper for Infrastructure creation

func (*Conf) DestroyInf

func (clientConf *Conf) DestroyInf(infID string) error

DestroyInf is a wrapper for Infrastructure creation

func (*Conf) GetAccessToken

func (clientConf *Conf) GetAccessToken(refreshToken string) (token string, err error)

GetAccessToken ..

func (Conf) GetConf

func (clientConf Conf) GetConf(path string) Conf

GetConf ..

func (*Conf) GetInfOutputs

func (clientConf *Conf) GetInfOutputs(infID string) (outputs map[string]string, err error)

GetInfOutputs get ...

func (*Conf) GetInfVMStates

func (clientConf *Conf) GetInfVMStates(infID string, vm string) (status string, err error)

GetInfVMStates get ...

func (Conf) GetNewToken

func (clientConf Conf) GetNewToken() (updatedConf Conf, err error)

GetNewToken ..

func (*Conf) GetRefreshToken

func (clientConf *Conf) GetRefreshToken() (RefreshToken string, err error)

GetRefreshToken ..

func (*Conf) ListInfIDs

func (clientConf *Conf) ListInfIDs() (infIDs []map[string]string, err error)

ListInfIDs ..

func (*Conf) PrepareAuthHeaders

func (clientConf *Conf) PrepareAuthHeaders() string

PrepareAuthHeaders ..

func (*Conf) UpdateInf

func (clientConf *Conf) UpdateInf(infID string, template []byte) error

UpdateInf ..

func (*Conf) Validate

func (clientConf *Conf) Validate(template []byte) error

Validate TOSCA template

type ConfCloud

type ConfCloud struct {
	ID            string `yaml:"id"`
	Type          string `yaml:"type"`
	Username      string `yaml:"username"`
	Password      string `yaml:"password"`
	Host          string `yaml:"host"`
	Tenant        string `yaml:"tenant"`
	AuthURL       string `yaml:"auth_url,omitempty"`
	AuthVersion   string `yaml:"auth_version"`
	Domain        string `yaml:"domain,omitempty"`
	ServiceRegion string `yaml:"service_region,omitempty"`
}

ConfCloud ...

type ConfIM

type ConfIM struct {
	ID       string `yaml:"id"`
	Type     string `yaml:"type"`
	Host     string `yaml:"host"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
	Token    string `yaml:"token,omitempty"`
}

ConfIM ..

type ListIDStruct

type ListIDStruct struct {
	InfIDs []map[string]string `json:"uri-list"`
}

ListIDStruct ..

type OutputsStruct

type OutputsStruct struct {
	Outputs map[string]string `json:"outputs"`
}

OutputsStruct ...

type RefreshRequest

type RefreshRequest struct {
	Endpoint     string
	Audience     string
	ClientID     string
	ClientSecret string
	RefreshToken string
	AccessToken  string
}

RefreshRequest ..

type RefreshTokenStruct

type RefreshTokenStruct struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
}

RefreshTokenStruct ..

type Request

type Request struct {
	URL         string
	RequestType string
	Headers     map[string]string
	AuthUser    string
	AuthPwd     string
	Content     []byte
	Timeout     time.Duration
}

Request input struct

type StatusStruct

type StatusStruct struct {
	Status string `json:"contmsg"`
}

StatusStruct ...

type TokenRefreshConf

type TokenRefreshConf struct {
	ClientID         string `yaml:"client_id"`
	ClientSecret     string `yaml:"client_secret"`
	IAMTokenEndpoint string `yaml:"iam_endpoint"`
	RefreshTokenFile string `yaml:"refresh_file"`
	AccessTokenFile  string `yaml:"access_file"`
}

TokenRefreshConf ..

Jump to

Keyboard shortcuts

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