Documentation
¶
Overview ¶
Package snipe wraps the go-snipeit library with dry-run enforcement and convenience methods for the unifi2snipe sync process.
Index ¶
- Variables
- func SetLogFormatter(formatter logrus.Formatter)
- func SetLogLevel(level logrus.Level)
- func SetLogOutput(output io.Writer)
- type Client
- func (c *Client) CheckoutToLocation(ctx context.Context, assetID, locationID int, checkoutDate string) error
- func (c *Client) CreateAsset(ctx context.Context, asset snipeit.Asset) (*snipeit.Asset, error)
- func (c *Client) CreateModel(ctx context.Context, model snipeit.Model) (*snipeit.Model, error)
- func (c *Client) GetAssetBySerial(ctx context.Context, serial string) (*snipeit.AssetsResponse, error)
- func (c *Client) ListAllModels(ctx context.Context) ([]snipeit.Model, error)
- func (c *Client) PatchAsset(ctx context.Context, id int, asset snipeit.Asset) (*snipeit.Asset, error)
- func (c *Client) SetupFields(fieldsetID int, fields []FieldDef) (map[string]string, error)
- type FieldDef
Constants ¶
This section is empty.
Variables ¶
var ErrDryRun = fmt.Errorf("write blocked: dry-run mode is enabled")
ErrDryRun is returned when a write operation is attempted in dry-run mode.
Functions ¶
func SetLogFormatter ¶
SetLogFormatter sets the logger formatter for the snipe package.
func SetLogLevel ¶
SetLogLevel sets the logger level for the snipe package.
func SetLogOutput ¶
SetLogOutput sets the logger output for the snipe package.
Types ¶
type Client ¶
Client wraps the go-snipeit client with dry-run enforcement.
func (*Client) CheckoutToLocation ¶
func (c *Client) CheckoutToLocation(ctx context.Context, assetID, locationID int, checkoutDate string) error
CheckoutToLocation checks out an asset to a Snipe-IT location. checkoutDate should be in "YYYY-MM-DD" format; pass "" to use today.
func (*Client) CreateAsset ¶
CreateAsset creates a new hardware asset.
func (*Client) CreateModel ¶
CreateModel creates a new asset model in Snipe-IT.
func (*Client) GetAssetBySerial ¶
func (c *Client) GetAssetBySerial(ctx context.Context, serial string) (*snipeit.AssetsResponse, error)
GetAssetBySerial looks up an asset by serial number.
func (*Client) ListAllModels ¶
ListAllModels returns all models from Snipe-IT, handling pagination.