ostack

package
v0.0.0-...-92f3312 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Interface to the openstack environment.

Index

Constants

View Source
const (
	CVT_DASHES bool = true  // convert dashes in json names to underbars
	NO_CVT     bool = false // do not convert dashes in json names (data may be unusable)

	ANY       int = 0xff // host types for List_hosts() -- list all types
	COMPUTE   int = 0x01 // include compute hosts
	SCHEDULE  int = 0x02 // include list of scheduler hosts
	NETWORK   int = 0x04 // include list of network hosts (ovs and L3)
	CELLS     int = 0x08 // include list of cells
	CONDUCTOR int = 0x10 // include list of conductor hosts
	CERT      int = 0x20 // include list of certification hosts
	AUTH      int = 0x40 // include list of authorisation hosts
	L3        int = 0x80 // include list of just L3 hosts (no ovs hosts)
)
View Source
const (
	EP_COMPUTE  int = 0 // end point types for get_endpoint()
	EP_IDENTITY     = iota
	EP_NETWORK      = iota
)
View Source
const (
	GO_STD_TIME string = "2006-01-02T15:04:05Z" // go's reference time in openstack format
)

Variables

This section is empty.

Functions

func Set_debugging

func Set_debugging(count int)

Allow debugging to be reset or switched off. Set high (20) to turn off, 0 to reset.

func Set_latency_debugging

func Set_latency_debugging(state bool)

func Unix_time

func Unix_time(os_time *string) (utime int64, err error)
	Unix_time accepts a human readable string from openstack (presumed to be in the format
    2014-08-18T02:34:48Z) and convert it into a usable, unix timestamp.

	If there is an error, err is set and the returned time will be 0.

Types

type End_pt

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

An endpoint: attachment point, port, interface, or whatever the virtualisation flavour of the week wants to call them.

func Mk_endpt

func Mk_endpt(id string, mac string, ip []*string, netid string, proj *string, phost *string) *End_pt

Create an endpoint struct.

func (*End_pt) Get_ip

func (ep *End_pt) Get_ip(n int) *string

Get ip adderess

func (*End_pt) Get_ip_copy

func (ep *End_pt) Get_ip_copy() []*string

Get a copy of the ip list

func (*End_pt) Get_mac

func (ep *End_pt) Get_mac() *string

Get mac address

func (*End_pt) Get_netid

func (ep *End_pt) Get_netid() *string

Return the network ID

func (*End_pt) Get_phost

func (ep *End_pt) Get_phost() *string

Get physical host

func (*End_pt) Get_project

func (ep *End_pt) Get_project() *string

Get project id

func (*End_pt) Is_router

func (ep *End_pt) Is_router() bool

Returns true if the endpoint is a router.

func (*End_pt) Set_router

func (ep *End_pt) Set_router(flag bool)

By default and endpoint isn't a router, but this allows the router flag to be set.

func (*End_pt) String

func (ep *End_pt) String() string

Implement stringer.

type Ost_os_port

type Ost_os_port struct {
	Status        string
	Bind_host_id  string `json:"binding:host_id"` // assume this is the physical host name
	Bind_vif_type string `json:"binding:vif_type"`
	//Bind_capabilities	port_abilities	`json:"binding:capabilities"`
	Name string
	//Admin_state_up bool
	Network_id string
	Tenant_id  string
	//extra_dhcp_opts [] ???
	Device_owner string
	Mac_address  string
	Fixed_ips    []*ost_fixed_ip
	Id           string
	//Security_groups []string
	Device_id string
}

type Ostack

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

Returned by a call to Authorise() and is used to manage interactions with openstack based on the set of credentials that was passed to Authorise. This struct is the primary target of the majority of the calls in this package.

func Mk_ostack

func Mk_ostack(host *string, user *string, passwd *string, project *string) (o *Ostack)

Backwardly compatable constructor to default to nil region if it's not important to the user.

func Mk_ostack_region

func Mk_ostack_region(host *string, user *string, passwd *string, project *string, region *string) (o *Ostack)

Build the main object which is then used to drive each type of request.

Region is the value used to suss out various endpoints. If nil is given, then the user may call Authorise_region() with a specific region, or use Authorise() to use the first in the list (default). If region is provided here, then it is used on a plain Authorise() call, or when the credentials are reauthenticated.

func (*Ostack) Authorise

func (o *Ostack) Authorise() (err error)

Backward compatible -- authorises for what ever is first in the list from a region perspective.

func (*Ostack) Authorise_region

func (o *Ostack) Authorise_region(region *string) (err error)

Sends an authorisation request to OpenStack and waits for it to return a token that can be used on subsequent calls. Err is set to non-nil if the credentials fail to authorise. Region points to a string used to identify the "region" of the keystone authorisation catalogue that should be used to snarf URLs for things. If it is nil, or points to "", then the first entry in the catalogue is used.

func (*Ostack) Authorise_region_v3

func (o *Ostack) Authorise_region_v3(region *string) (err error)

Sends an authorisation request to OpenStack and waits for it to return a token that can be used on subsequent calls. Err is set to non-nil if the credentials fail to authorise. Region points to a string used to identify the "region" of the keystone authorisation catalogue that should be used to snarf URLs for things. If it is nil, or points to "", then the first entry in the catalogue is used.

func (*Ostack) Authorise_v3

func (o *Ostack) Authorise_v3() (err error)

Backward compatible -- authorises for what ever is first in the list from a region perspective.

func (*Ostack) Crack_ptoken

func (o *Ostack) Crack_ptoken(token *string, project *string, use_v3 bool) (stuff *Ostack_tstuff, err error)

Accepts a token and sends a query to openstack to crack it open. Returns a structure with exposed fields for the caller to digest. (There are no functions associated with the cracked info structure.)

The use_v3 parameter causes the openstack indentity version 3 interface to be used in place of the version 2 interface.

func (*Ostack) Crack_token

func (o *Ostack) Crack_token(token *string) (stuff *Ostack_tstuff, err error)

Accepts a token and sends a query to openstack to crack it open. Returns a structure with exposed fields for the caller to digest. (There are no functions associated with the cracked info structure.)

This is the generic crack function and as such the following defaults apply:

  • openstack indentity version 2 interface is used
  • the project associated with the ostack struct used on the call is provided to scope the request.

See Crack_ptoken for ways to change the defaults.

func (*Ostack) Dump_cmd_response

func (o *Ostack) Dump_cmd_response(cmd string) error

Runs a command and dumps the json to stderr -- debugging mostly.

func (*Ostack) Dump_json

func (o *Ostack) Dump_json(uurl string) (err error)

func (*Ostack) Dup

func (o *Ostack) Dup(project *string) (dup *Ostack, err error)

Duplicate the object adding the project name passed and then authorise to get a token and to pick up chost information for the project.

func (*Ostack) Equals_id

func (o *Ostack) Equals_id(id *string) bool

Returns true if this object matches the passed in ID string.

func (*Ostack) Equals_name

func (o *Ostack) Equals_name(name *string) bool

Returns true if this object matches the passed in name string.

func (*Ostack) Expire

func (o *Ostack) Expire()

Allow the user to force the authorisation to be expired which will force a new authorisation on the next request.

func (*Ostack) FetchAllPorts

func (o *Ostack) FetchAllPorts(destfile string) (err error)

Fetch info for ALL ports (should be run by an admin user). Output is put in the named file.

func (*Ostack) FetchHostInfo

func (o *Ostack) FetchHostInfo(uuid *string) (response *string, err error)

FetchHostInfo returns host name for the port identified by uuid.

func (*Ostack) FetchPortInfo

func (o *Ostack) FetchPortInfo(uuid *string) (response *Ost_os_port, err error)

FetchPortInfo returns info for the port identified by uuid.

func (*Ostack) Get_endpoints

func (o *Ostack) Get_endpoints(vmid *string, phost *string) (epmap map[string]*End_pt, err error)
 	Generate endpoint (port/interface) information for one VM. Vmid is either the VM name or the
	UUID as openstack seems to accept either. Returns a map, indexed by the endpoint UUID
	of each port/interface that is associated with the named VM.

func (*Ostack) Get_interfaces

func (o *Ostack) Get_interfaces(vmid *string) (err error)

Get a list of interfaces for a VM. Requires compute 2.1 interface.

func (*Ostack) Get_project

func (o *Ostack) Get_project() (name *string, id *string)

Returns the project name and id

func (*Ostack) Get_service_url

func (o *Ostack) Get_service_url(svc int) *string

Return the url for the desired service as defined by the EP_ constants. Returns a pointer to the string, or nil if none or bad constant.

func (*Ostack) Get_tok

func (o *Ostack) Get_tok() string

Return the token that was generated for the object (testing)

func (*Ostack) Get_token

func (o *Ostack) Get_token() *string

----- testing things mostly ----

func (*Ostack) Get_user

func (o *Ostack) Get_user() *string

Returns the user name associated with the credential block.

func (*Ostack) Gw2extid

func (o *Ostack) Gw2extid(id *string) (extid *string, err error)

Gw2extid returns the external network ID given the gateway ID.

func (*Ostack) Gw2phost

func (o *Ostack) Gw2phost(id *string) (host *string, err error)

Gw2phost returns the physical host that the gateway (id) is running on. (Gateway is Openstack's term for L3 router.)

func (*Ostack) Insert_token

func (o *Ostack) Insert_token(tok *string)

Accept a token and put it in.

func (*Ostack) Is_expired

func (o *Ostack) Is_expired() bool

Test the expiration value in the set of credentials against the current time and return true if it is in the past.

func (*Ostack) Isadmin

func (o *Ostack) Isadmin() bool

Returns true if the username and password that were authorised seemed to have admin privs too.

func (*Ostack) List_enabled_hosts

func (o *Ostack) List_enabled_hosts(htype int) (hlist *string, err error)

Returns a space separated list of host names as a string. See List_Hosts for a description of values for htype. Only hosts which are indicated as both "up" and "enabled" are included in the list.

func (*Ostack) List_hosts

func (o *Ostack) List_hosts(htype int) (hlist *string, err error)

Generates a pointer to a string containing a space separated list of physical host names that are associated with the type(s) passed in. Htype is one or more of the following types OR'd together if desired:

L3, NETWORK, COMPUTE, SCHEDULE, AUTH, CONDUCTOR, CELLS, and CERT

Duplicates host names, hosts that might have different functions, are removed from the list. The credentials associated with the object must have admin privlidges or odd results (an empty list or nil pointer) will result.

func (*Ostack) List_l3_hosts

func (o *Ostack) List_l3_hosts(udup_list map[string]bool, limit2neutron bool) (hlist *string, dup_map map[string]bool, err error)

List_l3_hosts generates a string containing a space separated list of physical host names which are associated with only L3 hosts.

Udup_list is a map of host names that have already been encountered (dups) and should be ignored; it can be nil. The dup map generated is returned.

func (*Ostack) List_net_hosts

func (o *Ostack) List_net_hosts(udup_list map[string]bool, limit2neutron bool) (hlist *string, dup_map map[string]bool, err error)

List_net_hosts generates a string containing a space separated list of physical host names which are associated with the particular type of agent(s) that are passed in.

Udup_list is a map of host names that have already been encountered (dups) and should be ignored; it can be nil. The dup map generated is returned.

func (*Ostack) Map_all_tenants

func (o *Ostack) Map_all_tenants() (name2id map[string]*string, id2name map[string]*string, err error)

Uses keystone to map all of the known tenants, not just the one that the token has been assigned to. If the identity admin host (iahost) isn't specificed when the ostack struct was created and authorised, then this function is just a passthrough to the map tenants function and will return just a list of tenants that the user has the ability to see rather than a list of all tenants.

func (*Ostack) Map_endpoints

func (o *Ostack) Map_endpoints(umap map[string]*End_pt) (epmap map[string]*End_pt, err error)

Creates a map of endpoints indexed by the endpoint ID for every VM in the project referenced by the ostack struct. If umap is passed in, the new endpoints are added to that map otherwise a map is created and returned.

func (*Ostack) Map_gw_endpoints

func (o *Ostack) Map_gw_endpoints(umap map[string]*End_pt) (epmap map[string]*End_pt, err error)

Requests router (gateway in openstack lingo) information for the project associated with the creds, an builds a list of endpoints for each. If umap is not nil, then the map is added to and returned, otherwise a new map is created. Relies on the ostack_net.go functions to make the api call.

func (*Ostack) Map_roles

func (o *Ostack) Map_roles() (rmap map[string]*string, err error)

Builds a map of the role names to ID strings.

func (*Ostack) Map_tenants

func (o *Ostack) Map_tenants() (name2id map[string]*string, id2name map[string]*string, err error)

Requests information from openstack and build a list of tenant names that we have access to. The return is two maps: names to IDs and IDs to names.

func (*Ostack) Map_user_groles

func (o *Ostack) Map_user_groles() (rmap map[string]*string, err error)

Map the global roles assigned to the user associated with the structure. This may not always work -- depends on flavour of openstack it seems -- and if it fails it seems to affect subsequent calls to roles (huh?).

func (*Ostack) Map_user_roles

func (o *Ostack) Map_user_roles(pid *string) (rmap map[string]*string, err error)

Map the roles assigned to the user and given project (must be id). If pid is nil then the project ID associated with the struct (returned on auth) will be used.

func (*Ostack) Map_vm_info

func (o *Ostack) Map_vm_info(umap map[string]*VM_info) (info map[string]*VM_info, err error)

Returns a map of VM information keyed by VM id. If umap is passed in (not nil), then the information is added to that map, otherwise a new map is created.

func (*Ostack) Mk_fip2ip

func (o *Ostack) Mk_fip2ip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map which translates floating (external) IP address to ip addresses. If deftab is not nil it is extended, otherwise a new table is created.

func (*Ostack) Mk_fip2tip

func (o *Ostack) Mk_fip2tip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map which translates floating (external) IP address to tenant/ip addresses. If deftab is not nil it is extended, otherwise a new table is created.

func (*Ostack) Mk_fip_maps

func (o *Ostack) Mk_fip_maps(
	def_ip2fip map[string]*string,
	def_fip2ip map[string]*string,
	inc_tenant bool) (
	ip2fip map[string]*string,
	fip2ip map[string]*string,
	err error)

Generate both the IP to floating IP map and the floating IP to IP map. Tennant ID is included as a part of the IP address if the parameter inc_tenant is true. Using this function reduces overhead as only one call to openstack for the information is needed per tenant.

func (*Ostack) Mk_gwlist

func (o *Ostack) Mk_gwlist() (gwlist []string, err error)

Mk_gwlist creates a list of IP addresses that are gateways.

func (*Ostack) Mk_gwmaps

func (o *Ostack) Mk_gwmaps(umac2ip map[string]*string,
	uip2mac map[string]*string,
	umac2id map[string]*string,
	umid2mac map[string]*string,
	uid2phost map[string]*string,
	uip2phost map[string]*string,
	inc_tenant bool, use_project bool) (

	mac2ip map[string]*string,
	ip2mac map[string]*string,
	mac2id map[string]*string,
	id2mac map[string]*string,
	id2phost map[string]*string,
	ip2phost map[string]*string,
	err error)

Mk_gwmap generates a gateway [tenant/]ip to mac and mac to [tenant/]ip maps and gateway-id to mac and mac to gateway-id maps. Needs only one call to openstack to generate all maps. A fifth map, translating uuid to phost, is also generated.

The u* maps are updated if supplied. If nil is passed, a new map is created. Use_project is deprecated and supported only for backwards compatibility.

If use_project is true, then the request is made using the project_id, otherwise the project_id is not submitted. In versions before icehouse, submitting without the project ID, with an admin user ID, resulted in a complete list of gateways. With icehouse, it seems that we must request for each project.

func (*Ostack) Mk_hyp2host

func (o *Ostack) Mk_hyp2host() (hmap map[int]*string, err error)

Creates a map of hypervisor IDs to host names

func (*Ostack) Mk_ip2fip

func (o *Ostack) Mk_ip2fip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns or extends a map that translate ip addresses to floating IP addresses If deftab is not nil it is extended, otherwise a new table is created.

func (*Ostack) Mk_ip2mac

func (o *Ostack) Mk_ip2mac(def_table map[string]*string) (table map[string]*string, err error)

Generate a map that allows for translation from IP to MAC. If the caller passes in a map, then the map is added to, otherwise a new map is created.

func (*Ostack) Mk_ip2vm

func (o *Ostack) Mk_ip2vm(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of IP-address to vm name

func (*Ostack) Mk_ip2vmid

func (o *Ostack) Mk_ip2vmid(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of IP-address to UUID (VM-id)

func (*Ostack) Mk_mac2ip

func (o *Ostack) Mk_mac2ip(def_table map[string]*string) (table map[string]*string, err error)

Generate a map that allows for translation from mac to IP. If the caller passes in a map, then the map is added to, otherwise a new map is created.

func (*Ostack) Mk_mac2tip

func (o *Ostack) Mk_mac2tip(def_table map[string]*string) (table map[string]*string, err error)

Generate a map that allows for translation fro mac to tenant/IP. If the caller passes in a map, then the map is added to, otherwise a new map is created.

func (*Ostack) Mk_mac_maps

func (o *Ostack) Mk_mac_maps(def_ip2mac map[string]*string, def_mac2ip map[string]*string, inc_tenant bool) (ip2mac map[string]*string, mac2ip map[string]*string, err error)

Make both possible mac maps:

[tenant/]IP <-> mac		(2 tables)

Because port information seems unrelated to tenant id, this needs to be invoked once regardless of how many tenants are involved.

func (*Ostack) Mk_netinfo_map

func (o *Ostack) Mk_netinfo_map() (nmap map[string]*string, err error)

Mk_netinfo_map generates a map that is keyed by the network name with each entry being a three tuple, space separated, string of: physical net, type (gre,vlan,etc), and segment id.

func (*Ostack) Mk_snlists

func (o *Ostack) Mk_snlists() (snlist map[string]*string, gw2cidr map[string]*string, err error)
 	Mk_snlists creates several maps based on subnet information:
		snlist	is a map of subnet information indexed by subnet ID. Each entry in the map is a string of space
				separated values in the following order: Name, Tenant ID, CIDR, Gateway IP.
		gw2cidr is a map of gateway project-id/ipaddress to cidr

func (*Ostack) Mk_tip2fip

func (o *Ostack) Mk_tip2fip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map which translates tenant/ip addresses to floating (external) IP addresses. If deftab is not nil it is extended, otherwise a new table is created.

func (*Ostack) Mk_tip2mac

func (o *Ostack) Mk_tip2mac(def_table map[string]*string) (table map[string]*string, err error)

Generate a map that allows for translation fro tenant/IP to MAC. If the caller passes in a map, then the map is added to, otherwise a new map is created.

func (*Ostack) Mk_tip2vm

func (o *Ostack) Mk_tip2vm(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of tenant/IP-address to vmname

func (*Ostack) Mk_tip2vmid

func (o *Ostack) Mk_tip2vmid(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of tenant/IP-address to UUID (VM-id)

func (*Ostack) Mk_vm2ip

func (o *Ostack) Mk_vm2ip(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of VM name or VM ID (uuid) to VM IP

func (*Ostack) Mk_vm2tip

func (o *Ostack) Mk_vm2tip(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of VM name or VM ID (uuid) to tenant/VM IP

func (*Ostack) Mk_vm_maps

func (o *Ostack) Mk_vm_maps(
	def_vmid2ip map[string]*string,
	def_ip2vmid map[string]*string,
	def_vm2ip map[string]*string,
	def_vmid2host map[string]*string,
	def_ip2vm map[string]*string,
	inc_tenant bool) (
	vmid2ip map[string]*string,
	ip2vmid map[string]*string,
	vm2ip map[string]*string,
	vmid2host map[string]*string,
	ip2vm map[string]*string,
	err error)

Make all 4 possible vm based maps:

[tenant]/IP <-> vmid	(2 tables)
vm  -> [tenant/]IP		(1 table maps both [tenant/]VM-name and VM-ID to [tenant/]IP-address)
vmID -> physical-host	(1 table)

Parmeters are default maps allowing the maps to be added to (if processing multiple tenants). This needs to be invoked for each project (ostack object) in order to get full coverage.

func (*Ostack) Mk_vmid2ip

func (o *Ostack) Mk_vmid2ip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of UUID (VMid) to IP-address.

func (*Ostack) Mk_vmid2mac

func (o *Ostack) Mk_vmid2mac(def_table map[string]*string) (table map[string]*string, err error)

Generate a map that allows VMid to mac translation. If the caller passes in a map then the map is extended, otherwise a new map is created.

func (*Ostack) Mk_vmid2tip

func (o *Ostack) Mk_vmid2tip(deftab map[string]*string) (symtab map[string]*string, err error)

Returns a map allowing for translation of UUID (VMid) to tenant/IP-address

func (*Ostack) Mk_vmid2vmname

func (o *Ostack) Mk_vmid2vmname(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of VM ID (uuid) to VM name.

func (*Ostack) Mk_vmid2vmtname

func (o *Ostack) Mk_vmid2vmtname(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of VM ID (uuid) to tenant/VM name.

func (*Ostack) Mk_vmname2vmid

func (o *Ostack) Mk_vmname2vmid(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of VM name to VM id (uuid).

func (*Ostack) Mk_vmtname2vmid

func (o *Ostack) Mk_vmtname2vmid(deftab map[string]*string) (symtab map[string]*string, err error)

Generate a map allowing translation of tenant/VM name to VM id (uuid).

func (*Ostack) Send_req

func (o *Ostack) Send_req(method string, url *string, data *bytes.Buffer) (jdata []byte, headers map[string][]string, err error)

Sends a get request to openstack using the host in 'o' with the uri, then extracts the resulting value if successful. The token, if not nil, is passed in the header. If the token appears to be one of the absurdly huge tokens (> 100 bytes) then we will use the md5 token that was computed during authorisation. If openstack is returning short tokens, that cannot be md5'd.

func (*Ostack) String

func (o *Ostack) String() (s string)

---- Stringer interfaces for various things -------------------------------------------

Returns a string with some of the information that is being used to communicate with OpenStack.

func (*Ostack) To_str

func (o *Ostack) To_str() (s string)

Returns a string with some of the information that is being used to communicate with OpenStack. Deprecated, use String()

func (*Ostack) Token2project

func (o *Ostack) Token2project(token *string) (project *string, id *string, err error)

Given a token, return the name of the project that is associated with it, or nil if the toekn isn't valid. Returns error if there are issues getting info from openstack.

func (*Ostack) Token_validation

func (o *Ostack) Token_validation(token *string, usr_match *string) (expiry int64, err error)

Validate a token that is NOT associated with the credential block and optionally checks to see if it was issued for a specific user. Returns an error struct if it is not valid, otherwise it will return nil.

Usr_match is a pointer to either the user name or the Openstack ID and if supplied will be matched against the data returned for the token. If either the user name or ID returned matches, then the result is valid and the error return will be nil. If usr_match is not given (nil), then the reult is good if there is no error generated by openstack.

This does NOT validate against a specific project.

func (*Ostack) Token_validation_v3

func (o *Ostack) Token_validation_v3(token *string, usr_match *string) (expiry int64, err error)

Validate a token that is NOT associated with the credential block and optionally checks to see if it was issued for a specific user. Returns an error struct if it is not valid, otherwise it will return nil.

Usr_match is a pointer to either the user name or the Openstack ID and if supplied will be matched against the data returned for the token. If either the user name or ID returned matches, then the result is valid and the error return will be nil. If usr_match is not given (nil), then the reult is good if there is no error generated by openstack.

This does NOT validate against a specific project.

func (*Ostack) Valid_for_project

func (o *Ostack) Valid_for_project(token *string, project *string) (bool, error)

Given a project and token, return true if the token is valid for the project. Returns with error set if there were issues gathering information from openstack.

func (*Ostack) Valid_for_projectid

func (o *Ostack) Valid_for_projectid(token *string, projectid *string) (bool, error)

Given a project id and token, return true if the token is valid for the project. Returns with error set if there were issues gathering information from openstack.

func (*Ostack) Validate_auth

func (o *Ostack) Validate_auth() (err error)

Check to see if we think we are expired and if so, reexecute the authorisation. (This is probably not needed as an external interfac, but might be convenient if an application wants to pre-authorise while doing other initialisation in parallel in order to speed things up.)

This function will use the region that was set when the Ostack struct was created (see Mk_ostack() and Mk_ostack_region()).

func (*Ostack) Validate_auth_v3

func (o *Ostack) Validate_auth_v3() (err error)

Check to see if we think we are expired and if so, reexecute the authorisation. (This is probably not needed as an external interfac, but might be convenient if an application wants to pre-authorise while doing other initialisation in parallel in order to speed things up.)

This function will use the region that was set when the Ostack struct was created (see Mk_ostack() and Mk_ostack_region()).

type Ostack_tstuff

type Ostack_tstuff struct {
	User     string
	Id       string
	TenantId string
	Roles    map[string]bool
	Expiry   int64
}

Token stuff from a cracked token.

func (*Ostack_tstuff) String

func (s *Ostack_tstuff) String() string

Convenience function for printing. Not efficient, but simple

type VM_info

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

Certain info about a VM that we dug up. We could pass back the ost_* structure, but this provides insulation between the user app and openstack changes and keeps data private to the struct.

func (*VM_info) Get_created

func (vi *VM_info) Get_created() string

func (*VM_info) Get_flavour

func (vi *VM_info) Get_flavour() string

func (*VM_info) Get_hostid

func (vi *VM_info) Get_hostid() string

func (*VM_info) Get_hostname

func (vi *VM_info) Get_hostname() string

func (*VM_info) Get_image

func (vi *VM_info) Get_image() string

func (*VM_info) Get_launched

func (vi *VM_info) Get_launched() string

func (*VM_info) Get_name

func (vi *VM_info) Get_name() string

func (*VM_info) Get_status

func (vi *VM_info) Get_status() string

func (*VM_info) Get_tenantid

func (vi *VM_info) Get_tenantid() string

func (*VM_info) Get_terminated

func (vi *VM_info) Get_terminated() string

func (*VM_info) Get_updated

func (vi *VM_info) Get_updated() string

func (*VM_info) Get_zone

func (vi *VM_info) Get_zone() string

func (*VM_info) String

func (vi *VM_info) String() string

Implements the string interface.

func (*VM_info) To_json

func (vi *VM_info) To_json() string

Generates a json string representing the struct.

Jump to

Keyboard shortcuts

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