Documentation ¶
Index ¶
Constants ¶
const ( ALARM_API_PATH = "/alarm/alarms" ALARM_TYPE = "application/vnd.com.nsn.cumulocity.alarm+json" ALARM_COLLECTION_TYPE = "application/vnd.com.nsn.cumulocity.alarmCollection+json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct { Id string `json:"id,omitempty"` Self string `json:"self,omitempty"` CreationTime *time.Time `json:"creationTime,omitempty"` Type string `json:"type,omitempty"` Time *time.Time `json:"time,omitempty"` Text string `json:"text,omitempty"` Source Source `json:"source,omitempty"` Status Status `json:"status,omitempty"` Severity Severity `json:"severity,omitempty"` Count int `json:"count,omitempty"` FirstOccurrenceTime *time.Time `json:"firstOccurrenceTime,omitempty"` AdditionalFields map[string]interface{} `jsonc:"flat"` }
Represents cumulocity's alarm 'application/vnd.com.nsn.cumulocity.alarm+json'. See: https://cumulocity.com/guides/reference/alarms/#alarm https://cumulocity.com/guides/reference/alarms/#post-create-a-new-alarm
type AlarmApi ¶
type AlarmApi interface { // Create a new alarm and returns the created entity with id and creation time Create(alarm *NewAlarm) (*Alarm, *generic.Error) // Gets an exiting alarm by its id. If the id does not exists, nil is returned. Get(alarmId string) (*Alarm, *generic.Error) // Updates an exiting alarm and returns the updated alarm entity. Update(alarmId string, alarm *UpdateAlarm) (*Alarm, *generic.Error) // Updates status of many alarms. BulkStatusUpdate(query *UpdateAlarmsFilter, newStatus Status) *generic.Error // Deletion by alarm id is not supported/allowed by cumulocity. // Deletes alarms by filter. If error is nil, alarms were deleted successfully. // ATTENTION: at least one filter should be set otherwise an error will be thrown. // Use DeleteAll() (with caution!) instead if you want delete all alarms! Delete(query *AlarmFilter) *generic.Error // A special function to delete all alarms at once to avoid accident deletion using the delete()-function with filters. // If error is nil, alarms were deleted successfully. // ATTENTION: use it with caution! DeleteAll() *generic.Error // Gets a alarm collection by a source (aka managed object id). GetForDevice(sourceId string, pageSize int) (*AlarmCollection, *generic.Error) // Returns an alarm collection, found by the given alarm query parameters. // All query parameters are AND concatenated. Find(query *AlarmFilter, pageSize int) (*AlarmCollection, *generic.Error) // Gets the next page from an existing alarm collection. // If there is no next page, nil is returned. NextPage(c *AlarmCollection) (*AlarmCollection, *generic.Error) // Gets the previous page from an existing alarm collection. // If there is no previous page, nil is returned. PreviousPage(c *AlarmCollection) (*AlarmCollection, *generic.Error) }
func NewAlarmApi ¶
Creates a new alarm api object client - Must be a gomulocity client. returns - The `alarm`-api object
type AlarmCollection ¶
type AlarmCollection struct { Self string `json:"self"` Alarms []Alarm `json:"alarms" jsonc:"collection"` Statistics *generic.PagingStatistics `json:"statistics,omitempty"` Prev string `json:"prev,omitempty"` Next string `json:"next,omitempty"` }
AlarmCollection represent cumulocity's 'application/vnd.com.nsn.cumulocity.alarmCollection+json'. See: https://cumulocity.com/guides/reference/alarms/#alarm-collection
type AlarmFilter ¶
type AlarmFilter struct { Status []Status // Comma separated alarm statuses, for example ACTIVE,CLEARED. // PLEASE NOTE: when resolved parameter is set then status parameter will be ignored SourceId string // Source device id. WithSourceAssets bool // When set to true also alarms for related source assets will be removed. // When this parameter is provided also source must be defined. WithSourceDevices bool // When set to true also alarms for related source devices will be removed. // When this parameter is provided also source must be defined. Resolved string // When this parameter is provided then status parameter will be ignored. // When set to true only resolved alarms will be removed (the one with status CLEARED), // false means alarms with status ACTIVE or ACKNOWLEDGED. Severity Severity // Alarm severity, for example MINOR. DateFrom *time.Time // Start date or date and time of alarm occurrence. DateTo *time.Time // End date or date and time of alarm occurrence. Type string // Alarm type. }
See: https://cumulocity.com/guides/reference/alarms/#delete-delete-an-alarm-collection
func (AlarmFilter) QueryParams ¶
func (alarmFilter AlarmFilter) QueryParams(params *url.Values) error
Appends the filter query parameters to the provided parameter values for a request When provided values is nil an error will be created
type NewAlarm ¶
type NewAlarm struct { Type string `json:"type"` Time time.Time `json:"time"` Text string `json:"text"` Source Source `json:"source"` Status Status `json:"status"` Severity Severity `json:"severity"` AdditionalFields map[string]interface{} `jsonc:"flat"` }
Represents cumulocity's alarm structure for creation purposes. See: https://cumulocity.com/guides/reference/alarms/#post-create-a-new-alarm
type UpdateAlarm ¶
type UpdateAlarm struct { Text string `json:"text,omitempty"` Status Status `json:"status,omitempty"` Severity Severity `json:"severity,omitempty"` AdditionalFields map[string]interface{} `jsonc:"flat"` }
Represents cumulocity's alarm structure for update purposes. See: https://cumulocity.com/guides/reference/alarms/#update-an-alarm
type UpdateAlarmsFilter ¶
type UpdateAlarmsFilter struct { Status Status SourceId string Resolved string // PLEASE NOTE: when status parameter is set then resolved parameter will be ignored Severity Severity DateFrom *time.Time DateTo *time.Time }
https://cumulocity.com/guides/reference/alarms/#put-bulk-update-of-alarm-collection
func (UpdateAlarmsFilter) QueryParams ¶
func (updateAlarmsFilter UpdateAlarmsFilter) QueryParams(params *url.Values) error
Appends the filter query parameters to the provided parameter values for a request When provided values is nil an error will be created