soffit

package module
Version: v0.0.0-...-8eadb8d Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: MIT Imports: 11 Imported by: 1

README

soffit

-- import "astuart.co/soffit-go"

Package soffit provides data structures for the data types one can expect from the uPortal Soffit portlet. This should help enable more rapid iteration when working in a soffit environment.

Usage

type Context
type Context struct {
	PortalInfo            PortalInfo `json:"portalInfo"`
	SupportedWindowStates []string   `json:"supportedWindowStates"`
	Attributes            url.Values `json:"attributes"`
}

Context represents information about the portal creating the request

type Payload
type Payload struct {
	Request Request     `json:"request"`
	User    UserDetails `json:"user"`
	Context Context     `json:"context"`
}

Payload is the tentative name for the main Soffit request body

type PortalInfo
type PortalInfo struct {
	Provider string         `json:"provider"`
	Version  semver.Version `json:"version"`
	Snapshot bool           `json:"snapshot"`
}

PortalInfo is the representation of the portal information sent by the uPortal server.

func (*PortalInfo) UnmarshalJSON
func (p *PortalInfo) UnmarshalJSON(bs []byte) error

UnmarshalJSON implements json.Unmarshaler

type Request
type Request struct {
	Mode        string `json:"mode"`
	WindowID    string `json:"windowId"`
	Namespace   string `json:"namespace"`
	WindowState string `json:"windowState"`

	Properties  map[string]string `json:"properties"`
	Preferences url.Values        `json:"preferences"`
	Attributes  url.Values        `json:"attributes"`
}

Request is the go representation of the Soffit JSON request format v_1.

type UserDetails
type UserDetails struct {
	Username   string     `json:"username"`
	Attributes url.Values `json:"attributes"`
	Roles      []string   `json:"roles"`
	Groups     []string   `json:"groups"`
}

UserDetails is the representation of the user information sent by uPortal.

Documentation

Overview

Package soffit provides data structures for the data types one can expect from the uPortal Soffit portlet. This should help enable more rapid iteration when working in a soffit environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandHTMLID

func RandHTMLID() (string, error)

RandHTMLID generates a random valid HTML ID to be used for namespacing

Types

type Context

type Context struct {
	PortalInfo            PortalInfo `json:"portalInfo"`
	SupportedWindowStates []string   `json:"supportedWindowStates"`
	Attributes            url.Values `json:"attributes"`
}

Context represents information about the portal creating the request

type Headers

type Headers struct {
	Preferences map[string]interface{} `json:"preferences"`
	Definition  map[string]interface{} `json:"definition"`
	Request     map[string]interface{} `json:"request"`
}

Headers provides structured access to the several headers that may be sent in the soffit payload.

type Payload

type Payload struct {
	Request Request     `json:"request"`
	User    UserDetails `json:"user"`
	Context Context     `json:"context"`
}

Payload is the tentative name for the main Soffit request body

type PortalInfo

type PortalInfo struct {
	Provider string         `json:"provider"`
	Version  semver.Version `json:"version"`
	Snapshot bool           `json:"snapshot"`
}

PortalInfo is the representation of the portal information sent by the uPortal server.

func (*PortalInfo) UnmarshalJSON

func (p *PortalInfo) UnmarshalJSON(bs []byte) error

UnmarshalJSON implements json.Unmarshaler

type Receiver

type Receiver struct {
	Password string
}

Receiver takes a password, provides utilities for handling incoming Soffit requests.

func (Receiver) GetHeaders

func (d Receiver) GetHeaders(h http.Header) (*Headers, error)

GetHeaders takes url.Values and returns the decrypted headers.

type Request

type Request struct {
	Mode        string `json:"mode"`
	WindowID    string `json:"windowId"`
	Namespace   string `json:"namespace"`
	WindowState string `json:"windowState"`

	Properties  map[string]string `json:"properties"`
	Preferences url.Values        `json:"preferences"`
	Attributes  url.Values        `json:"attributes"`
}

Request is the go representation of the Soffit JSON request format v_1.

type UserDetails

type UserDetails struct {
	Username   string     `json:"username"`
	Attributes url.Values `json:"attributes"`
	Roles      []string   `json:"roles"`
	Groups     []string   `json:"groups"`
}

UserDetails is the representation of the user information sent by uPortal.

Jump to

Keyboard shortcuts

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