common

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[sdkPayloadType any, sdkResponseType any](
	ctx context.Context,
	d *schema.ResourceData,
	meta any,
	construct payoadConstructorFunc[sdkPayloadType],
	serverOutcomeFunc sdkCreateUpdateFunc[sdkPayloadType, sdkResponseType],
	reader providerReadFunc,
) diag.Diagnostics

Create is a shared helper that handles the creation of a new resource in Jamf Pro with retry logic and state management. It accepts generic types for the SDK payload and response to maintain type safety while being reusable.

Parameters: - ctx: The context for the operation, used for timeouts and cancellation - d: The ResourceData containing the desired state from Terraform - meta: The provider meta object containing the authenticated client - construct: A function that builds the SDK payload from ResourceData - serverOutcomeFunc: The SDK function that performs the actual creation API call - reader: A function that reads back the resource state after creation

Returns: - diag.Diagnostics containing any errors or warnings from the operation

func Delete

func Delete(ctx context.Context, d *schema.ResourceData, meta any, serverOutcomeFunc sdkDeleteFunc) diag.Diagnostics

Delete is a shared helper that removes a resource from Jamf Pro with retry logic. It handles both the API deletion and clearing the resource ID from state.

Parameters: - ctx: The context for the operation, used for timeouts and cancellation - d: The ResourceData containing the resource to delete - meta: The provider meta object containing the authenticated client - serverOutcomeFunc: The SDK function that performs the actual delete API call

Returns: - diag.Diagnostics containing any errors or warnings from the operation

func Read

func Read[sdkResponseType any](
	ctx context.Context,
	d *schema.ResourceData,
	meta any,
	removeDeleteResourcesFromState bool,
	serverOutcomeFunc sdkGetFunc[sdkResponseType],
	providerStateFunc providerStateFunc[sdkResponseType],
) diag.Diagnostics

Read is a shared helper that retrieves the current state of a resource from Jamf Pro and updates the Terraform state. It includes retry logic and can optionally remove deleted resources from state.

Parameters: - ctx: The context for the operation, used for timeouts and cancellation - d: The ResourceData to be updated with the current state - meta: The provider meta object containing the authenticated client - removeDeleteResourcesFromState: Whether to remove the resource from state if not found - serverOutcomeFunc: The SDK function that performs the actual read API call - providerStateFunc: A function that updates ResourceData with the API response

Returns: - diag.Diagnostics containing any errors or warnings from the operation

func Update

func Update[sdkPayloadType any, sdkResponseType any](
	ctx context.Context,
	d *schema.ResourceData,
	meta any,
	constructor payoadConstructorFunc[sdkPayloadType],
	outcomeFunc sdkUpdateFunc[sdkPayloadType, sdkResponseType],
	reader providerReadFunc,

) diag.Diagnostics

Update is a shared helper that handles updating an existing resource in Jamf Pro with retry logic. It constructs the update payload, sends it to the API, and refreshes the state.

Parameters: - ctx: The context for the operation, used for timeouts and cancellation - d: The ResourceData containing the desired state from Terraform - meta: The provider meta object containing the authenticated client - constructor: A function that builds the SDK payload from ResourceData - outcomeFunc: The SDK function that performs the actual update API call - reader: A function that reads back the resource state after update

Returns: - diag.Diagnostics containing any errors or warnings from the operation

Types

This section is empty.

Jump to

Keyboard shortcuts

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