Documentation ¶
Index ¶
- Constants
- type Alert
- type Area
- type Category
- func (category Category) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (category Category) String() string
- func (category *Category) UnmarshalJSON(b []byte) error
- func (category *Category) UnmarshalText(data []byte) error
- func (category *Category) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Certainty
- func (certainty Certainty) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (certainty Certainty) String() string
- func (certainty *Certainty) UnmarshalJSON(b []byte) error
- func (certainty *Certainty) UnmarshalText(data []byte) error
- func (certainty *Certainty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Circle
- type Circles
- type Info
- type KeyValue
- type List
- type MessageType
- func (messageType MessageType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (messageType MessageType) String() string
- func (messageType *MessageType) UnmarshalJSON(b []byte) error
- func (messageType *MessageType) UnmarshalText(data []byte) error
- func (messageType *MessageType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Polygon
- type Polygons
- type Reference
- type References
- type Resource
- type ResponseType
- func (responseType ResponseType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (responseType ResponseType) String() string
- func (responseType *ResponseType) UnmarshalJSON(b []byte) error
- func (responseType *ResponseType) UnmarshalText(data []byte) error
- func (responseType *ResponseType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Scope
- type Severity
- func (severity Severity) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (severity Severity) String() string
- func (severity *Severity) UnmarshalJSON(b []byte) error
- func (severity *Severity) UnmarshalText(data []byte) error
- func (severity *Severity) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Status
- func (status Status) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (status Status) String() string
- func (status *Status) UnmarshalJSON(b []byte) error
- func (status *Status) UnmarshalText(data []byte) error
- func (status *Status) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Time
- type Urgency
- func (urgency Urgency) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (urgency Urgency) String() string
- func (urgency *Urgency) UnmarshalJSON(b []byte) error
- func (urgency *Urgency) UnmarshalText(data []byte) error
- func (urgency *Urgency) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Constants ¶
const (
// TimeFormat is the time format used for dates in the CAP protocol.
TimeFormat = "2006-01-02T15:04:05-07:00"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { XMLName xml.Name `xml:"alert" json:"-"` Identifier string `xml:"identifier" json:"identifier"` Sender string `xml:"sender" json:"sender"` Sent Time `xml:"sent" json:"sent"` Status Status `xml:"status" json:"status"` MessageType MessageType `xml:"msgType" json:"message_type"` Source string `xml:"source" json:"source"` Scope Scope `xml:"scope" json:"scope"` Restriction string `xml:"restriction" json:"restriction"` Addresses List `xml:"addresses" json:"addresses"` Codes []string `xml:"code" json:"codes"` Note string `xml:"note" json:"note"` References References `xml:"references" json:"references"` Incidents List `xml:"incidents" json:"incidents"` Infos []*Info `xml:"info" json:"infos"` Superseded bool `xml:"-" json:"superseded"` }
An Alert represents an alert issued through a Common Alerting Protocol (CAP) compliant system.
type Area ¶
type Area struct { XMLName xml.Name `xml:"area" json:"-"` Description string `xml:"areaDesc" json:"description"` Polygons Polygons `xml:"polygon" json:"polygons"` Circles Circles `xml:"circle" json:"circles"` GeoCodes KeyValue `xml:"geocode" json:"geocodes"` Altitude int `xml:"altitude" json:"altitude"` Ceiling int `xml:"ceiling" json:"ceiling"` }
An Area represents an area affected by an event.
type Category ¶
type Category int
A Category represents an alert category.
const ( // CategoryUnknown represents an unknown event category. CategoryUnknown Category = iota // CategoryGeophysical represents a geophysical event. CategoryGeophysical // CategoryMeteorological represents a meteorological event. CategoryMeteorological // CategorySafety represents a general emergency and public safety event. CategorySafety // CategorySecurity represents a law enforcement, military, homeland and local/private security event. CategorySecurity // CategoryRescue represents a rescue and recovert event. CategoryRescue // CategoryFire represents a fire suppression and rescue event. CategoryFire // CategoryHealth represents a medical and public health event. CategoryHealth // CategoryEnvironment represents a pollutiohn and other environmental event. CategoryEnvironment // CategoryTransport represents a public and private transportation event. CategoryTransport // CategoryInfrastructure represents a utility, telecommunication or other non-transport infrastructure event. CategoryInfrastructure // CategoryCBRNE represents a Chemical, Biological, Radiological, Nuclear or High-Yield explosive threat or attack event. CategoryCBRNE // CategoryOther represnts other events. CategoryOther )
func (Category) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Category) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Category) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Category) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Certainty ¶
type Certainty int
A Certainty represents the certainty of an event.
const ( // CertaintyUnknown represents an event with unknown certainty. CertaintyUnknown Certainty = iota // CertaintyObserved represents an event determined to have occurred or to be ongoing. CertaintyObserved // CertaintyLikely represents an event that is likely (p > ~50%). CertaintyLikely // CertaintyPossible represents an event that is possible but not likely (p <= ~50%) CertaintyPossible // CertaintyUnlikely represents an event that is unlikely to occure (p ~ 0) CertaintyUnlikely )
func (Certainty) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Certainty) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Certainty) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Certainty) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Circle ¶
type Circle struct { Type string `json:"type"` Coordinates []float64 `json:"coordinates"` Radius float64 `json:"radius"` }
A Circle represents a circular area affected by an event.
type Circles ¶
type Circles []*Circle
Circles represents multiple circles.
func (*Circles) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Circles) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Info ¶
type Info struct { XMLName xml.Name `xml:"info" json:"-"` Language string `xml:"language" json:"language"` Categories []Category `xml:"category" json:"categories"` Event string `xml:"event" json:"event"` ResponseTypes []ResponseType `xml:"responseType" json:"response_types"` Urgency Urgency `xml:"urgency" json:"urgency"` Severity Severity `xml:"severity" json:"severity"` Certainty Certainty `xml:"certainty" json:"certainty"` Audience string `xml:"audience" json:"audience"` EventCodes KeyValue `xml:"eventCode" json:"event_codes"` Effective *Time `xml:"effective" json:"effective"` Onset *Time `xml:"onset" json:"onset"` Expires *Time `xml:"expires" json:"expires"` SenderName string `xml:"senderName" json:"sender_name"` Headline string `xml:"headline" json:"headline"` Description string `xml:"description" json:"description"` Instruction string `xml:"instruction" json:"instruction"` Web string `xml:"web" json:"web"` Contact string `xml:"contact" json:"contact"` Parameters KeyValue `xml:"parameter" json:"parameters"` Resources []*Resource `xml:"resource" json:"resources"` Areas []*Area `xml:"area" json:"areas"` }
An Info represents the information section of an alert.
type KeyValue ¶
A KeyValue represents a set of key-value pairs.
func (*KeyValue) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*KeyValue) UnmarshalXML ¶
UnmarshalXML impelements the xml.Unmarshaler interface.
type List ¶
type List []string
A List represents a list of string values.
func (*List) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type MessageType ¶
type MessageType int
A MessageType represents the nature of the alert message.
const ( // MessageTypeUnknown represents an unknown message type. MessageTypeUnknown MessageType = iota // MessageTypeAlert represents initial information requiring attention by targeted recipients. MessageTypeAlert // MessageTypeUpdate represents updates and supercedes the earlier message(s) identified in Alert.References. MessageTypeUpdate // MessageTypeCancel represents a cancellation of the earlier message(s) identified in Alert.References. MessageTypeCancel // MessageTypeAck represents an acknowledgment receipt and acceptance of the message(s) identified in Alert.References. MessageTypeAck // MessageTypeError represents a rejection of the message(s) identified in Alert.References. MessageTypeError )
func (MessageType) MarshalXML ¶
func (messageType MessageType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface.
func (MessageType) String ¶
func (messageType MessageType) String() string
String returns a MessageType as a string.
func (*MessageType) UnmarshalJSON ¶
func (messageType *MessageType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*MessageType) UnmarshalText ¶
func (messageType *MessageType) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*MessageType) UnmarshalXML ¶
func (messageType *MessageType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface.
type Polygon ¶
A Polygon represents an area affected by an event as a polygon.
func (*Polygon) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Polygons ¶
type Polygons []*Polygon
Polygons is a collection of polygons.
func (*Polygons) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
type Reference ¶
type Reference struct { Sender string `json:"sender"` Identifier string `json:"identifier"` Sent Time `json:"sent"` }
A Reference represents a the identifying information of another alert.
func (Reference) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type References ¶
type References []*Reference
References is an array of Reference.
func (*References) MarshalXML ¶
func (m *References) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface.
func (*References) UnmarshalXML ¶
func (m *References) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface.
type Resource ¶
type Resource struct { XMLName xml.Name `xml:"resource" json:"-"` Description string `xml:"resourceDesc" json:"description"` MimeType string `xml:"mimeType" json:"mime_type"` Size int `xml:"size" json:"size"` URI string `xml:"uri" json:"uri"` Digest string `xml:"digest" json:"digest"` DerefURI string `xml:"derefUri" json:"deref_uri"` }
A Resource represents a reference to additional information related to the Info segment. These are references to digital assets such as images or audio.
type ResponseType ¶
type ResponseType int
A ResponseType represents the type of action recommended.
const ( // ResponseTypeUnknown represents an unknown response type. ResponseTypeUnknown ResponseType = iota // ResponseTypeShelter represents taking shelter in place or per the instruction. ResponseTypeShelter // ResponseTypeEvacuate represents replocating as instructed in the instruction. ResponseTypeEvacuate // ResponseTypePrepare represents making preparations per the intruction. ResponseTypePrepare // ResponseTypeExecute represents executing a pre-planned activity identified in the instruction. ResponseTypeExecute // ResponseTypeAvoid represents avoding the subject event as per the instruction. ResponseTypeAvoid // ResponseTypeMonitor represents attending to information sources as described in the instruction. ResponseTypeMonitor // ResponseTypeAssess represents evaluating the information in the mssage. ResponseTypeAssess // ResponseTypeAllClear represents that the subject event no longer poses a threat or concern and any follow on action is described in the instruction. ResponseTypeAllClear // ResponseTypeNone represents that no action recommended. ResponseTypeNone )
func (ResponseType) MarshalXML ¶
func (responseType ResponseType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface.
func (ResponseType) String ¶
func (responseType ResponseType) String() string
String returns a ResponseType as a string.
func (*ResponseType) UnmarshalJSON ¶
func (responseType *ResponseType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*ResponseType) UnmarshalText ¶
func (responseType *ResponseType) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*ResponseType) UnmarshalXML ¶
func (responseType *ResponseType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface.
type Scope ¶
type Scope int
A Scope represents the intended distribution of the alert message.
const ( // ScopeUnknown represents an unknown scope. ScopeUnknown Scope = iota // ScopePublic represents an alert for general dissemination to unrestricted audiences. ScopePublic // ScopeRestricted represents an alert for dissemination only to users with a known operational requirement. ScopeRestricted // ScopePrivate represents an alert for dissemination only to specified addresses. ScopePrivate )
func (Scope) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Scope) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Scope) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Scope) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Severity ¶
type Severity int
A Severity represents the severity of an event.
const ( // SeverityUnknown represents an event with unknown certainty. SeverityUnknown Severity = iota // SeverityExtreme represents an event with extraordinary threat to life or property. SeverityExtreme // SeveritySevere represents an event with significant threat to life or property. SeveritySevere // SeverityModerate represents an event with possible threat to life or property. SeverityModerate // SeverityMinor represents an event with minimal to no known threat to life or property. SeverityMinor )
func (Severity) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Severity) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Severity) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type Status ¶
type Status int
A Status represents the appropriate handling of the alert message.
const ( // StatusUnknown represents an unknown status. StatusUnknown Status = iota // StatusActual represents an alert actionable by all targeted recipients. StatusActual // StatusExcercise represents an alert actionable only by desginated exercise participants. StatusExcercise // StatusSystem represents a message that supports alert network internal functions. StatusSystem // StatusTest represents technical testing only. All recipients should disregard. StatusTest // StatusDraft represents a perliminary template or draft. The alert is not actionable in its current form. StatusDraft )
func (Status) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Status) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Status) UnmarshalXML ¶
UnmarshalXML implements the xml.Marshaler interface.
type Time ¶
A Time represents an instant in time.
func (Time) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
type Urgency ¶
type Urgency int
A Urgency represents the urgency of an event.
const ( // UrgencyUnknown represents unknown urgency. UrgencyUnknown Urgency = iota // UrgencyImmediate represents that responsive action should be taken immediately. UrgencyImmediate // UrgencyExpected represents that responsive action should be taken soon (within the next hour). UrgencyExpected // UrgencyFuture represents that responsive action should be taken in the near future. UrgencyFuture // UrgencyPast represents that responsive action is no longer required. UrgencyPast )
func (Urgency) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Urgency) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Urgency) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (*Urgency) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.