Documentation
¶
Overview ¶
Package printer implements the jamfplatform_pro_printer resource, data source, and list resource backed by the Jamf ProClassic /printers API.
Index ¶
- func NewPrinterDataSource() datasource.DataSource
- func NewPrinterListResource() list.ListResource
- func NewPrinterResource() resource.Resource
- type PrinterDataSource
- func (d *PrinterDataSource) ConfigValidators(ctx context.Context) []datasource.ConfigValidator
- func (d *PrinterDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, ...)
- func (d *PrinterDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, ...)
- func (d *PrinterDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
- func (d *PrinterDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, ...)
- type PrinterDataSourceModel
- type PrinterListResource
- func (r *PrinterListResource) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *PrinterListResource) List(ctx context.Context, req list.ListRequest, stream *list.ListResultsStream)
- func (r *PrinterListResource) ListResourceConfigSchema(ctx context.Context, req list.ListResourceSchemaRequest, ...)
- func (r *PrinterListResource) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- type PrinterListResourceModel
- type PrinterResource
- func (r *PrinterResource) ConfigValidators(ctx context.Context) []resource.ConfigValidator
- func (r *PrinterResource) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *PrinterResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *PrinterResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *PrinterResource) IdentitySchema(ctx context.Context, req resource.IdentitySchemaRequest, ...)
- func (r *PrinterResource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *PrinterResource) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- func (r *PrinterResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, ...)
- func (r *PrinterResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *PrinterResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *PrinterResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- type PrinterResourceModel
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 ¶
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 ¶
func (d *PrinterDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse)
Configure wires the Jamf ProClassic client into the data source via the shared providerdata.ConfigureProClassic helper.
func (*PrinterDataSource) Metadata ¶
func (d *PrinterDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse)
Metadata sets the data source type name for the Terraform provider.
func (*PrinterDataSource) Read ¶
func (d *PrinterDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
Read fetches a printer by ID or by name and populates Terraform state.
func (*PrinterDataSource) Schema ¶
func (d *PrinterDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse)
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"`
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 ¶
func (r *PrinterListResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
Configure wires the Jamf ProClassic client into the list resource via the shared providerdata.ConfigureProClassic helper.
func (*PrinterListResource) List ¶
func (r *PrinterListResource) List(ctx context.Context, req list.ListRequest, stream *list.ListResultsStream)
List executes the query and streams printer identities back to Terraform.
func (*PrinterListResource) ListResourceConfigSchema ¶
func (r *PrinterListResource) ListResourceConfigSchema(ctx context.Context, req list.ListResourceSchemaRequest, resp *list.ListResourceSchemaResponse)
ListResourceConfigSchema describes the supported list filters.
func (*PrinterListResource) Metadata ¶
func (r *PrinterListResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
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 ¶
func (r *PrinterResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
Configure wires the Jamf ProClassic client into the resource via the shared providerdata.ConfigureProClassic helper.
func (*PrinterResource) Create ¶
func (r *PrinterResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
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 ¶
func (r *PrinterResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
Delete removes a Jamf Pro printer.
func (*PrinterResource) IdentitySchema ¶
func (r *PrinterResource) IdentitySchema(ctx context.Context, req resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse)
IdentitySchema defines the identifier used for import and list results.
func (*PrinterResource) ImportState ¶
func (r *PrinterResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
ImportState handles import by the Jamf Pro printer ID.
func (*PrinterResource) Metadata ¶
func (r *PrinterResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
Metadata sets the resource type name for the Terraform provider.
func (*PrinterResource) ModifyPlan ¶
func (r *PrinterResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse)
ModifyPlan reports how many computers this printer reaches through the policies using it.
func (*PrinterResource) Read ¶
func (r *PrinterResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
Read refreshes the Terraform state with the latest printer representation.
func (*PrinterResource) Schema ¶
func (r *PrinterResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
Schema returns the Terraform schema for the printer resource.
func (*PrinterResource) Update ¶
func (r *PrinterResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
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"`
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.