bundle

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	baseobject.CommonBaseProperties
	Objects []interface{} `json:"objects,omitempty"`
}

Bundle - This type implements the STIX 2 Bundle and defines all of the properties methods needed to create and work with the STIX Bundle. All of the methods not defined local to this type are inherited from the individual properties.

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

A Bundle is a collection of arbitrary STIX Objects and Marking Definitions grouped together in a single container. A Bundle does not have any semantic meaning and Objects are not considered related by virtue of being in the same Bundle.

Bundle is not STIX Object, so it does not have any of the Common Properties other than the type and id properties. Bundle is transient and implementations should not assume that other implementations will treat it as a persistent object.

func New

func New() *Bundle

New - This function will create a new STIX Bundle object and return it as a pointer. This function can not use the InitNewObject() function as a Bundle does not have all of the fields that are common to a standard object.

func (*Bundle) AddObject

func (o *Bundle) AddObject(i interface{}) error

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

func (*Bundle) Encode

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

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

func (*Bundle) EncodeToString

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

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

type BundleRawDecode

type BundleRawDecode struct {
	baseobject.CommonBaseProperties
	Objects []json.RawMessage `json:"objects,omitempty"`
}

func DecodeRaw

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

DecodeRaw - This function will decode the outer layer of a bundle 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 (*BundleRawDecode) EncodeToString

func (o *BundleRawDecode) 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