Help us shape the future of Go! Take the 2026 Go Developer Survey

printer

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MPL-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package printer implements the jamfplatform_pro_printer resource, data source, and list resource backed by the Jamf ProClassic /printers API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrinterDataSource

func NewPrinterDataSource() datasource.DataSource

NewPrinterDataSource returns a new instance of PrinterDataSource.

func NewPrinterListResource

func NewPrinterListResource() list.ListResource

NewPrinterListResource returns a list resource for Jamf Pro printer queries.

func NewPrinterResource

func NewPrinterResource() resource.Resource

NewPrinterResource returns a new instance of PrinterResource.

Types

type PrinterDataSource

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

PrinterDataSource implements the Terraform data source for Jamf Pro printers. The singular data source supports lookup by ID OR by name — exactly one of the two must be supplied.

func (*PrinterDataSource) ConfigValidators

func (d *PrinterDataSource) ConfigValidators(ctx context.Context) []datasource.ConfigValidator

ConfigValidators enforces that exactly one of id / name is supplied.

func (*PrinterDataSource) Configure

Configure wires the Jamf ProClassic client into the data source via the shared providerdata.ConfigureProClassic helper.

func (*PrinterDataSource) Metadata

Metadata sets the data source type name for the Terraform provider.

func (*PrinterDataSource) Read

Read fetches a printer by ID or by name and populates Terraform state.

func (*PrinterDataSource) Schema

Schema returns the data source schema.

type PrinterDataSourceModel

type PrinterDataSourceModel struct {
	ID             types.String             `tfsdk:"id"`
	Name           types.String             `tfsdk:"name"`
	Category       types.String             `tfsdk:"category"`
	URI            types.String             `tfsdk:"uri"`
	CUPSName       types.String             `tfsdk:"cups_name"`
	Location       types.String             `tfsdk:"location"`
	Model          types.String             `tfsdk:"model"`
	Info           types.String             `tfsdk:"info"`
	Notes          types.String             `tfsdk:"notes"`
	MakeDefault    types.Bool               `tfsdk:"make_default"`
	UseGeneric     types.Bool               `tfsdk:"use_generic"`
	PPD            types.String             `tfsdk:"ppd"`
	PPDPath        types.String             `tfsdk:"ppd_path"`
	PPDContents    trimmedStringValue       `tfsdk:"ppd_contents"`
	Shared         types.Bool               `tfsdk:"shared"`
	OSRequirements types.String             `tfsdk:"os_requirements"`
	Timeouts       datasourceTimeouts.Value `tfsdk:"timeouts"`
}

PrinterDataSourceModel represents the Terraform data source model for a Jamf Pro printer. Either id or name must be supplied (enforced by ExactlyOneOf at config validation).

type PrinterListResource

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

PrinterListResource implements Terraform query list support for Jamf Pro printers. Classic /printers accepts no query parameters, so the optional `filter` block is applied client-side via filters.ApplyClassicFilter after the full list is fetched. The /printers list endpoint returns only id+name per row, so when IncludeResource=true we follow up with a per-item GetPrinterByID to populate the full record — N+1 path mirroring `dock_item`. Identity-only listing stays a single round trip.

func (*PrinterListResource) Configure

Configure wires the Jamf ProClassic client into the list resource via the shared providerdata.ConfigureProClassic helper.

func (*PrinterListResource) List

List executes the query and streams printer identities back to Terraform.

func (*PrinterListResource) ListResourceConfigSchema

ListResourceConfigSchema describes the supported list filters.

func (*PrinterListResource) Metadata

Metadata sets the list resource type name.

type PrinterListResourceModel

type PrinterListResourceModel struct {
	Filter   *filters.ClassicFilterModel `tfsdk:"filter"`
	Timeouts listtimeouts.Value          `tfsdk:"timeouts"`
}

PrinterListResourceModel represents the config model for printer list queries. Classic has no RSQL — the filter shape is the shared client-side substring block.

type PrinterResource

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

PrinterResource implements the Terraform resource for Jamf Pro printers.

func (*PrinterResource) ConfigValidators

func (r *PrinterResource) ConfigValidators(ctx context.Context) []resource.ConfigValidator

ConfigValidators returns the cross-field validators evaluated against the user's config at plan time.

func (*PrinterResource) Configure

Configure wires the Jamf ProClassic client into the resource via the shared providerdata.ConfigureProClassic helper.

func (*PrinterResource) Create

Create creates a new Jamf Pro printer. Classic POSTs to id="0"; the server allocates the real integer ID and returns it in the response body. We then GET to capture server-populated fields (category sentinel, `ppd_path` auto-fill when `use_generic=true`, etc.).

func (*PrinterResource) Delete

Delete removes a Jamf Pro printer.

func (*PrinterResource) IdentitySchema

IdentitySchema defines the identifier used for import and list results.

func (*PrinterResource) ImportState

ImportState handles import by the Jamf Pro printer ID.

func (*PrinterResource) Metadata

Metadata sets the resource type name for the Terraform provider.

func (*PrinterResource) ModifyPlan

ModifyPlan reports how many computers this printer reaches through the policies using it.

func (*PrinterResource) Read

Read refreshes the Terraform state with the latest printer representation.

func (*PrinterResource) Schema

Schema returns the Terraform schema for the printer resource.

func (*PrinterResource) Update

Update updates a Jamf Pro printer. The classic /printers endpoint applies PUT as a partial merge: omitted tags preserve, empty tags clear, set tags overwrite. The provider's input builder accounts for this (see input_builders.go). After the write we GET to refresh server-computed fields such as `ppd_path` under `use_generic=true`.

type PrinterResourceModel

type PrinterResourceModel struct {
	ID             types.String           `tfsdk:"id"`
	Name           types.String           `tfsdk:"name"`
	Category       types.String           `tfsdk:"category"`
	URI            types.String           `tfsdk:"uri"`
	CUPSName       types.String           `tfsdk:"cups_name"`
	Location       types.String           `tfsdk:"location"`
	Model          types.String           `tfsdk:"model"`
	Info           types.String           `tfsdk:"info"`
	Notes          types.String           `tfsdk:"notes"`
	MakeDefault    types.Bool             `tfsdk:"make_default"`
	UseGeneric     types.Bool             `tfsdk:"use_generic"`
	PPD            types.String           `tfsdk:"ppd"`
	PPDPath        types.String           `tfsdk:"ppd_path"`
	PPDContents    trimmedStringValue     `tfsdk:"ppd_contents"`
	Shared         types.Bool             `tfsdk:"shared"`
	OSRequirements types.String           `tfsdk:"os_requirements"`
	Timeouts       resourceTimeouts.Value `tfsdk:"timeouts"`
}

PrinterResourceModel represents the Terraform resource model for a Jamf Pro printer. The classic /printers endpoint exposes a flat 16-field shape with two non-trivial behaviours: the `category` field round-trips through a server sentinel ("No category assigned" == null), and `use_generic` ⇒ PPD-trio cross-field rules are enforced server-side and mirrored here at plan time by a ConfigValidator.

`ppd_contents` uses a custom string type with trailing-whitespace semantic equality (see custom_types.go) so the server's trailing-whitespace strip does not surface as drift.

Jump to

Keyboard shortcuts

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