device_bootstrap

package
v0.0.0-...-0600186 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEVICE_CREDENTIALS_API_PATH = "/devicecontrol/deviceCredentials"
	DEVICE_CREDENTIALS_TYPE     = "application/vnd.com.nsn.cumulocity.deviceCredentials+json"
)
View Source
const (
	DEVICE_REGISTRATION_API_PATH        = "/devicecontrol/newDeviceRequests"
	DEVICE_REGISTRATION_TYPE            = "application/vnd.com.nsn.cumulocity.NewDeviceRequest+json"
	DEVICE_REGISTRATION_COLLECTION_TYPE = "application/vnd.com.nsn.cumulocity.newDeviceRequestCollection+json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceCredentials

type DeviceCredentials struct {
	ID       string `json:"id,omitempty"`
	TenantID string `json:"tenantId,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Self     string `json:"self,omitempty"`
}

DeviceCredentials represent cumulocity's 'application/vnd.com.nsn.cumulocity.deviceCredentials+json'. See: https://cumulocity.com/guides/reference/device-credentials/#devicecredentials-application-vnd-com-nsn-cumulocity-devicecredentials-json

type DeviceCredentialsApi

type DeviceCredentialsApi interface {
	// Creates new device credentials for a given id
	Create(deviceId string) (*DeviceCredentials, *generic.Error)
}

func NewDeviceCredentialsApi

func NewDeviceCredentialsApi(client *generic.Client) DeviceCredentialsApi

Creates a new device credentials api object client - Must be a gomulocity client. returns - The `device credentials`-api object

type DeviceRegistration

type DeviceRegistration struct {
	Id               string      `json:"id,omitempty"`
	Status           Status      `json:"status,omitempty"`
	Self             string      `json:"self,omitempty"`
	Owner            string      `json:"owner,omitempty"`
	CustomProperties interface{} `json:"customProperties,omitempty"`
	CreationTime     *time.Time  `json:"creationTime,omitempty"`
	TenantId         string      `json:"tenantId,omitempty"`
}

DeviceRegistration represent cumulocity's 'application/vnd.com.nsn.cumulocity.NewDeviceRequest+json'. See: https://cumulocity.com/guides/reference/device-credentials/#newdevicerequest-application-vnd-com-nsn-cumulocity-newdevicerequest-json

type DeviceRegistrationApi

type DeviceRegistrationApi interface {
	// Creates a new deviceRegistration and returns the created entity with status
	Create(deviceId string) (*DeviceRegistration, *generic.Error)

	// Gets an exiting deviceRegistration by device id. If the id does not exists, nil is returned.
	Get(deviceId string) (*DeviceRegistration, *generic.Error)

	// Updates an exiting deviceRegistration and returns the updated deviceRegistration entity.
	Update(deviceId string, newStatus Status) (*DeviceRegistration, *generic.Error)

	// Deletes deviceRegistrations by device id. If error is nil, deviceRegistrations were deleted successfully.
	Delete(deviceId string) *generic.Error

	// Returns page by page all deviceRegistrations.
	GetAll(pageSize int) (*DeviceRegistrationCollection, *generic.Error)

	// Gets the next page from an existing deviceRegistration collection.
	// If there is no next page, nil is returned.
	NextPage(c *DeviceRegistrationCollection) (*DeviceRegistrationCollection, *generic.Error)

	// Gets the previous page from an existing deviceRegistration collection.
	// If there is no previous page, nil is returned.
	PreviousPage(c *DeviceRegistrationCollection) (*DeviceRegistrationCollection, *generic.Error)
}

func NewDeviceRegistrationApi

func NewDeviceRegistrationApi(client *generic.Client) DeviceRegistrationApi

Creates a new deviceRegistration api object client - Must be a gomulocity client. returns - The `deviceRegistration`-api object

type DeviceRegistrationCollection

type DeviceRegistrationCollection struct {
	Self                string                    `json:"self"`
	DeviceRegistrations []DeviceRegistration      `json:"newDeviceRequests"`
	Statistics          *generic.PagingStatistics `json:"statistics"`
	Prev                string                    `json:"prev"`
	Next                string                    `json:"next"`
}

DeviceRequestCollection represent cumulocity's 'application/vnd.com.nsn.cumulocity.newDeviceRequestCollection+json'. See: https://cumulocity.com/guides/reference/device-credentials/#newdevicerequestcollection-application-vnd-com-nsn-cumulocity-newdevicerequestcollection-json

type Status

type Status string
const (
	WAITING_FOR_CONNECTION Status = "WAITING_FOR_CONNECTION"
	PENDING_ACCEPTANCE     Status = "PENDING_ACCEPTANCE"
	ACCEPTED               Status = "ACCEPTED"
)

Jump to

Keyboard shortcuts

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