mongo

package
v0.0.0-...-7b61fee Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2017 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (
	NOTIFICATION_COLLECTION = "notification"
	SUBSCRIPTION_COLLECTION = "subscription"
	TRANSMISSION_COLLECTION = "transmission"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoClient

type MongoClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config db.Configuration) (MongoClient, error)

Return a pointer to the MongoClient

func (MongoClient) AddAddressable

func (mc MongoClient) AddAddressable(a contract.Addressable) (string, error)

func (MongoClient) AddCommand

func (mc MongoClient) AddCommand(c contract.Command) (string, error)

func (MongoClient) AddDevice

func (mc MongoClient) AddDevice(d contract.Device) (string, error)

----------------------------- Device ----------------------------------

func (MongoClient) AddDeviceProfile

func (mc MongoClient) AddDeviceProfile(dp contract.DeviceProfile) (string, error)

func (MongoClient) AddDeviceService

func (mc MongoClient) AddDeviceService(ds contract.DeviceService) (string, error)

func (MongoClient) AddInterval

func (mc MongoClient) AddInterval(interval contract.Interval) (string, error)

Add an Interval UnexpectedError - failed to add interval into the database

func (MongoClient) AddIntervalAction

func (mc MongoClient) AddIntervalAction(action contract.IntervalAction) (string, error)

Add a new Interval Action UnexpectedError - failed to add interval action into the database

func (MongoClient) AddNotification

func (mc MongoClient) AddNotification(n contract.Notification) (string, error)

func (MongoClient) AddProvisionWatcher

func (mc MongoClient) AddProvisionWatcher(pw contract.ProvisionWatcher) (string, error)

func (MongoClient) AddRegistration

func (mc MongoClient) AddRegistration(r contract.Registration) (string, error)

Add a new registration UnexpectedError - failed to add to database

func (MongoClient) AddSubscription

func (mc MongoClient) AddSubscription(sub contract.Subscription) (string, error)

func (MongoClient) AddTransmission

func (mc MongoClient) AddTransmission(t contract.Transmission) (string, error)

func (MongoClient) AddressableToDBRef

func (mc MongoClient) AddressableToDBRef(a models.Addressable) (dbRef mgo.DBRef, err error)

func (MongoClient) Cleanup

func (mc MongoClient) Cleanup() error

func (MongoClient) CleanupOld

func (mc MongoClient) CleanupOld(age int) error

func (MongoClient) CloseSession

func (mc MongoClient) CloseSession()

func (MongoClient) CommandToDBRef

func (mc MongoClient) CommandToDBRef(c models.Command) (dbRef mgo.DBRef, err error)

func (MongoClient) DBRefToAddressable

func (mc MongoClient) DBRefToAddressable(dbRef mgo.DBRef) (a models.Addressable, err error)

func (MongoClient) DBRefToCommand

func (mc MongoClient) DBRefToCommand(dbRef mgo.DBRef) (c models.Command, err error)

func (MongoClient) DBRefToDeviceProfile

func (mc MongoClient) DBRefToDeviceProfile(dbRef mgo.DBRef) (a models.DeviceProfile, err error)

func (MongoClient) DBRefToDeviceService

func (mc MongoClient) DBRefToDeviceService(dbRef mgo.DBRef) (ds models.DeviceService, err error)

func (MongoClient) DeleteAddressableById

func (mc MongoClient) DeleteAddressableById(id string) error

func (MongoClient) DeleteCommandById

func (mc MongoClient) DeleteCommandById(id string) error

Delete the command by ID Check if the command is still in use by device profiles

func (MongoClient) DeleteDeviceById

func (mc MongoClient) DeleteDeviceById(id string) error

func (MongoClient) DeleteDeviceProfileById

func (mc MongoClient) DeleteDeviceProfileById(id string) error

func (MongoClient) DeleteDeviceServiceById

func (mc MongoClient) DeleteDeviceServiceById(id string) error

func (MongoClient) DeleteIntervalActionById

func (mc MongoClient) DeleteIntervalActionById(id string) error

Remove an Interval Action by ID UnexpectedError - failed to remove interval action from the database

func (MongoClient) DeleteIntervalById

func (mc MongoClient) DeleteIntervalById(id string) error

Remove an Interval by ID UnexpectedError - failed to remove interval from the database

func (MongoClient) DeleteNotificationById

func (mc MongoClient) DeleteNotificationById(id string) error

func (MongoClient) DeleteNotificationBySlug

func (mc MongoClient) DeleteNotificationBySlug(slug string) error

func (MongoClient) DeleteNotificationsOld

func (mc MongoClient) DeleteNotificationsOld(age int) error

func (MongoClient) DeleteProvisionWatcherById

func (mc MongoClient) DeleteProvisionWatcherById(id string) error

func (MongoClient) DeleteRegistrationById

func (mc MongoClient) DeleteRegistrationById(id string) error

Delete a registration by ID UnexpectedError - problem getting in database NotFound - no registration with the ID was found

func (MongoClient) DeleteRegistrationByName

func (mc MongoClient) DeleteRegistrationByName(name string) error

Delete a registration by name UnexpectedError - problem getting in database NotFound - no registration with the ID was found

func (MongoClient) DeleteSubscriptionBySlug

func (mc MongoClient) DeleteSubscriptionBySlug(slug string) error

func (MongoClient) DeleteTransmission

func (mc MongoClient) DeleteTransmission(age int64, status contract.TransmissionStatus) error

func (MongoClient) DeviceProfileToDBRef

func (mc MongoClient) DeviceProfileToDBRef(model models.DeviceProfile) (dbRef mgo.DBRef, err error)

func (MongoClient) DeviceServiceToDBRef

func (mc MongoClient) DeviceServiceToDBRef(model models.DeviceService) (dbRef mgo.DBRef, err error)

func (MongoClient) GetAddressableById

func (mc MongoClient) GetAddressableById(id string) (contract.Addressable, error)

func (MongoClient) GetAddressableByName

func (mc MongoClient) GetAddressableByName(n string) (contract.Addressable, error)

func (MongoClient) GetAddressables

func (mc MongoClient) GetAddressables() ([]contract.Addressable, error)

func (MongoClient) GetAddressablesByAddress

func (mc MongoClient) GetAddressablesByAddress(add string) ([]contract.Addressable, error)

func (MongoClient) GetAddressablesByPort

func (mc MongoClient) GetAddressablesByPort(p int) ([]contract.Addressable, error)

func (MongoClient) GetAddressablesByPublisher

func (mc MongoClient) GetAddressablesByPublisher(p string) ([]contract.Addressable, error)

func (MongoClient) GetAddressablesByTopic

func (mc MongoClient) GetAddressablesByTopic(t string) ([]contract.Addressable, error)

func (MongoClient) GetAllCommands

func (mc MongoClient) GetAllCommands() ([]contract.Command, error)

func (MongoClient) GetAllDeviceProfiles

func (mc MongoClient) GetAllDeviceProfiles() ([]contract.DeviceProfile, error)

func (MongoClient) GetAllDeviceServices

func (mc MongoClient) GetAllDeviceServices() ([]contract.DeviceService, error)

func (MongoClient) GetAllDevices

func (mc MongoClient) GetAllDevices() ([]contract.Device, error)

func (MongoClient) GetAllProvisionWatchers

func (mc MongoClient) GetAllProvisionWatchers() (pw []contract.ProvisionWatcher, err error)

----------------------Provision Watcher -----------------------------*/

func (MongoClient) GetAndMapCommands

func (mc MongoClient) GetAndMapCommands(c []mgo.DBRef) ([]contract.Command, error)

func (MongoClient) GetCommandById

func (mc MongoClient) GetCommandById(id string) (contract.Command, error)

func (MongoClient) GetCommandByName

func (mc MongoClient) GetCommandByName(n string) ([]contract.Command, error)

func (MongoClient) GetDeviceById

func (mc MongoClient) GetDeviceById(id string) (contract.Device, error)

func (MongoClient) GetDeviceByName

func (mc MongoClient) GetDeviceByName(n string) (contract.Device, error)

func (MongoClient) GetDeviceProfileById

func (mc MongoClient) GetDeviceProfileById(id string) (contract.DeviceProfile, error)

func (MongoClient) GetDeviceProfileByName

func (mc MongoClient) GetDeviceProfileByName(n string) (contract.DeviceProfile, error)

func (MongoClient) GetDeviceProfilesByCommandId

func (mc MongoClient) GetDeviceProfilesByCommandId(id string) ([]contract.DeviceProfile, error)

Get the device profiles that are currently using the command

func (MongoClient) GetDeviceProfilesByManufacturer

func (mc MongoClient) GetDeviceProfilesByManufacturer(man string) ([]contract.DeviceProfile, error)

func (MongoClient) GetDeviceProfilesByManufacturerModel

func (mc MongoClient) GetDeviceProfilesByManufacturerModel(man string, mod string) ([]contract.DeviceProfile, error)

func (MongoClient) GetDeviceProfilesByModel

func (mc MongoClient) GetDeviceProfilesByModel(model string) ([]contract.DeviceProfile, error)

func (MongoClient) GetDeviceProfilesWithLabel

func (mc MongoClient) GetDeviceProfilesWithLabel(l string) ([]contract.DeviceProfile, error)

func (MongoClient) GetDeviceServiceById

func (mc MongoClient) GetDeviceServiceById(id string) (contract.DeviceService, error)

func (MongoClient) GetDeviceServiceByName

func (mc MongoClient) GetDeviceServiceByName(n string) (contract.DeviceService, error)

func (MongoClient) GetDeviceServicesByAddressableId

func (mc MongoClient) GetDeviceServicesByAddressableId(id string) ([]contract.DeviceService, error)

func (MongoClient) GetDeviceServicesWithLabel

func (mc MongoClient) GetDeviceServicesWithLabel(l string) ([]contract.DeviceService, error)

func (MongoClient) GetDevicesByProfileId

func (mc MongoClient) GetDevicesByProfileId(id string) ([]contract.Device, error)

func (MongoClient) GetDevicesByServiceId

func (mc MongoClient) GetDevicesByServiceId(id string) ([]contract.Device, error)

func (MongoClient) GetDevicesWithLabel

func (mc MongoClient) GetDevicesWithLabel(l string) ([]contract.Device, error)

func (MongoClient) GetNewNormalNotifications

func (mc MongoClient) GetNewNormalNotifications(limit int) ([]contract.Notification, error)

func (MongoClient) GetNewNotifications

func (mc MongoClient) GetNewNotifications(limit int) ([]contract.Notification, error)

func (MongoClient) GetNotificationById

func (mc MongoClient) GetNotificationById(id string) (contract.Notification, error)

func (MongoClient) GetNotificationBySender

func (mc MongoClient) GetNotificationBySender(sender string, limit int) ([]contract.Notification, error)

func (MongoClient) GetNotificationBySlug

func (mc MongoClient) GetNotificationBySlug(slug string) (contract.Notification, error)

func (MongoClient) GetNotifications

func (mc MongoClient) GetNotifications() ([]contract.Notification, error)

func (MongoClient) GetNotificationsByEnd

func (mc MongoClient) GetNotificationsByEnd(end int64, limit int) ([]contract.Notification, error)

func (MongoClient) GetNotificationsByLabels

func (mc MongoClient) GetNotificationsByLabels(labels []string, limit int) ([]contract.Notification, error)

func (MongoClient) GetNotificationsByStart

func (mc MongoClient) GetNotificationsByStart(start int64, limit int) ([]contract.Notification, error)

func (MongoClient) GetNotificationsByStartEnd

func (mc MongoClient) GetNotificationsByStartEnd(start int64, end int64, limit int) ([]contract.Notification, error)

func (MongoClient) GetProvisionWatcher

func (mc MongoClient) GetProvisionWatcher(q bson.M) (pw contract.ProvisionWatcher, err error)

func (MongoClient) GetProvisionWatcherById

func (mc MongoClient) GetProvisionWatcherById(id string) (pw contract.ProvisionWatcher, err error)

func (MongoClient) GetProvisionWatcherByName

func (mc MongoClient) GetProvisionWatcherByName(n string) (pw contract.ProvisionWatcher, err error)

func (MongoClient) GetProvisionWatchersByIdentifier

func (mc MongoClient) GetProvisionWatchersByIdentifier(k string, v string) (pw []contract.ProvisionWatcher, err error)

func (MongoClient) GetProvisionWatchersByProfileId

func (mc MongoClient) GetProvisionWatchersByProfileId(id string) (pw []contract.ProvisionWatcher, err error)

func (MongoClient) GetProvisionWatchersByServiceId

func (mc MongoClient) GetProvisionWatchersByServiceId(id string) (pw []contract.ProvisionWatcher, err error)

func (MongoClient) GetSubscriptionByCategories

func (mc MongoClient) GetSubscriptionByCategories(categories []string) ([]contract.Subscription, error)

func (MongoClient) GetSubscriptionByCategoriesLabels

func (mc MongoClient) GetSubscriptionByCategoriesLabels(categories []string, labels []string) ([]contract.Subscription, error)

func (MongoClient) GetSubscriptionById

func (mc MongoClient) GetSubscriptionById(id string) (contract.Subscription, error)

func (MongoClient) GetSubscriptionByLabels

func (mc MongoClient) GetSubscriptionByLabels(labels []string) ([]contract.Subscription, error)

func (MongoClient) GetSubscriptionByReceiver

func (mc MongoClient) GetSubscriptionByReceiver(receiver string) ([]contract.Subscription, error)

func (MongoClient) GetSubscriptionBySlug

func (mc MongoClient) GetSubscriptionBySlug(slug string) (contract.Subscription, error)

func (MongoClient) GetSubscriptions

func (mc MongoClient) GetSubscriptions() ([]contract.Subscription, error)

Return all the subscriptions UnexpectedError - failed to retrieve subscriptions from the database

func (MongoClient) GetTransmissionsByEnd

func (mc MongoClient) GetTransmissionsByEnd(end int64, resendLimit int) ([]contract.Transmission, error)

func (MongoClient) GetTransmissionsByNotificationSlug

func (mc MongoClient) GetTransmissionsByNotificationSlug(slug string, resendLimit int) ([]contract.Transmission, error)

func (MongoClient) GetTransmissionsByStart

func (mc MongoClient) GetTransmissionsByStart(start int64, resendLimit int) ([]contract.Transmission, error)

func (MongoClient) GetTransmissionsByStartEnd

func (mc MongoClient) GetTransmissionsByStartEnd(start int64, end int64, resendLimit int) ([]contract.Transmission, error)

func (MongoClient) GetTransmissionsByStatus

func (mc MongoClient) GetTransmissionsByStatus(resendLimit int, status contract.TransmissionStatus) ([]contract.Transmission, error)

func (MongoClient) IntervalActionById

func (mc MongoClient) IntervalActionById(id string) (contract.IntervalAction, error)

Return an Interval Action by ID UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalActionByName

func (mc MongoClient) IntervalActionByName(name string) (contract.IntervalAction, error)

Return an Interval Action by name UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalActions

func (mc MongoClient) IntervalActions() ([]contract.IntervalAction, error)

Return all the Interval Action(s) UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalActionsByIntervalName

func (mc MongoClient) IntervalActionsByIntervalName(name string) ([]contract.IntervalAction, error)

Return Interval Action(s) by interval name UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalActionsByTarget

func (mc MongoClient) IntervalActionsByTarget(name string) ([]contract.IntervalAction, error)

Return Interval Action(s) by target name UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalActionsWithLimit

func (mc MongoClient) IntervalActionsWithLimit(limit int) ([]contract.IntervalAction, error)

Return Interval Action(s) up to the max number specified UnexpectedError - failed to retrieve interval actions from the database Sort the interval actions in descending order by ID

func (MongoClient) IntervalById

func (mc MongoClient) IntervalById(id string) (contract.Interval, error)

Return an Interval by ID UnexpectedError - failed to retrieve interval from the database

func (MongoClient) IntervalByName

func (mc MongoClient) IntervalByName(name string) (contract.Interval, error)

Return an Interval by name UnexpectedError - failed to retrieve interval from the database

func (MongoClient) Intervals

func (mc MongoClient) Intervals() ([]contract.Interval, error)

func (MongoClient) IntervalsWithLimit

func (mc MongoClient) IntervalsWithLimit(limit int) ([]contract.Interval, error)

Return Interval(s) up to the max number specified UnexpectedError - failed to retrieve intervals from the database Sort the intervals in descending order by ID

func (MongoClient) MarkNotificationProcessed

func (mc MongoClient) MarkNotificationProcessed(n contract.Notification) error

func (MongoClient) RegistrationById

func (mc MongoClient) RegistrationById(id string) (contract.Registration, error)

Get a registration by ID UnexpectedError - problem getting in database NotFound - no registration with the ID was found

func (MongoClient) RegistrationByName

func (mc MongoClient) RegistrationByName(name string) (contract.Registration, error)

Get a registration by name UnexpectedError - problem getting in database NotFound - no registration with the name was found

func (MongoClient) Registrations

func (mc MongoClient) Registrations() ([]contract.Registration, error)

Return all the registrations UnexpectedError - failed to retrieve registrations from the database

func (MongoClient) ScrubAllIntervalActions

func (mc MongoClient) ScrubAllIntervalActions() (int, error)

Removes all of the Interval Action(s) Returns number of Interval Action(s) removed UnexpectedError - failed to remove all of the Interval and IntervalActions from the database

func (MongoClient) ScrubAllIntervals

func (mc MongoClient) ScrubAllIntervals() (int, error)

Removes all of the Intervals Removes any IntervalAction(s) previously not removed as well Returns number Interval(s) removed UnexpectedError - failed to remove all of the Interval and IntervalActions from the database

func (MongoClient) ScrubAllRegistrations

func (mc MongoClient) ScrubAllRegistrations() error

Delete all registrations

func (MongoClient) ScrubMetadata

func (mc MongoClient) ScrubMetadata() error

Scrub all metadata

func (MongoClient) UpdateAddressable

func (mc MongoClient) UpdateAddressable(a contract.Addressable) error

func (MongoClient) UpdateCommand

func (mc MongoClient) UpdateCommand(c contract.Command) error

Update command uses the ID of the command for identification

func (MongoClient) UpdateDevice

func (mc MongoClient) UpdateDevice(d contract.Device) error

func (MongoClient) UpdateDeviceProfile

func (mc MongoClient) UpdateDeviceProfile(dp contract.DeviceProfile) error

func (MongoClient) UpdateDeviceService

func (mc MongoClient) UpdateDeviceService(ds contract.DeviceService) error

func (MongoClient) UpdateInterval

func (mc MongoClient) UpdateInterval(interval contract.Interval) error

Update an Interval UnexpectedError - failed to update interval in the database

func (MongoClient) UpdateIntervalAction

func (mc MongoClient) UpdateIntervalAction(action contract.IntervalAction) error

Update an Interval Action UnexpectedError - failed to update interval action in the database

func (MongoClient) UpdateNotification

func (mc MongoClient) UpdateNotification(n contract.Notification) error

func (MongoClient) UpdateProvisionWatcher

func (mc MongoClient) UpdateProvisionWatcher(pw contract.ProvisionWatcher) error

func (MongoClient) UpdateRegistration

func (mc MongoClient) UpdateRegistration(reg contract.Registration) error

Update a registration UnexpectedError - problem updating in database NotFound - no registration with the ID was found

func (MongoClient) UpdateSubscription

func (mc MongoClient) UpdateSubscription(sub contract.Subscription) error

func (MongoClient) UpdateTransmission

func (mc MongoClient) UpdateTransmission(t contract.Transmission) error

Directories

Path Synopsis
****************************************************************************** * Copyright 2018 Dell Inc.
****************************************************************************** * Copyright 2018 Dell Inc.

Jump to

Keyboard shortcuts

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