intune

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

intune

Query Microsoft Intune managed devices via the Microsoft Graph API, for the gollem LLM agent framework.

github.com/gollem-dev/tools/intune

Tools

Name Description
intune_devices_by_user Search managed devices by user email / UPN.
intune_devices_by_hostname Search a managed device by hostname.

Usage

ts, err := intune.New(tenantID, clientID, clientSecret)
if err != nil {
	return err
}
if err := ts.Ping(ctx); err != nil { // optional preflight
	return err
}

Authentication uses the OAuth 2.0 client-credentials flow against the tenant's token endpoint (derived from tenantID, overridable with WithTokenEndpoint).

Parameters

New(tenantID, clientID, clientSecret string, opts ...Option) (*ToolSet, error)

The first three positional arguments are required and must be non-empty.

Options

Option Default
WithBaseURL(string) https://graph.microsoft.com/v1.0
WithTokenEndpoint(string) derived from tenantID
WithHTTPClient(*http.Client) http.DefaultClient
WithLogger(*slog.Logger) slog.Default()

Testing

Mock tests run unconditionally. The live-service test runs only when the TEST_INTUNE_* variables are set:

TEST_INTUNE_TENANT_ID=... TEST_INTUNE_CLIENT_ID=... TEST_INTUNE_CLIENT_SECRET=... \
	TEST_INTUNE_USER=user@example.com TEST_INTUNE_HOSTNAME=host01 go test ./...

Documentation

Overview

Package intune provides a gollem.ToolSet for querying Microsoft Intune managed device information via the Microsoft Graph API. Authentication uses the OAuth 2.0 Client Credentials Flow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*ToolSet)

Option configures a ToolSet.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the Microsoft Graph API base URL (default: https://graph.microsoft.com/v1.0).

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient overrides the HTTP client used for all requests.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets the logger. A nil logger keeps the default (slog.Default()).

func WithTokenEndpoint

func WithTokenEndpoint(endpoint string) Option

WithTokenEndpoint overrides the OAuth2 token endpoint. The default is derived from the tenant ID. This is intended for unit tests that point at httptest servers.

type ToolSet

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

ToolSet implements gollem.ToolSet for Microsoft Intune / Graph API lookups. Fields are unexported; configure via Option.

func New

func New(tenantID string, clientID string, clientSecret string, opts ...Option) (*ToolSet, error)

New constructs the ToolSet with the required Azure AD credentials. tenantID, clientID, and clientSecret must all be non-empty. It only validates static configuration; use Ping to verify connectivity and credentials.

func (*ToolSet) Ping

func (t *ToolSet) Ping(ctx context.Context) error

Ping verifies credentials by acquiring an OAuth access token.

func (*ToolSet) Run

func (t *ToolSet) Run(ctx context.Context, name string, args map[string]any) (map[string]any, error)

Run executes the named Intune tool.

func (*ToolSet) Specs

func (t *ToolSet) Specs(_ context.Context) ([]gollem.ToolSpec, error)

Specs returns the Intune tool specifications.

Jump to

Keyboard shortcuts

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