envelope

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	More    bool          `json:"more,omitempty"`
	Objects []interface{} `json:"objects,omitempty"`
}

Envelope - This type implements the TAXII 2 Envelope Resource and defines all of the properties and methods needed to create and work with the TAXII Envelope Resource.

The following information comes directly from the TAXII 2 specification documents.

The envelope is a simple wrapper for STIX 2 content. When returning STIX 2 content in a TAXII response the HTTP root object payload MUST be an envelope. This specification does not define any other form of content wrapper for objects outside of STIX content.

For example:

func New

func New() *Envelope

New - This function will create a new TAXII Envelope object and return it as a pointer.

func (*Envelope) AddObject

func (r *Envelope) AddObject(o interface{}) error

AddObject - This method will take in an object as an interface and add it to the list of objects in the envelope

func (*Envelope) Encode

func (o *Envelope) Encode() ([]byte, error)

Encode - This method is a simple wrapper for encoding an object in to JSON

func (*Envelope) EncodeToString

func (o *Envelope) EncodeToString() (string, error)

EncodeToString - This method is a simple wrapper for encoding an object in to JSON

func (*Envelope) GetMore

func (r *Envelope) GetMore() bool

GetMore - This method will return the more property

func (*Envelope) SetMore

func (r *Envelope) SetMore() error

SetMore - This method will set the more property to true

type EnvelopeRawDecode

type EnvelopeRawDecode struct {
	More    bool              `json:"more,omitempty"`
	Objects []json.RawMessage `json:"objects,omitempty"`
}

func DecodeRaw

func DecodeRaw(r io.Reader) (*EnvelopeRawDecode, error)

DecodeRaw - This function will decode the outer layer of an envelope and stop processing when it gets to the objects. It will leave the objects as a slice of json.RawMessage objects. This way, later on, we can decode each one individually

func (*EnvelopeRawDecode) EncodeToString

func (o *EnvelopeRawDecode) EncodeToString() (string, error)

EncodeToString - This method is a simple wrapper for encoding an object in to JSON

Jump to

Keyboard shortcuts

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