inventory

package
v0.0.0-...-0ca2cd7 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2023 Northern.tech AS

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 2023 Northern.tech AS

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 2023 Northern.tech AS

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 (
	AttrScopeInventory = "inventory"
	AttrScopeIdentity  = "identity"
	AttrScopeSystem    = "system"
)

1:1 port of the inventory device for inventory api compat

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	//GetDevices uses the search endpoint to get devices just by ids (not filters)
	GetDevices(ctx context.Context, tid string, deviceIDs []string) ([]Device, error)
}

func NewClient

func NewClient(urlBase string) Client

type Device

type Device struct {
	// ID is the system-generated device ID
	ID DeviceID `json:"id" bson:"_id,omitempty"`

	// Attributes is a map of attributes names and their values.
	Attributes DeviceAttributes `json:"attributes,omitempty" bson:"attributes,omitempty"`

	// Group contains the device's group name
	Group GroupName `json:"-" bson:"group,omitempty"`

	// CreatedTs contains the timestamp of the creation time
	CreatedTs time.Time `json:"created_ts,omitempty" bson:"created_ts,omitempty"`

	// UpdatedTs contains the timestamp of the latest attribute update
	UpdatedTs time.Time `json:"updated_ts,omitempty" bson:"updated_ts,omitempty"`

	// LastCheckinDate contains the date of the latest device call to backend
	LastCheckinDate *time.Time `json:"check_in_time,omitempty" bson:"check_in_time,omitempty"`

	// Revision is the device object revision
	Revision uint `json:"-" bson:"revision,omitempty"`
}

Device is a wrapper for inventory devices

type DeviceAttribute

type DeviceAttribute struct {
	Name        string      `json:"name" bson:",omitempty"`
	Description *string     `json:"description,omitempty" bson:",omitempty"`
	Value       interface{} `json:"value" bson:",omitempty"`
	Scope       string      `json:"scope" bson:",omitempty"`
}

type DeviceAttributes

type DeviceAttributes []DeviceAttribute

func (*DeviceAttributes) UnmarshalJSON

func (d *DeviceAttributes) UnmarshalJSON(b []byte) error

type DeviceID

type DeviceID string

type GetDevsReq

type GetDevsReq struct {
	DeviceIDs []string `json:"device_ids"`
	Page      uint     `json:"page"`
	PerPage   uint     `json:"per_page"`
}

GetDevsReq is a stripped down inventory search query default max 20 devices

type GroupName

type GroupName string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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