Documentation
¶
Index ¶
- type BulkUpsertMachinesEndpoint
- type BulkUpsertMachinesRequest
- type CreateMachineEndpoint
- type CreateMachineRequest
- type DeleteMachineEndpoint
- type DeleteMachineRequest
- type ExportMachinesEndpoint
- type ExportMachinesRequest
- type ListMachinesEndpoint
- type ListMachinesRequest
- type MachineSvc
- type MachineSvcConfig
- type RetrieveMachineEndpoint
- type RetrieveMachineRequest
- type UpdateMachineEndpoint
- type UpdateMachineRequest
- type UpsertMachineInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkUpsertMachinesEndpoint ¶
type BulkUpsertMachinesEndpoint struct{}
Creates or updates multiple machines for the account, matched by name or serial number (case-insensitive), then writes asynchronously — 202 with a job to poll.
func (*BulkUpsertMachinesEndpoint) Materialize ¶
func (e *BulkUpsertMachinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*BulkUpsertMachinesRequest, *apiresource.Job]
type BulkUpsertMachinesRequest ¶
type BulkUpsertMachinesRequest struct {
// Machines to create or update, matched by name or serial number (case-insensitive)
// within the account.
Machines []UpsertMachineInput `json:"machines" validate:"required,min=1,max=1000,dive"`
}
BulkUpsertMachinesRequest is the request to bulk upsert machines.
func (*BulkUpsertMachinesRequest) SchemaExample ¶
func (*BulkUpsertMachinesRequest) SchemaExample() any
type CreateMachineEndpoint ¶
type CreateMachineEndpoint struct{}
Creates a machine and assigns it to a department.
Returns a conflict error if another machine in your account already uses the same name, and a not-found error if the department does not belong to your account. The department cannot be changed once the machine exists.
func (*CreateMachineEndpoint) Materialize ¶
func (e *CreateMachineEndpoint) Materialize() *apiendpoint.APIEndpoint[*CreateMachineRequest, *apiresource.Machine]
type CreateMachineRequest ¶
type CreateMachineRequest struct {
// Display name of the machine.
//
// Must be unique within your account; maximum 255 characters.
Name string `json:"name" validate:"required,max=255"`
// Serial number of the machine.
//
// Maximum 255 characters.
SerialNumber string `json:"serial_number" validate:"required,max=255"`
// Free-form notes about the machine.
Notes field.Optional[string] `json:"notes,omitzero"`
// ID of the department this machine belongs to.
//
// Must reference a department in your account.
DepartmentID string `json:"department_id" validate:"required"`
}
Request to create a machine.
func (*CreateMachineRequest) SchemaExample ¶
func (*CreateMachineRequest) SchemaExample() any
type DeleteMachineEndpoint ¶
type DeleteMachineEndpoint struct{}
Deletes a machine.
Deletion is permanent, and repeating the call reports that the machine has already been deleted. Downtime events and schedule lines already logged against the machine are kept rather than removed with it.
func (*DeleteMachineEndpoint) Materialize ¶
func (e *DeleteMachineEndpoint) Materialize() *apiendpoint.APIEndpoint[*DeleteMachineRequest, *apiresource.EmptyResource]
type DeleteMachineRequest ¶
type DeleteMachineRequest struct {
// ID of the machine to delete.
MachineID string `path:"id" validate:"required"`
}
Request to delete a machine.
type ExportMachinesEndpoint ¶
type ExportMachinesEndpoint struct{}
Starts an export of every matching machine and returns the job that tracks it.
func (*ExportMachinesEndpoint) Materialize ¶
func (e *ExportMachinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ExportMachinesRequest, *apiresource.Job]
type ExportMachinesRequest ¶
type ExportMachinesRequest struct {
// Free-text search term matched against machine names.
Query *string `json:"q"`
}
Filters which machines land in the exported file.
func (*ExportMachinesRequest) SchemaExample ¶
func (*ExportMachinesRequest) SchemaExample() any
type ListMachinesEndpoint ¶
type ListMachinesEndpoint struct{}
Returns a paginated list of machines in your account, most recently created first.
The search term matches the machine name.
func (*ListMachinesEndpoint) Materialize ¶
func (e *ListMachinesEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListMachinesRequest, *apiresource.List[apiresource.Machine]]
type ListMachinesRequest ¶
type ListMachinesRequest struct {
apiresource.PaginationRequest
}
Request to list machines.
type MachineSvc ¶
type MachineSvc interface {
ListMachines(ctx context.Context, req *ListMachinesRequest) (*apiresource.List[apiresource.Machine], *apierror.APIError)
ExportMachines(ctx context.Context, req *ExportMachinesRequest) (*apiresource.Job, *apierror.APIError)
GetMachine(ctx context.Context, req *RetrieveMachineRequest) (*apiresource.Machine, *apierror.APIError)
CreateMachine(ctx context.Context, req *CreateMachineRequest) (*apiresource.Machine, *apierror.APIError)
UpdateMachine(ctx context.Context, req *UpdateMachineRequest) (*apiresource.Machine, *apierror.APIError)
BulkUpsertMachines(ctx context.Context, req *BulkUpsertMachinesRequest) (*apiresource.Job, *apierror.APIError)
DeleteMachine(ctx context.Context, req *DeleteMachineRequest) (*apiresource.EmptyResource, *apierror.APIError)
}
func NewMachineSvc ¶
func NewMachineSvc(config *MachineSvcConfig) MachineSvc
type MachineSvcConfig ¶
type MachineSvcConfig struct {
// CoreClient (required) is the core-service fulfillment gRPC client.
CoreClient pb.CoreFulfillmentServiceClient
}
type RetrieveMachineEndpoint ¶
type RetrieveMachineEndpoint struct{}
Returns a machine by ID.
func (*RetrieveMachineEndpoint) Materialize ¶
func (e *RetrieveMachineEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveMachineRequest, *apiresource.Machine]
type RetrieveMachineRequest ¶
type RetrieveMachineRequest struct {
// ID of the machine to retrieve.
MachineID string `path:"id" validate:"required"`
}
Request to get a machine.
type UpdateMachineEndpoint ¶
type UpdateMachineEndpoint struct{}
Partially updates a machine.
Only the fields provided in the request are changed. Returns a conflict error if the new name is already in use by another machine in your account. A machine cannot be moved to a different department.
func (*UpdateMachineEndpoint) Materialize ¶
func (e *UpdateMachineEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateMachineRequest, *apiresource.Machine]
type UpdateMachineRequest ¶
type UpdateMachineRequest struct {
// ID of the machine to update.
MachineID string `path:"id" validate:"required"`
// Display name of the machine.
//
// Must be unique within your account; maximum 255 characters.
Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
// Serial number of the machine.
//
// Maximum 255 characters.
SerialNumber field.Optional[string] `json:"serial_number,omitzero" validate:"omitempty,max=255"`
// Free-form notes about the machine.
Notes field.Optional[string] `json:"notes,omitzero"`
}
Request to partially update a machine.
func (*UpdateMachineRequest) SchemaExample ¶
func (*UpdateMachineRequest) SchemaExample() any
type UpsertMachineInput ¶
type UpsertMachineInput struct {
// Display name of the machine. Rows match existing machines by name or serial number
// (case-insensitive); a row whose name and serial match two different machines fails.
Name string `json:"name" validate:"required,max=255"`
// Serial number of the machine. Also used for matching — see `name`.
SerialNumber string `json:"serial_number" validate:"required,max=255"`
// Free-form notes about the machine. Preserved when omitted on update.
Notes field.Optional[string] `json:"notes,omitzero"`
// Department this machine belongs to, referenced by `id` or `name`. Create-only.
Department apirequest.ObjectIdentifier `json:"department" validate:"required"`
}
UpsertMachineInput is the input for a single machine in a bulk upsert operation.