From bb87fef0345036d04f23d6dbe0631e6c6c67f2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D7=A0=CF=85=CE=B1=CE=B7=20=D7=A0=CF=85=CE=B1=CE=B7=D1=95?= =?UTF-8?q?=CF=83=CE=B7?= Date: Fri, 6 Mar 2026 18:15:50 -0800 Subject: [PATCH] feat(file): add SHA pre-check, force upload, and 409 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SDK-side SHA-256 pre-check to skip uploads when content is unchanged. Add WithForce option to bypass pre-check and server-side digest check. Add 409 Conflict error handling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docs/gen/gen.md | 882 +++++++++++---------- docs/gen/osapi.md | 96 ++- docs/osapi/file.md | 58 +- examples/orchestration/file-deploy/main.go | 19 +- examples/osapi/file/main.go | 46 +- go.mod | 18 +- go.sum | 18 + pkg/osapi/file.go | 123 ++- pkg/osapi/file_public_test.go | 284 ++++++- pkg/osapi/file_types.go | 51 +- pkg/osapi/file_types_test.go | 24 +- pkg/osapi/gen/api.yaml | 89 ++- pkg/osapi/gen/cfg.yaml | 2 + pkg/osapi/gen/client.gen.go | 135 ++-- 14 files changed, 1233 insertions(+), 612 deletions(-) diff --git a/docs/gen/gen.md b/docs/gen/gen.md index f262fee..393d406 100644 --- a/docs/gen/gen.md +++ b/docs/gen/gen.md @@ -40,8 +40,7 @@ Package gen contains generated code for the OSAPI REST API client. - [func NewGetNodeStatusRequest\(server string, hostname Hostname\) \(\*http.Request, error\)](<#NewGetNodeStatusRequest>) - [func NewGetNodeUptimeRequest\(server string, hostname Hostname\) \(\*http.Request, error\)](<#NewGetNodeUptimeRequest>) - [func NewGetVersionRequest\(server string\) \(\*http.Request, error\)](<#NewGetVersionRequest>) -- [func NewPostFileRequest\(server string, body PostFileJSONRequestBody\) \(\*http.Request, error\)](<#NewPostFileRequest>) -- [func NewPostFileRequestWithBody\(server string, contentType string, body io.Reader\) \(\*http.Request, error\)](<#NewPostFileRequestWithBody>) +- [func NewPostFileRequestWithBody\(server string, params \*PostFileParams, contentType string, body io.Reader\) \(\*http.Request, error\)](<#NewPostFileRequestWithBody>) - [func NewPostJobRequest\(server string, body PostJobJSONRequestBody\) \(\*http.Request, error\)](<#NewPostJobRequest>) - [func NewPostJobRequestWithBody\(server string, contentType string, body io.Reader\) \(\*http.Request, error\)](<#NewPostJobRequestWithBody>) - [func NewPostNodeCommandExecRequest\(server string, hostname Hostname, body PostNodeCommandExecJSONRequestBody\) \(\*http.Request, error\)](<#NewPostNodeCommandExecRequest>) @@ -93,8 +92,7 @@ Package gen contains generated code for the OSAPI REST API client. - [func \(c \*Client\) GetNodeStatus\(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.GetNodeStatus>) - [func \(c \*Client\) GetNodeUptime\(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.GetNodeUptime>) - [func \(c \*Client\) GetVersion\(ctx context.Context, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.GetVersion>) - - [func \(c \*Client\) PostFile\(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostFile>) - - [func \(c \*Client\) PostFileWithBody\(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostFileWithBody>) + - [func \(c \*Client\) PostFileWithBody\(ctx context.Context, params \*PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostFileWithBody>) - [func \(c \*Client\) PostJob\(ctx context.Context, body PostJobJSONRequestBody, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostJob>) - [func \(c \*Client\) PostJobWithBody\(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostJobWithBody>) - [func \(c \*Client\) PostNodeCommandExec\(ctx context.Context, hostname Hostname, body PostNodeCommandExecJSONRequestBody, reqEditors ...RequestEditorFn\) \(\*http.Response, error\)](<#Client.PostNodeCommandExec>) @@ -144,8 +142,7 @@ Package gen contains generated code for the OSAPI REST API client. - [func \(c \*ClientWithResponses\) GetNodeStatusWithResponse\(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn\) \(\*GetNodeStatusResponse, error\)](<#ClientWithResponses.GetNodeStatusWithResponse>) - [func \(c \*ClientWithResponses\) GetNodeUptimeWithResponse\(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn\) \(\*GetNodeUptimeResponse, error\)](<#ClientWithResponses.GetNodeUptimeWithResponse>) - [func \(c \*ClientWithResponses\) GetVersionWithResponse\(ctx context.Context, reqEditors ...RequestEditorFn\) \(\*GetVersionResponse, error\)](<#ClientWithResponses.GetVersionWithResponse>) - - [func \(c \*ClientWithResponses\) PostFileWithBodyWithResponse\(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*PostFileResponse, error\)](<#ClientWithResponses.PostFileWithBodyWithResponse>) - - [func \(c \*ClientWithResponses\) PostFileWithResponse\(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn\) \(\*PostFileResponse, error\)](<#ClientWithResponses.PostFileWithResponse>) + - [func \(c \*ClientWithResponses\) PostFileWithBodyWithResponse\(ctx context.Context, params \*PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*PostFileResponse, error\)](<#ClientWithResponses.PostFileWithBodyWithResponse>) - [func \(c \*ClientWithResponses\) PostJobWithBodyWithResponse\(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*PostJobResponse, error\)](<#ClientWithResponses.PostJobWithBodyWithResponse>) - [func \(c \*ClientWithResponses\) PostJobWithResponse\(ctx context.Context, body PostJobJSONRequestBody, reqEditors ...RequestEditorFn\) \(\*PostJobResponse, error\)](<#ClientWithResponses.PostJobWithResponse>) - [func \(c \*ClientWithResponses\) PostNodeCommandExecWithBodyWithResponse\(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn\) \(\*PostNodeCommandExecResponse, error\)](<#ClientWithResponses.PostNodeCommandExecWithBodyWithResponse>) @@ -206,7 +203,6 @@ Package gen contains generated code for the OSAPI REST API client. - [type FileName](<#FileName>) - [type FileStatusRequest](<#FileStatusRequest>) - [type FileStatusResponse](<#FileStatusResponse>) -- [type FileUploadRequest](<#FileUploadRequest>) - [type FileUploadResponse](<#FileUploadResponse>) - [type GetAgentDetailsResponse](<#GetAgentDetailsResponse>) - [func ParseGetAgentDetailsResponse\(rsp \*http.Response\) \(\*GetAgentDetailsResponse, error\)](<#ParseGetAgentDetailsResponse>) @@ -328,7 +324,10 @@ Package gen contains generated code for the OSAPI REST API client. - [type OSInfoResultItem](<#OSInfoResultItem>) - [type PingCollectionResponse](<#PingCollectionResponse>) - [type PingResponse](<#PingResponse>) -- [type PostFileJSONRequestBody](<#PostFileJSONRequestBody>) +- [type PostFileMultipartBody](<#PostFileMultipartBody>) +- [type PostFileMultipartBodyContentType](<#PostFileMultipartBodyContentType>) +- [type PostFileMultipartRequestBody](<#PostFileMultipartRequestBody>) +- [type PostFileParams](<#PostFileParams>) - [type PostFileResponse](<#PostFileResponse>) - [func ParsePostFileResponse\(rsp \*http.Response\) \(\*PostFileResponse, error\)](<#ParsePostFileResponse>) - [func \(r PostFileResponse\) Status\(\) string](<#PostFileResponse.Status>) @@ -401,7 +400,7 @@ const ( ``` -## func [NewDeleteFileByNameRequest]() +## func [NewDeleteFileByNameRequest]() ```go func NewDeleteFileByNameRequest(server string, name FileName) (*http.Request, error) @@ -410,7 +409,7 @@ func NewDeleteFileByNameRequest(server string, name FileName) (*http.Request, er NewDeleteFileByNameRequest generates requests for DeleteFileByName -## func [NewDeleteJobByIDRequest]() +## func [NewDeleteJobByIDRequest]() ```go func NewDeleteJobByIDRequest(server string, id openapi_types.UUID) (*http.Request, error) @@ -419,7 +418,7 @@ func NewDeleteJobByIDRequest(server string, id openapi_types.UUID) (*http.Reques NewDeleteJobByIDRequest generates requests for DeleteJobByID -## func [NewDrainAgentRequest]() +## func [NewDrainAgentRequest]() ```go func NewDrainAgentRequest(server string, hostname string) (*http.Request, error) @@ -428,7 +427,7 @@ func NewDrainAgentRequest(server string, hostname string) (*http.Request, error) NewDrainAgentRequest generates requests for DrainAgent -## func [NewGetAgentDetailsRequest]() +## func [NewGetAgentDetailsRequest]() ```go func NewGetAgentDetailsRequest(server string, hostname string) (*http.Request, error) @@ -437,7 +436,7 @@ func NewGetAgentDetailsRequest(server string, hostname string) (*http.Request, e NewGetAgentDetailsRequest generates requests for GetAgentDetails -## func [NewGetAgentRequest]() +## func [NewGetAgentRequest]() ```go func NewGetAgentRequest(server string) (*http.Request, error) @@ -446,7 +445,7 @@ func NewGetAgentRequest(server string) (*http.Request, error) NewGetAgentRequest generates requests for GetAgent -## func [NewGetAuditExportRequest]() +## func [NewGetAuditExportRequest]() ```go func NewGetAuditExportRequest(server string) (*http.Request, error) @@ -455,7 +454,7 @@ func NewGetAuditExportRequest(server string) (*http.Request, error) NewGetAuditExportRequest generates requests for GetAuditExport -## func [NewGetAuditLogByIDRequest]() +## func [NewGetAuditLogByIDRequest]() ```go func NewGetAuditLogByIDRequest(server string, id openapi_types.UUID) (*http.Request, error) @@ -464,7 +463,7 @@ func NewGetAuditLogByIDRequest(server string, id openapi_types.UUID) (*http.Requ NewGetAuditLogByIDRequest generates requests for GetAuditLogByID -## func [NewGetAuditLogsRequest]() +## func [NewGetAuditLogsRequest]() ```go func NewGetAuditLogsRequest(server string, params *GetAuditLogsParams) (*http.Request, error) @@ -473,7 +472,7 @@ func NewGetAuditLogsRequest(server string, params *GetAuditLogsParams) (*http.Re NewGetAuditLogsRequest generates requests for GetAuditLogs -## func [NewGetFileByNameRequest]() +## func [NewGetFileByNameRequest]() ```go func NewGetFileByNameRequest(server string, name FileName) (*http.Request, error) @@ -482,7 +481,7 @@ func NewGetFileByNameRequest(server string, name FileName) (*http.Request, error NewGetFileByNameRequest generates requests for GetFileByName -## func [NewGetFilesRequest]() +## func [NewGetFilesRequest]() ```go func NewGetFilesRequest(server string) (*http.Request, error) @@ -491,7 +490,7 @@ func NewGetFilesRequest(server string) (*http.Request, error) NewGetFilesRequest generates requests for GetFiles -## func [NewGetHealthReadyRequest]() +## func [NewGetHealthReadyRequest]() ```go func NewGetHealthReadyRequest(server string) (*http.Request, error) @@ -500,7 +499,7 @@ func NewGetHealthReadyRequest(server string) (*http.Request, error) NewGetHealthReadyRequest generates requests for GetHealthReady -## func [NewGetHealthRequest]() +## func [NewGetHealthRequest]() ```go func NewGetHealthRequest(server string) (*http.Request, error) @@ -509,7 +508,7 @@ func NewGetHealthRequest(server string) (*http.Request, error) NewGetHealthRequest generates requests for GetHealth -## func [NewGetHealthStatusRequest]() +## func [NewGetHealthStatusRequest]() ```go func NewGetHealthStatusRequest(server string) (*http.Request, error) @@ -518,7 +517,7 @@ func NewGetHealthStatusRequest(server string) (*http.Request, error) NewGetHealthStatusRequest generates requests for GetHealthStatus -## func [NewGetJobByIDRequest]() +## func [NewGetJobByIDRequest]() ```go func NewGetJobByIDRequest(server string, id openapi_types.UUID) (*http.Request, error) @@ -527,7 +526,7 @@ func NewGetJobByIDRequest(server string, id openapi_types.UUID) (*http.Request, NewGetJobByIDRequest generates requests for GetJobByID -## func [NewGetJobRequest]() +## func [NewGetJobRequest]() ```go func NewGetJobRequest(server string, params *GetJobParams) (*http.Request, error) @@ -536,7 +535,7 @@ func NewGetJobRequest(server string, params *GetJobParams) (*http.Request, error NewGetJobRequest generates requests for GetJob -## func [NewGetJobStatusRequest]() +## func [NewGetJobStatusRequest]() ```go func NewGetJobStatusRequest(server string) (*http.Request, error) @@ -545,7 +544,7 @@ func NewGetJobStatusRequest(server string) (*http.Request, error) NewGetJobStatusRequest generates requests for GetJobStatus -## func [NewGetNodeDiskRequest]() +## func [NewGetNodeDiskRequest]() ```go func NewGetNodeDiskRequest(server string, hostname Hostname) (*http.Request, error) @@ -554,7 +553,7 @@ func NewGetNodeDiskRequest(server string, hostname Hostname) (*http.Request, err NewGetNodeDiskRequest generates requests for GetNodeDisk -## func [NewGetNodeHostnameRequest]() +## func [NewGetNodeHostnameRequest]() ```go func NewGetNodeHostnameRequest(server string, hostname Hostname) (*http.Request, error) @@ -563,7 +562,7 @@ func NewGetNodeHostnameRequest(server string, hostname Hostname) (*http.Request, NewGetNodeHostnameRequest generates requests for GetNodeHostname -## func [NewGetNodeLoadRequest]() +## func [NewGetNodeLoadRequest]() ```go func NewGetNodeLoadRequest(server string, hostname Hostname) (*http.Request, error) @@ -572,7 +571,7 @@ func NewGetNodeLoadRequest(server string, hostname Hostname) (*http.Request, err NewGetNodeLoadRequest generates requests for GetNodeLoad -## func [NewGetNodeMemoryRequest]() +## func [NewGetNodeMemoryRequest]() ```go func NewGetNodeMemoryRequest(server string, hostname Hostname) (*http.Request, error) @@ -581,7 +580,7 @@ func NewGetNodeMemoryRequest(server string, hostname Hostname) (*http.Request, e NewGetNodeMemoryRequest generates requests for GetNodeMemory -## func [NewGetNodeNetworkDNSByInterfaceRequest]() +## func [NewGetNodeNetworkDNSByInterfaceRequest]() ```go func NewGetNodeNetworkDNSByInterfaceRequest(server string, hostname Hostname, interfaceName string) (*http.Request, error) @@ -590,7 +589,7 @@ func NewGetNodeNetworkDNSByInterfaceRequest(server string, hostname Hostname, in NewGetNodeNetworkDNSByInterfaceRequest generates requests for GetNodeNetworkDNSByInterface -## func [NewGetNodeOSRequest]() +## func [NewGetNodeOSRequest]() ```go func NewGetNodeOSRequest(server string, hostname Hostname) (*http.Request, error) @@ -599,7 +598,7 @@ func NewGetNodeOSRequest(server string, hostname Hostname) (*http.Request, error NewGetNodeOSRequest generates requests for GetNodeOS -## func [NewGetNodeStatusRequest]() +## func [NewGetNodeStatusRequest]() ```go func NewGetNodeStatusRequest(server string, hostname Hostname) (*http.Request, error) @@ -608,7 +607,7 @@ func NewGetNodeStatusRequest(server string, hostname Hostname) (*http.Request, e NewGetNodeStatusRequest generates requests for GetNodeStatus -## func [NewGetNodeUptimeRequest]() +## func [NewGetNodeUptimeRequest]() ```go func NewGetNodeUptimeRequest(server string, hostname Hostname) (*http.Request, error) @@ -617,7 +616,7 @@ func NewGetNodeUptimeRequest(server string, hostname Hostname) (*http.Request, e NewGetNodeUptimeRequest generates requests for GetNodeUptime -## func [NewGetVersionRequest]() +## func [NewGetVersionRequest]() ```go func NewGetVersionRequest(server string) (*http.Request, error) @@ -625,26 +624,17 @@ func NewGetVersionRequest(server string) (*http.Request, error) NewGetVersionRequest generates requests for GetVersion - -## func [NewPostFileRequest]() - -```go -func NewPostFileRequest(server string, body PostFileJSONRequestBody) (*http.Request, error) -``` - -NewPostFileRequest calls the generic PostFile builder with application/json body - -## func [NewPostFileRequestWithBody]() +## func [NewPostFileRequestWithBody]() ```go -func NewPostFileRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) +func NewPostFileRequestWithBody(server string, params *PostFileParams, contentType string, body io.Reader) (*http.Request, error) ``` NewPostFileRequestWithBody generates requests for PostFile with any type of body -## func [NewPostJobRequest]() +## func [NewPostJobRequest]() ```go func NewPostJobRequest(server string, body PostJobJSONRequestBody) (*http.Request, error) @@ -653,7 +643,7 @@ func NewPostJobRequest(server string, body PostJobJSONRequestBody) (*http.Reques NewPostJobRequest calls the generic PostJob builder with application/json body -## func [NewPostJobRequestWithBody]() +## func [NewPostJobRequestWithBody]() ```go func NewPostJobRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) @@ -662,7 +652,7 @@ func NewPostJobRequestWithBody(server string, contentType string, body io.Reader NewPostJobRequestWithBody generates requests for PostJob with any type of body -## func [NewPostNodeCommandExecRequest]() +## func [NewPostNodeCommandExecRequest]() ```go func NewPostNodeCommandExecRequest(server string, hostname Hostname, body PostNodeCommandExecJSONRequestBody) (*http.Request, error) @@ -671,7 +661,7 @@ func NewPostNodeCommandExecRequest(server string, hostname Hostname, body PostNo NewPostNodeCommandExecRequest calls the generic PostNodeCommandExec builder with application/json body -## func [NewPostNodeCommandExecRequestWithBody]() +## func [NewPostNodeCommandExecRequestWithBody]() ```go func NewPostNodeCommandExecRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -680,7 +670,7 @@ func NewPostNodeCommandExecRequestWithBody(server string, hostname Hostname, con NewPostNodeCommandExecRequestWithBody generates requests for PostNodeCommandExec with any type of body -## func [NewPostNodeCommandShellRequest]() +## func [NewPostNodeCommandShellRequest]() ```go func NewPostNodeCommandShellRequest(server string, hostname Hostname, body PostNodeCommandShellJSONRequestBody) (*http.Request, error) @@ -689,7 +679,7 @@ func NewPostNodeCommandShellRequest(server string, hostname Hostname, body PostN NewPostNodeCommandShellRequest calls the generic PostNodeCommandShell builder with application/json body -## func [NewPostNodeCommandShellRequestWithBody]() +## func [NewPostNodeCommandShellRequestWithBody]() ```go func NewPostNodeCommandShellRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -698,7 +688,7 @@ func NewPostNodeCommandShellRequestWithBody(server string, hostname Hostname, co NewPostNodeCommandShellRequestWithBody generates requests for PostNodeCommandShell with any type of body -## func [NewPostNodeFileDeployRequest]() +## func [NewPostNodeFileDeployRequest]() ```go func NewPostNodeFileDeployRequest(server string, hostname Hostname, body PostNodeFileDeployJSONRequestBody) (*http.Request, error) @@ -707,7 +697,7 @@ func NewPostNodeFileDeployRequest(server string, hostname Hostname, body PostNod NewPostNodeFileDeployRequest calls the generic PostNodeFileDeploy builder with application/json body -## func [NewPostNodeFileDeployRequestWithBody]() +## func [NewPostNodeFileDeployRequestWithBody]() ```go func NewPostNodeFileDeployRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -716,7 +706,7 @@ func NewPostNodeFileDeployRequestWithBody(server string, hostname Hostname, cont NewPostNodeFileDeployRequestWithBody generates requests for PostNodeFileDeploy with any type of body -## func [NewPostNodeFileStatusRequest]() +## func [NewPostNodeFileStatusRequest]() ```go func NewPostNodeFileStatusRequest(server string, hostname Hostname, body PostNodeFileStatusJSONRequestBody) (*http.Request, error) @@ -725,7 +715,7 @@ func NewPostNodeFileStatusRequest(server string, hostname Hostname, body PostNod NewPostNodeFileStatusRequest calls the generic PostNodeFileStatus builder with application/json body -## func [NewPostNodeFileStatusRequestWithBody]() +## func [NewPostNodeFileStatusRequestWithBody]() ```go func NewPostNodeFileStatusRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -734,7 +724,7 @@ func NewPostNodeFileStatusRequestWithBody(server string, hostname Hostname, cont NewPostNodeFileStatusRequestWithBody generates requests for PostNodeFileStatus with any type of body -## func [NewPostNodeNetworkPingRequest]() +## func [NewPostNodeNetworkPingRequest]() ```go func NewPostNodeNetworkPingRequest(server string, hostname Hostname, body PostNodeNetworkPingJSONRequestBody) (*http.Request, error) @@ -743,7 +733,7 @@ func NewPostNodeNetworkPingRequest(server string, hostname Hostname, body PostNo NewPostNodeNetworkPingRequest calls the generic PostNodeNetworkPing builder with application/json body -## func [NewPostNodeNetworkPingRequestWithBody]() +## func [NewPostNodeNetworkPingRequestWithBody]() ```go func NewPostNodeNetworkPingRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -752,7 +742,7 @@ func NewPostNodeNetworkPingRequestWithBody(server string, hostname Hostname, con NewPostNodeNetworkPingRequestWithBody generates requests for PostNodeNetworkPing with any type of body -## func [NewPutNodeNetworkDNSRequest]() +## func [NewPutNodeNetworkDNSRequest]() ```go func NewPutNodeNetworkDNSRequest(server string, hostname Hostname, body PutNodeNetworkDNSJSONRequestBody) (*http.Request, error) @@ -761,7 +751,7 @@ func NewPutNodeNetworkDNSRequest(server string, hostname Hostname, body PutNodeN NewPutNodeNetworkDNSRequest calls the generic PutNodeNetworkDNS builder with application/json body -## func [NewPutNodeNetworkDNSRequestWithBody]() +## func [NewPutNodeNetworkDNSRequestWithBody]() ```go func NewPutNodeNetworkDNSRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) @@ -770,7 +760,7 @@ func NewPutNodeNetworkDNSRequestWithBody(server string, hostname Hostname, conte NewPutNodeNetworkDNSRequestWithBody generates requests for PutNodeNetworkDNS with any type of body -## func [NewRetryJobByIDRequest]() +## func [NewRetryJobByIDRequest]() ```go func NewRetryJobByIDRequest(server string, id openapi_types.UUID, body RetryJobByIDJSONRequestBody) (*http.Request, error) @@ -779,7 +769,7 @@ func NewRetryJobByIDRequest(server string, id openapi_types.UUID, body RetryJobB NewRetryJobByIDRequest calls the generic RetryJobByID builder with application/json body -## func [NewRetryJobByIDRequestWithBody]() +## func [NewRetryJobByIDRequestWithBody]() ```go func NewRetryJobByIDRequestWithBody(server string, id openapi_types.UUID, contentType string, body io.Reader) (*http.Request, error) @@ -788,7 +778,7 @@ func NewRetryJobByIDRequestWithBody(server string, id openapi_types.UUID, conten NewRetryJobByIDRequestWithBody generates requests for RetryJobByID with any type of body -## func [NewUndrainAgentRequest]() +## func [NewUndrainAgentRequest]() ```go func NewUndrainAgentRequest(server string, hostname string) (*http.Request, error) @@ -797,7 +787,7 @@ func NewUndrainAgentRequest(server string, hostname string) (*http.Request, erro NewUndrainAgentRequest generates requests for UndrainAgent -## type [AgentDetail]() +## type [AgentDetail]() AgentDetail defines model for AgentDetail. @@ -815,7 +805,7 @@ type AgentDetail struct { ``` -## type [AgentInfo]() +## type [AgentInfo]() AgentInfo defines model for AgentInfo. @@ -888,7 +878,7 @@ type AgentInfo struct { ``` -## type [AgentInfoState]() +## type [AgentInfoState]() AgentInfoState Agent scheduling state. @@ -907,7 +897,7 @@ const ( ``` -## type [AgentInfoStatus]() +## type [AgentInfoStatus]() AgentInfoStatus The current status of the agent. @@ -925,7 +915,7 @@ const ( ``` -## type [AgentStats]() +## type [AgentStats]() AgentStats defines model for AgentStats. @@ -943,7 +933,7 @@ type AgentStats struct { ``` -## type [AuditEntry]() +## type [AuditEntry]() AuditEntry defines model for AuditEntry. @@ -982,7 +972,7 @@ type AuditEntry struct { ``` -## type [AuditEntryResponse]() +## type [AuditEntryResponse]() AuditEntryResponse defines model for AuditEntryResponse. @@ -993,7 +983,7 @@ type AuditEntryResponse struct { ``` -## type [Client]() +## type [Client]() Client which conforms to the OpenAPI3 specification for this service. @@ -1016,7 +1006,7 @@ type Client struct { ``` -### func [NewClient]() +### func [NewClient]() ```go func NewClient(server string, opts ...ClientOption) (*Client, error) @@ -1025,7 +1015,7 @@ func NewClient(server string, opts ...ClientOption) (*Client, error) Creates a new Client, with reasonable defaults -### func \(\*Client\) [DeleteFileByName]() +### func \(\*Client\) [DeleteFileByName]() ```go func (c *Client) DeleteFileByName(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1034,7 +1024,7 @@ func (c *Client) DeleteFileByName(ctx context.Context, name FileName, reqEditors -### func \(\*Client\) [DeleteJobByID]() +### func \(\*Client\) [DeleteJobByID]() ```go func (c *Client) DeleteJobByID(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1043,7 +1033,7 @@ func (c *Client) DeleteJobByID(ctx context.Context, id openapi_types.UUID, reqEd -### func \(\*Client\) [DrainAgent]() +### func \(\*Client\) [DrainAgent]() ```go func (c *Client) DrainAgent(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1052,7 +1042,7 @@ func (c *Client) DrainAgent(ctx context.Context, hostname string, reqEditors ... -### func \(\*Client\) [GetAgent]() +### func \(\*Client\) [GetAgent]() ```go func (c *Client) GetAgent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1061,7 +1051,7 @@ func (c *Client) GetAgent(ctx context.Context, reqEditors ...RequestEditorFn) (* -### func \(\*Client\) [GetAgentDetails]() +### func \(\*Client\) [GetAgentDetails]() ```go func (c *Client) GetAgentDetails(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1070,7 +1060,7 @@ func (c *Client) GetAgentDetails(ctx context.Context, hostname string, reqEditor -### func \(\*Client\) [GetAuditExport]() +### func \(\*Client\) [GetAuditExport]() ```go func (c *Client) GetAuditExport(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1079,7 +1069,7 @@ func (c *Client) GetAuditExport(ctx context.Context, reqEditors ...RequestEditor -### func \(\*Client\) [GetAuditLogByID]() +### func \(\*Client\) [GetAuditLogByID]() ```go func (c *Client) GetAuditLogByID(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1088,7 +1078,7 @@ func (c *Client) GetAuditLogByID(ctx context.Context, id openapi_types.UUID, req -### func \(\*Client\) [GetAuditLogs]() +### func \(\*Client\) [GetAuditLogs]() ```go func (c *Client) GetAuditLogs(ctx context.Context, params *GetAuditLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1097,7 +1087,7 @@ func (c *Client) GetAuditLogs(ctx context.Context, params *GetAuditLogsParams, r -### func \(\*Client\) [GetFileByName]() +### func \(\*Client\) [GetFileByName]() ```go func (c *Client) GetFileByName(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1106,7 +1096,7 @@ func (c *Client) GetFileByName(ctx context.Context, name FileName, reqEditors .. -### func \(\*Client\) [GetFiles]() +### func \(\*Client\) [GetFiles]() ```go func (c *Client) GetFiles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1115,7 +1105,7 @@ func (c *Client) GetFiles(ctx context.Context, reqEditors ...RequestEditorFn) (* -### func \(\*Client\) [GetHealth]() +### func \(\*Client\) [GetHealth]() ```go func (c *Client) GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1124,7 +1114,7 @@ func (c *Client) GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) ( -### func \(\*Client\) [GetHealthReady]() +### func \(\*Client\) [GetHealthReady]() ```go func (c *Client) GetHealthReady(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1133,7 +1123,7 @@ func (c *Client) GetHealthReady(ctx context.Context, reqEditors ...RequestEditor -### func \(\*Client\) [GetHealthStatus]() +### func \(\*Client\) [GetHealthStatus]() ```go func (c *Client) GetHealthStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1142,7 +1132,7 @@ func (c *Client) GetHealthStatus(ctx context.Context, reqEditors ...RequestEdito -### func \(\*Client\) [GetJob]() +### func \(\*Client\) [GetJob]() ```go func (c *Client) GetJob(ctx context.Context, params *GetJobParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1151,7 +1141,7 @@ func (c *Client) GetJob(ctx context.Context, params *GetJobParams, reqEditors .. -### func \(\*Client\) [GetJobByID]() +### func \(\*Client\) [GetJobByID]() ```go func (c *Client) GetJobByID(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1160,7 +1150,7 @@ func (c *Client) GetJobByID(ctx context.Context, id openapi_types.UUID, reqEdito -### func \(\*Client\) [GetJobStatus]() +### func \(\*Client\) [GetJobStatus]() ```go func (c *Client) GetJobStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1169,7 +1159,7 @@ func (c *Client) GetJobStatus(ctx context.Context, reqEditors ...RequestEditorFn -### func \(\*Client\) [GetNodeDisk]() +### func \(\*Client\) [GetNodeDisk]() ```go func (c *Client) GetNodeDisk(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1178,7 +1168,7 @@ func (c *Client) GetNodeDisk(ctx context.Context, hostname Hostname, reqEditors -### func \(\*Client\) [GetNodeHostname]() +### func \(\*Client\) [GetNodeHostname]() ```go func (c *Client) GetNodeHostname(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1187,7 +1177,7 @@ func (c *Client) GetNodeHostname(ctx context.Context, hostname Hostname, reqEdit -### func \(\*Client\) [GetNodeLoad]() +### func \(\*Client\) [GetNodeLoad]() ```go func (c *Client) GetNodeLoad(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1196,7 +1186,7 @@ func (c *Client) GetNodeLoad(ctx context.Context, hostname Hostname, reqEditors -### func \(\*Client\) [GetNodeMemory]() +### func \(\*Client\) [GetNodeMemory]() ```go func (c *Client) GetNodeMemory(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1205,7 +1195,7 @@ func (c *Client) GetNodeMemory(ctx context.Context, hostname Hostname, reqEditor -### func \(\*Client\) [GetNodeNetworkDNSByInterface]() +### func \(\*Client\) [GetNodeNetworkDNSByInterface]() ```go func (c *Client) GetNodeNetworkDNSByInterface(ctx context.Context, hostname Hostname, interfaceName string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1214,7 +1204,7 @@ func (c *Client) GetNodeNetworkDNSByInterface(ctx context.Context, hostname Host -### func \(\*Client\) [GetNodeOS]() +### func \(\*Client\) [GetNodeOS]() ```go func (c *Client) GetNodeOS(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1223,7 +1213,7 @@ func (c *Client) GetNodeOS(ctx context.Context, hostname Hostname, reqEditors .. -### func \(\*Client\) [GetNodeStatus]() +### func \(\*Client\) [GetNodeStatus]() ```go func (c *Client) GetNodeStatus(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1232,7 +1222,7 @@ func (c *Client) GetNodeStatus(ctx context.Context, hostname Hostname, reqEditor -### func \(\*Client\) [GetNodeUptime]() +### func \(\*Client\) [GetNodeUptime]() ```go func (c *Client) GetNodeUptime(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1241,7 +1231,7 @@ func (c *Client) GetNodeUptime(ctx context.Context, hostname Hostname, reqEditor -### func \(\*Client\) [GetVersion]() +### func \(\*Client\) [GetVersion]() ```go func (c *Client) GetVersion(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1249,26 +1239,17 @@ func (c *Client) GetVersion(ctx context.Context, reqEditors ...RequestEditorFn) - -### func \(\*Client\) [PostFile]() - -```go -func (c *Client) PostFile(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) -``` - - - -### func \(\*Client\) [PostFileWithBody]() +### func \(\*Client\) [PostFileWithBody]() ```go -func (c *Client) PostFileWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) +func (c *Client) PostFileWithBody(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) ``` -### func \(\*Client\) [PostJob]() +### func \(\*Client\) [PostJob]() ```go func (c *Client) PostJob(ctx context.Context, body PostJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1277,7 +1258,7 @@ func (c *Client) PostJob(ctx context.Context, body PostJobJSONRequestBody, reqEd -### func \(\*Client\) [PostJobWithBody]() +### func \(\*Client\) [PostJobWithBody]() ```go func (c *Client) PostJobWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1286,7 +1267,7 @@ func (c *Client) PostJobWithBody(ctx context.Context, contentType string, body i -### func \(\*Client\) [PostNodeCommandExec]() +### func \(\*Client\) [PostNodeCommandExec]() ```go func (c *Client) PostNodeCommandExec(ctx context.Context, hostname Hostname, body PostNodeCommandExecJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1295,7 +1276,7 @@ func (c *Client) PostNodeCommandExec(ctx context.Context, hostname Hostname, bod -### func \(\*Client\) [PostNodeCommandExecWithBody]() +### func \(\*Client\) [PostNodeCommandExecWithBody]() ```go func (c *Client) PostNodeCommandExecWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1304,7 +1285,7 @@ func (c *Client) PostNodeCommandExecWithBody(ctx context.Context, hostname Hostn -### func \(\*Client\) [PostNodeCommandShell]() +### func \(\*Client\) [PostNodeCommandShell]() ```go func (c *Client) PostNodeCommandShell(ctx context.Context, hostname Hostname, body PostNodeCommandShellJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1313,7 +1294,7 @@ func (c *Client) PostNodeCommandShell(ctx context.Context, hostname Hostname, bo -### func \(\*Client\) [PostNodeCommandShellWithBody]() +### func \(\*Client\) [PostNodeCommandShellWithBody]() ```go func (c *Client) PostNodeCommandShellWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1322,7 +1303,7 @@ func (c *Client) PostNodeCommandShellWithBody(ctx context.Context, hostname Host -### func \(\*Client\) [PostNodeFileDeploy]() +### func \(\*Client\) [PostNodeFileDeploy]() ```go func (c *Client) PostNodeFileDeploy(ctx context.Context, hostname Hostname, body PostNodeFileDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1331,7 +1312,7 @@ func (c *Client) PostNodeFileDeploy(ctx context.Context, hostname Hostname, body -### func \(\*Client\) [PostNodeFileDeployWithBody]() +### func \(\*Client\) [PostNodeFileDeployWithBody]() ```go func (c *Client) PostNodeFileDeployWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1340,7 +1321,7 @@ func (c *Client) PostNodeFileDeployWithBody(ctx context.Context, hostname Hostna -### func \(\*Client\) [PostNodeFileStatus]() +### func \(\*Client\) [PostNodeFileStatus]() ```go func (c *Client) PostNodeFileStatus(ctx context.Context, hostname Hostname, body PostNodeFileStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1349,7 +1330,7 @@ func (c *Client) PostNodeFileStatus(ctx context.Context, hostname Hostname, body -### func \(\*Client\) [PostNodeFileStatusWithBody]() +### func \(\*Client\) [PostNodeFileStatusWithBody]() ```go func (c *Client) PostNodeFileStatusWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1358,7 +1339,7 @@ func (c *Client) PostNodeFileStatusWithBody(ctx context.Context, hostname Hostna -### func \(\*Client\) [PostNodeNetworkPing]() +### func \(\*Client\) [PostNodeNetworkPing]() ```go func (c *Client) PostNodeNetworkPing(ctx context.Context, hostname Hostname, body PostNodeNetworkPingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1367,7 +1348,7 @@ func (c *Client) PostNodeNetworkPing(ctx context.Context, hostname Hostname, bod -### func \(\*Client\) [PostNodeNetworkPingWithBody]() +### func \(\*Client\) [PostNodeNetworkPingWithBody]() ```go func (c *Client) PostNodeNetworkPingWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1376,7 +1357,7 @@ func (c *Client) PostNodeNetworkPingWithBody(ctx context.Context, hostname Hostn -### func \(\*Client\) [PutNodeNetworkDNS]() +### func \(\*Client\) [PutNodeNetworkDNS]() ```go func (c *Client) PutNodeNetworkDNS(ctx context.Context, hostname Hostname, body PutNodeNetworkDNSJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1385,7 +1366,7 @@ func (c *Client) PutNodeNetworkDNS(ctx context.Context, hostname Hostname, body -### func \(\*Client\) [PutNodeNetworkDNSWithBody]() +### func \(\*Client\) [PutNodeNetworkDNSWithBody]() ```go func (c *Client) PutNodeNetworkDNSWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1394,7 +1375,7 @@ func (c *Client) PutNodeNetworkDNSWithBody(ctx context.Context, hostname Hostnam -### func \(\*Client\) [RetryJobByID]() +### func \(\*Client\) [RetryJobByID]() ```go func (c *Client) RetryJobByID(ctx context.Context, id openapi_types.UUID, body RetryJobByIDJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1403,7 +1384,7 @@ func (c *Client) RetryJobByID(ctx context.Context, id openapi_types.UUID, body R -### func \(\*Client\) [RetryJobByIDWithBody]() +### func \(\*Client\) [RetryJobByIDWithBody]() ```go func (c *Client) RetryJobByIDWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1412,7 +1393,7 @@ func (c *Client) RetryJobByIDWithBody(ctx context.Context, id openapi_types.UUID -### func \(\*Client\) [UndrainAgent]() +### func \(\*Client\) [UndrainAgent]() ```go func (c *Client) UndrainAgent(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1421,7 +1402,7 @@ func (c *Client) UndrainAgent(ctx context.Context, hostname string, reqEditors . -## type [ClientInterface]() +## type [ClientInterface]() The interface specification for the client above. @@ -1452,9 +1433,7 @@ type ClientInterface interface { GetFiles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // PostFileWithBody request with any body - PostFileWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - PostFile(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostFileWithBody(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteFileByName request DeleteFileByName(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1553,7 +1532,7 @@ type ClientInterface interface { ``` -## type [ClientOption]() +## type [ClientOption]() ClientOption allows setting custom parameters during construction @@ -1562,7 +1541,7 @@ type ClientOption func(*Client) error ``` -### func [WithBaseURL]() +### func [WithBaseURL]() ```go func WithBaseURL(baseURL string) ClientOption @@ -1571,7 +1550,7 @@ func WithBaseURL(baseURL string) ClientOption WithBaseURL overrides the baseURL. -### func [WithHTTPClient]() +### func [WithHTTPClient]() ```go func WithHTTPClient(doer HttpRequestDoer) ClientOption @@ -1580,7 +1559,7 @@ func WithHTTPClient(doer HttpRequestDoer) ClientOption WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests. -### func [WithRequestEditorFn]() +### func [WithRequestEditorFn]() ```go func WithRequestEditorFn(fn RequestEditorFn) ClientOption @@ -1589,7 +1568,7 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request. -## type [ClientWithResponses]() +## type [ClientWithResponses]() ClientWithResponses builds on ClientInterface to offer response payloads @@ -1600,7 +1579,7 @@ type ClientWithResponses struct { ``` -### func [NewClientWithResponses]() +### func [NewClientWithResponses]() ```go func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) @@ -1609,7 +1588,7 @@ func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithRes NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling -### func \(\*ClientWithResponses\) [DeleteFileByNameWithResponse]() +### func \(\*ClientWithResponses\) [DeleteFileByNameWithResponse]() ```go func (c *ClientWithResponses) DeleteFileByNameWithResponse(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*DeleteFileByNameResponse, error) @@ -1618,7 +1597,7 @@ func (c *ClientWithResponses) DeleteFileByNameWithResponse(ctx context.Context, DeleteFileByNameWithResponse request returning \*DeleteFileByNameResponse -### func \(\*ClientWithResponses\) [DeleteJobByIDWithResponse]() +### func \(\*ClientWithResponses\) [DeleteJobByIDWithResponse]() ```go func (c *ClientWithResponses) DeleteJobByIDWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*DeleteJobByIDResponse, error) @@ -1627,7 +1606,7 @@ func (c *ClientWithResponses) DeleteJobByIDWithResponse(ctx context.Context, id DeleteJobByIDWithResponse request returning \*DeleteJobByIDResponse -### func \(\*ClientWithResponses\) [DrainAgentWithResponse]() +### func \(\*ClientWithResponses\) [DrainAgentWithResponse]() ```go func (c *ClientWithResponses) DrainAgentWithResponse(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*DrainAgentResponse, error) @@ -1636,7 +1615,7 @@ func (c *ClientWithResponses) DrainAgentWithResponse(ctx context.Context, hostna DrainAgentWithResponse request returning \*DrainAgentResponse -### func \(\*ClientWithResponses\) [GetAgentDetailsWithResponse]() +### func \(\*ClientWithResponses\) [GetAgentDetailsWithResponse]() ```go func (c *ClientWithResponses) GetAgentDetailsWithResponse(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*GetAgentDetailsResponse, error) @@ -1645,7 +1624,7 @@ func (c *ClientWithResponses) GetAgentDetailsWithResponse(ctx context.Context, h GetAgentDetailsWithResponse request returning \*GetAgentDetailsResponse -### func \(\*ClientWithResponses\) [GetAgentWithResponse]() +### func \(\*ClientWithResponses\) [GetAgentWithResponse]() ```go func (c *ClientWithResponses) GetAgentWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetAgentResponse, error) @@ -1654,7 +1633,7 @@ func (c *ClientWithResponses) GetAgentWithResponse(ctx context.Context, reqEdito GetAgentWithResponse request returning \*GetAgentResponse -### func \(\*ClientWithResponses\) [GetAuditExportWithResponse]() +### func \(\*ClientWithResponses\) [GetAuditExportWithResponse]() ```go func (c *ClientWithResponses) GetAuditExportWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetAuditExportResponse, error) @@ -1663,7 +1642,7 @@ func (c *ClientWithResponses) GetAuditExportWithResponse(ctx context.Context, re GetAuditExportWithResponse request returning \*GetAuditExportResponse -### func \(\*ClientWithResponses\) [GetAuditLogByIDWithResponse]() +### func \(\*ClientWithResponses\) [GetAuditLogByIDWithResponse]() ```go func (c *ClientWithResponses) GetAuditLogByIDWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetAuditLogByIDResponse, error) @@ -1672,7 +1651,7 @@ func (c *ClientWithResponses) GetAuditLogByIDWithResponse(ctx context.Context, i GetAuditLogByIDWithResponse request returning \*GetAuditLogByIDResponse -### func \(\*ClientWithResponses\) [GetAuditLogsWithResponse]() +### func \(\*ClientWithResponses\) [GetAuditLogsWithResponse]() ```go func (c *ClientWithResponses) GetAuditLogsWithResponse(ctx context.Context, params *GetAuditLogsParams, reqEditors ...RequestEditorFn) (*GetAuditLogsResponse, error) @@ -1681,7 +1660,7 @@ func (c *ClientWithResponses) GetAuditLogsWithResponse(ctx context.Context, para GetAuditLogsWithResponse request returning \*GetAuditLogsResponse -### func \(\*ClientWithResponses\) [GetFileByNameWithResponse]() +### func \(\*ClientWithResponses\) [GetFileByNameWithResponse]() ```go func (c *ClientWithResponses) GetFileByNameWithResponse(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*GetFileByNameResponse, error) @@ -1690,7 +1669,7 @@ func (c *ClientWithResponses) GetFileByNameWithResponse(ctx context.Context, nam GetFileByNameWithResponse request returning \*GetFileByNameResponse -### func \(\*ClientWithResponses\) [GetFilesWithResponse]() +### func \(\*ClientWithResponses\) [GetFilesWithResponse]() ```go func (c *ClientWithResponses) GetFilesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFilesResponse, error) @@ -1699,7 +1678,7 @@ func (c *ClientWithResponses) GetFilesWithResponse(ctx context.Context, reqEdito GetFilesWithResponse request returning \*GetFilesResponse -### func \(\*ClientWithResponses\) [GetHealthReadyWithResponse]() +### func \(\*ClientWithResponses\) [GetHealthReadyWithResponse]() ```go func (c *ClientWithResponses) GetHealthReadyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthReadyResponse, error) @@ -1708,7 +1687,7 @@ func (c *ClientWithResponses) GetHealthReadyWithResponse(ctx context.Context, re GetHealthReadyWithResponse request returning \*GetHealthReadyResponse -### func \(\*ClientWithResponses\) [GetHealthStatusWithResponse]() +### func \(\*ClientWithResponses\) [GetHealthStatusWithResponse]() ```go func (c *ClientWithResponses) GetHealthStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthStatusResponse, error) @@ -1717,7 +1696,7 @@ func (c *ClientWithResponses) GetHealthStatusWithResponse(ctx context.Context, r GetHealthStatusWithResponse request returning \*GetHealthStatusResponse -### func \(\*ClientWithResponses\) [GetHealthWithResponse]() +### func \(\*ClientWithResponses\) [GetHealthWithResponse]() ```go func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error) @@ -1726,7 +1705,7 @@ func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, reqEdit GetHealthWithResponse request returning \*GetHealthResponse -### func \(\*ClientWithResponses\) [GetJobByIDWithResponse]() +### func \(\*ClientWithResponses\) [GetJobByIDWithResponse]() ```go func (c *ClientWithResponses) GetJobByIDWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobByIDResponse, error) @@ -1735,7 +1714,7 @@ func (c *ClientWithResponses) GetJobByIDWithResponse(ctx context.Context, id ope GetJobByIDWithResponse request returning \*GetJobByIDResponse -### func \(\*ClientWithResponses\) [GetJobStatusWithResponse]() +### func \(\*ClientWithResponses\) [GetJobStatusWithResponse]() ```go func (c *ClientWithResponses) GetJobStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetJobStatusResponse, error) @@ -1744,7 +1723,7 @@ func (c *ClientWithResponses) GetJobStatusWithResponse(ctx context.Context, reqE GetJobStatusWithResponse request returning \*GetJobStatusResponse -### func \(\*ClientWithResponses\) [GetJobWithResponse]() +### func \(\*ClientWithResponses\) [GetJobWithResponse]() ```go func (c *ClientWithResponses) GetJobWithResponse(ctx context.Context, params *GetJobParams, reqEditors ...RequestEditorFn) (*GetJobResponse, error) @@ -1753,7 +1732,7 @@ func (c *ClientWithResponses) GetJobWithResponse(ctx context.Context, params *Ge GetJobWithResponse request returning \*GetJobResponse -### func \(\*ClientWithResponses\) [GetNodeDiskWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeDiskWithResponse]() ```go func (c *ClientWithResponses) GetNodeDiskWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeDiskResponse, error) @@ -1762,7 +1741,7 @@ func (c *ClientWithResponses) GetNodeDiskWithResponse(ctx context.Context, hostn GetNodeDiskWithResponse request returning \*GetNodeDiskResponse -### func \(\*ClientWithResponses\) [GetNodeHostnameWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeHostnameWithResponse]() ```go func (c *ClientWithResponses) GetNodeHostnameWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeHostnameResponse, error) @@ -1771,7 +1750,7 @@ func (c *ClientWithResponses) GetNodeHostnameWithResponse(ctx context.Context, h GetNodeHostnameWithResponse request returning \*GetNodeHostnameResponse -### func \(\*ClientWithResponses\) [GetNodeLoadWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeLoadWithResponse]() ```go func (c *ClientWithResponses) GetNodeLoadWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeLoadResponse, error) @@ -1780,7 +1759,7 @@ func (c *ClientWithResponses) GetNodeLoadWithResponse(ctx context.Context, hostn GetNodeLoadWithResponse request returning \*GetNodeLoadResponse -### func \(\*ClientWithResponses\) [GetNodeMemoryWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeMemoryWithResponse]() ```go func (c *ClientWithResponses) GetNodeMemoryWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeMemoryResponse, error) @@ -1789,7 +1768,7 @@ func (c *ClientWithResponses) GetNodeMemoryWithResponse(ctx context.Context, hos GetNodeMemoryWithResponse request returning \*GetNodeMemoryResponse -### func \(\*ClientWithResponses\) [GetNodeNetworkDNSByInterfaceWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeNetworkDNSByInterfaceWithResponse]() ```go func (c *ClientWithResponses) GetNodeNetworkDNSByInterfaceWithResponse(ctx context.Context, hostname Hostname, interfaceName string, reqEditors ...RequestEditorFn) (*GetNodeNetworkDNSByInterfaceResponse, error) @@ -1798,7 +1777,7 @@ func (c *ClientWithResponses) GetNodeNetworkDNSByInterfaceWithResponse(ctx conte GetNodeNetworkDNSByInterfaceWithResponse request returning \*GetNodeNetworkDNSByInterfaceResponse -### func \(\*ClientWithResponses\) [GetNodeOSWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeOSWithResponse]() ```go func (c *ClientWithResponses) GetNodeOSWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeOSResponse, error) @@ -1807,7 +1786,7 @@ func (c *ClientWithResponses) GetNodeOSWithResponse(ctx context.Context, hostnam GetNodeOSWithResponse request returning \*GetNodeOSResponse -### func \(\*ClientWithResponses\) [GetNodeStatusWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeStatusWithResponse]() ```go func (c *ClientWithResponses) GetNodeStatusWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeStatusResponse, error) @@ -1816,7 +1795,7 @@ func (c *ClientWithResponses) GetNodeStatusWithResponse(ctx context.Context, hos GetNodeStatusWithResponse request returning \*GetNodeStatusResponse -### func \(\*ClientWithResponses\) [GetNodeUptimeWithResponse]() +### func \(\*ClientWithResponses\) [GetNodeUptimeWithResponse]() ```go func (c *ClientWithResponses) GetNodeUptimeWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeUptimeResponse, error) @@ -1825,7 +1804,7 @@ func (c *ClientWithResponses) GetNodeUptimeWithResponse(ctx context.Context, hos GetNodeUptimeWithResponse request returning \*GetNodeUptimeResponse -### func \(\*ClientWithResponses\) [GetVersionWithResponse]() +### func \(\*ClientWithResponses\) [GetVersionWithResponse]() ```go func (c *ClientWithResponses) GetVersionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetVersionResponse, error) @@ -1834,25 +1813,16 @@ func (c *ClientWithResponses) GetVersionWithResponse(ctx context.Context, reqEdi GetVersionWithResponse request returning \*GetVersionResponse -### func \(\*ClientWithResponses\) [PostFileWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostFileWithBodyWithResponse]() ```go -func (c *ClientWithResponses) PostFileWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) +func (c *ClientWithResponses) PostFileWithBodyWithResponse(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) ``` PostFileWithBodyWithResponse request with arbitrary body returning \*PostFileResponse - -### func \(\*ClientWithResponses\) [PostFileWithResponse]() - -```go -func (c *ClientWithResponses) PostFileWithResponse(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileResponse, error) -``` - - - -### func \(\*ClientWithResponses\) [PostJobWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostJobWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostJobWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostJobResponse, error) @@ -1861,7 +1831,7 @@ func (c *ClientWithResponses) PostJobWithBodyWithResponse(ctx context.Context, c PostJobWithBodyWithResponse request with arbitrary body returning \*PostJobResponse -### func \(\*ClientWithResponses\) [PostJobWithResponse]() +### func \(\*ClientWithResponses\) [PostJobWithResponse]() ```go func (c *ClientWithResponses) PostJobWithResponse(ctx context.Context, body PostJobJSONRequestBody, reqEditors ...RequestEditorFn) (*PostJobResponse, error) @@ -1870,7 +1840,7 @@ func (c *ClientWithResponses) PostJobWithResponse(ctx context.Context, body Post -### func \(\*ClientWithResponses\) [PostNodeCommandExecWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeCommandExecWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostNodeCommandExecWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeCommandExecResponse, error) @@ -1879,7 +1849,7 @@ func (c *ClientWithResponses) PostNodeCommandExecWithBodyWithResponse(ctx contex PostNodeCommandExecWithBodyWithResponse request with arbitrary body returning \*PostNodeCommandExecResponse -### func \(\*ClientWithResponses\) [PostNodeCommandExecWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeCommandExecWithResponse]() ```go func (c *ClientWithResponses) PostNodeCommandExecWithResponse(ctx context.Context, hostname Hostname, body PostNodeCommandExecJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeCommandExecResponse, error) @@ -1888,7 +1858,7 @@ func (c *ClientWithResponses) PostNodeCommandExecWithResponse(ctx context.Contex -### func \(\*ClientWithResponses\) [PostNodeCommandShellWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeCommandShellWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostNodeCommandShellWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeCommandShellResponse, error) @@ -1897,7 +1867,7 @@ func (c *ClientWithResponses) PostNodeCommandShellWithBodyWithResponse(ctx conte PostNodeCommandShellWithBodyWithResponse request with arbitrary body returning \*PostNodeCommandShellResponse -### func \(\*ClientWithResponses\) [PostNodeCommandShellWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeCommandShellWithResponse]() ```go func (c *ClientWithResponses) PostNodeCommandShellWithResponse(ctx context.Context, hostname Hostname, body PostNodeCommandShellJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeCommandShellResponse, error) @@ -1906,7 +1876,7 @@ func (c *ClientWithResponses) PostNodeCommandShellWithResponse(ctx context.Conte -### func \(\*ClientWithResponses\) [PostNodeFileDeployWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeFileDeployWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostNodeFileDeployWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeFileDeployResponse, error) @@ -1915,7 +1885,7 @@ func (c *ClientWithResponses) PostNodeFileDeployWithBodyWithResponse(ctx context PostNodeFileDeployWithBodyWithResponse request with arbitrary body returning \*PostNodeFileDeployResponse -### func \(\*ClientWithResponses\) [PostNodeFileDeployWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeFileDeployWithResponse]() ```go func (c *ClientWithResponses) PostNodeFileDeployWithResponse(ctx context.Context, hostname Hostname, body PostNodeFileDeployJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeFileDeployResponse, error) @@ -1924,7 +1894,7 @@ func (c *ClientWithResponses) PostNodeFileDeployWithResponse(ctx context.Context -### func \(\*ClientWithResponses\) [PostNodeFileStatusWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeFileStatusWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostNodeFileStatusWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeFileStatusResponse, error) @@ -1933,7 +1903,7 @@ func (c *ClientWithResponses) PostNodeFileStatusWithBodyWithResponse(ctx context PostNodeFileStatusWithBodyWithResponse request with arbitrary body returning \*PostNodeFileStatusResponse -### func \(\*ClientWithResponses\) [PostNodeFileStatusWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeFileStatusWithResponse]() ```go func (c *ClientWithResponses) PostNodeFileStatusWithResponse(ctx context.Context, hostname Hostname, body PostNodeFileStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeFileStatusResponse, error) @@ -1942,7 +1912,7 @@ func (c *ClientWithResponses) PostNodeFileStatusWithResponse(ctx context.Context -### func \(\*ClientWithResponses\) [PostNodeNetworkPingWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeNetworkPingWithBodyWithResponse]() ```go func (c *ClientWithResponses) PostNodeNetworkPingWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeNetworkPingResponse, error) @@ -1951,7 +1921,7 @@ func (c *ClientWithResponses) PostNodeNetworkPingWithBodyWithResponse(ctx contex PostNodeNetworkPingWithBodyWithResponse request with arbitrary body returning \*PostNodeNetworkPingResponse -### func \(\*ClientWithResponses\) [PostNodeNetworkPingWithResponse]() +### func \(\*ClientWithResponses\) [PostNodeNetworkPingWithResponse]() ```go func (c *ClientWithResponses) PostNodeNetworkPingWithResponse(ctx context.Context, hostname Hostname, body PostNodeNetworkPingJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeNetworkPingResponse, error) @@ -1960,7 +1930,7 @@ func (c *ClientWithResponses) PostNodeNetworkPingWithResponse(ctx context.Contex -### func \(\*ClientWithResponses\) [PutNodeNetworkDNSWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [PutNodeNetworkDNSWithBodyWithResponse]() ```go func (c *ClientWithResponses) PutNodeNetworkDNSWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutNodeNetworkDNSResponse, error) @@ -1969,7 +1939,7 @@ func (c *ClientWithResponses) PutNodeNetworkDNSWithBodyWithResponse(ctx context. PutNodeNetworkDNSWithBodyWithResponse request with arbitrary body returning \*PutNodeNetworkDNSResponse -### func \(\*ClientWithResponses\) [PutNodeNetworkDNSWithResponse]() +### func \(\*ClientWithResponses\) [PutNodeNetworkDNSWithResponse]() ```go func (c *ClientWithResponses) PutNodeNetworkDNSWithResponse(ctx context.Context, hostname Hostname, body PutNodeNetworkDNSJSONRequestBody, reqEditors ...RequestEditorFn) (*PutNodeNetworkDNSResponse, error) @@ -1978,7 +1948,7 @@ func (c *ClientWithResponses) PutNodeNetworkDNSWithResponse(ctx context.Context, -### func \(\*ClientWithResponses\) [RetryJobByIDWithBodyWithResponse]() +### func \(\*ClientWithResponses\) [RetryJobByIDWithBodyWithResponse]() ```go func (c *ClientWithResponses) RetryJobByIDWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RetryJobByIDResponse, error) @@ -1987,7 +1957,7 @@ func (c *ClientWithResponses) RetryJobByIDWithBodyWithResponse(ctx context.Conte RetryJobByIDWithBodyWithResponse request with arbitrary body returning \*RetryJobByIDResponse -### func \(\*ClientWithResponses\) [RetryJobByIDWithResponse]() +### func \(\*ClientWithResponses\) [RetryJobByIDWithResponse]() ```go func (c *ClientWithResponses) RetryJobByIDWithResponse(ctx context.Context, id openapi_types.UUID, body RetryJobByIDJSONRequestBody, reqEditors ...RequestEditorFn) (*RetryJobByIDResponse, error) @@ -1996,7 +1966,7 @@ func (c *ClientWithResponses) RetryJobByIDWithResponse(ctx context.Context, id o -### func \(\*ClientWithResponses\) [UndrainAgentWithResponse]() +### func \(\*ClientWithResponses\) [UndrainAgentWithResponse]() ```go func (c *ClientWithResponses) UndrainAgentWithResponse(ctx context.Context, hostname string, reqEditors ...RequestEditorFn) (*UndrainAgentResponse, error) @@ -2005,7 +1975,7 @@ func (c *ClientWithResponses) UndrainAgentWithResponse(ctx context.Context, host UndrainAgentWithResponse request returning \*UndrainAgentResponse -## type [ClientWithResponsesInterface]() +## type [ClientWithResponsesInterface]() ClientWithResponsesInterface is the interface specification for the client with responses above. @@ -2036,9 +2006,7 @@ type ClientWithResponsesInterface interface { GetFilesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFilesResponse, error) // PostFileWithBodyWithResponse request with any body - PostFileWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) - - PostFileWithResponse(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileResponse, error) + PostFileWithBodyWithResponse(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) // DeleteFileByNameWithResponse request DeleteFileByNameWithResponse(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*DeleteFileByNameResponse, error) @@ -2137,7 +2105,7 @@ type ClientWithResponsesInterface interface { ``` -## type [CommandExecRequest]() +## type [CommandExecRequest]() CommandExecRequest defines model for CommandExecRequest. @@ -2158,7 +2126,7 @@ type CommandExecRequest struct { ``` -## type [CommandResultCollectionResponse]() +## type [CommandResultCollectionResponse]() CommandResultCollectionResponse defines model for CommandResultCollectionResponse. @@ -2171,7 +2139,7 @@ type CommandResultCollectionResponse struct { ``` -## type [CommandResultItem]() +## type [CommandResultItem]() CommandResultItem defines model for CommandResultItem. @@ -2201,7 +2169,7 @@ type CommandResultItem struct { ``` -## type [CommandShellRequest]() +## type [CommandShellRequest]() CommandShellRequest defines model for CommandShellRequest. @@ -2219,7 +2187,7 @@ type CommandShellRequest struct { ``` -## type [ComponentHealth]() +## type [ComponentHealth]() ComponentHealth defines model for ComponentHealth. @@ -2234,7 +2202,7 @@ type ComponentHealth struct { ``` -## type [ConsumerDetail]() +## type [ConsumerDetail]() ConsumerDetail defines model for ConsumerDetail. @@ -2255,7 +2223,7 @@ type ConsumerDetail struct { ``` -## type [ConsumerStats]() +## type [ConsumerStats]() ConsumerStats defines model for ConsumerStats. @@ -2270,7 +2238,7 @@ type ConsumerStats struct { ``` -## type [CreateJobRequest]() +## type [CreateJobRequest]() CreateJobRequest defines model for CreateJobRequest. @@ -2285,7 +2253,7 @@ type CreateJobRequest struct { ``` -## type [CreateJobResponse]() +## type [CreateJobResponse]() CreateJobResponse defines model for CreateJobResponse. @@ -2306,7 +2274,7 @@ type CreateJobResponse struct { ``` -## type [DNSConfigCollectionResponse]() +## type [DNSConfigCollectionResponse]() DNSConfigCollectionResponse defines model for DNSConfigCollectionResponse. @@ -2319,7 +2287,7 @@ type DNSConfigCollectionResponse struct { ``` -## type [DNSConfigResponse]() +## type [DNSConfigResponse]() DNSConfigResponse defines model for DNSConfigResponse. @@ -2340,7 +2308,7 @@ type DNSConfigResponse struct { ``` -## type [DNSConfigUpdateRequest]() +## type [DNSConfigUpdateRequest]() DNSConfigUpdateRequest defines model for DNSConfigUpdateRequest. @@ -2358,7 +2326,7 @@ type DNSConfigUpdateRequest struct { ``` -## type [DNSUpdateCollectionResponse]() +## type [DNSUpdateCollectionResponse]() DNSUpdateCollectionResponse defines model for DNSUpdateCollectionResponse. @@ -2371,7 +2339,7 @@ type DNSUpdateCollectionResponse struct { ``` -## type [DNSUpdateResultItem]() +## type [DNSUpdateResultItem]() DNSUpdateResultItem defines model for DNSUpdateResultItem. @@ -2386,7 +2354,7 @@ type DNSUpdateResultItem struct { ``` -## type [DNSUpdateResultItemStatus]() +## type [DNSUpdateResultItemStatus]() DNSUpdateResultItemStatus defines model for DNSUpdateResultItem.Status. @@ -2404,7 +2372,7 @@ const ( ``` -## type [DeleteFileByNameResponse]() +## type [DeleteFileByNameResponse]() @@ -2422,7 +2390,7 @@ type DeleteFileByNameResponse struct { ``` -### func [ParseDeleteFileByNameResponse]() +### func [ParseDeleteFileByNameResponse]() ```go func ParseDeleteFileByNameResponse(rsp *http.Response) (*DeleteFileByNameResponse, error) @@ -2431,7 +2399,7 @@ func ParseDeleteFileByNameResponse(rsp *http.Response) (*DeleteFileByNameRespons ParseDeleteFileByNameResponse parses an HTTP response from a DeleteFileByNameWithResponse call -### func \(DeleteFileByNameResponse\) [Status]() +### func \(DeleteFileByNameResponse\) [Status]() ```go func (r DeleteFileByNameResponse) Status() string @@ -2440,7 +2408,7 @@ func (r DeleteFileByNameResponse) Status() string Status returns HTTPResponse.Status -### func \(DeleteFileByNameResponse\) [StatusCode]() +### func \(DeleteFileByNameResponse\) [StatusCode]() ```go func (r DeleteFileByNameResponse) StatusCode() int @@ -2449,7 +2417,7 @@ func (r DeleteFileByNameResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [DeleteJobByIDResponse]() +## type [DeleteJobByIDResponse]() @@ -2466,7 +2434,7 @@ type DeleteJobByIDResponse struct { ``` -### func [ParseDeleteJobByIDResponse]() +### func [ParseDeleteJobByIDResponse]() ```go func ParseDeleteJobByIDResponse(rsp *http.Response) (*DeleteJobByIDResponse, error) @@ -2475,7 +2443,7 @@ func ParseDeleteJobByIDResponse(rsp *http.Response) (*DeleteJobByIDResponse, err ParseDeleteJobByIDResponse parses an HTTP response from a DeleteJobByIDWithResponse call -### func \(DeleteJobByIDResponse\) [Status]() +### func \(DeleteJobByIDResponse\) [Status]() ```go func (r DeleteJobByIDResponse) Status() string @@ -2484,7 +2452,7 @@ func (r DeleteJobByIDResponse) Status() string Status returns HTTPResponse.Status -### func \(DeleteJobByIDResponse\) [StatusCode]() +### func \(DeleteJobByIDResponse\) [StatusCode]() ```go func (r DeleteJobByIDResponse) StatusCode() int @@ -2493,7 +2461,7 @@ func (r DeleteJobByIDResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [DiskCollectionResponse]() +## type [DiskCollectionResponse]() DiskCollectionResponse defines model for DiskCollectionResponse. @@ -2506,7 +2474,7 @@ type DiskCollectionResponse struct { ``` -## type [DiskResponse]() +## type [DiskResponse]() DiskResponse Local disk usage information. @@ -2527,7 +2495,7 @@ type DiskResponse struct { ``` -## type [DiskResultItem]() +## type [DiskResultItem]() DiskResultItem defines model for DiskResultItem. @@ -2545,7 +2513,7 @@ type DiskResultItem struct { ``` -## type [DisksResponse]() +## type [DisksResponse]() DisksResponse List of local disk usage information. @@ -2554,7 +2522,7 @@ type DisksResponse = []DiskResponse ``` -## type [DrainAgentResponse]() +## type [DrainAgentResponse]() @@ -2573,7 +2541,7 @@ type DrainAgentResponse struct { ``` -### func [ParseDrainAgentResponse]() +### func [ParseDrainAgentResponse]() ```go func ParseDrainAgentResponse(rsp *http.Response) (*DrainAgentResponse, error) @@ -2582,7 +2550,7 @@ func ParseDrainAgentResponse(rsp *http.Response) (*DrainAgentResponse, error) ParseDrainAgentResponse parses an HTTP response from a DrainAgentWithResponse call -### func \(DrainAgentResponse\) [Status]() +### func \(DrainAgentResponse\) [Status]() ```go func (r DrainAgentResponse) Status() string @@ -2591,7 +2559,7 @@ func (r DrainAgentResponse) Status() string Status returns HTTPResponse.Status -### func \(DrainAgentResponse\) [StatusCode]() +### func \(DrainAgentResponse\) [StatusCode]() ```go func (r DrainAgentResponse) StatusCode() int @@ -2600,7 +2568,7 @@ func (r DrainAgentResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [ErrorResponse]() +## type [ErrorResponse]() ErrorResponse defines model for ErrorResponse. @@ -2618,7 +2586,7 @@ type ErrorResponse struct { ``` -## type [FileDeleteResponse]() +## type [FileDeleteResponse]() FileDeleteResponse defines model for FileDeleteResponse. @@ -2633,7 +2601,7 @@ type FileDeleteResponse struct { ``` -## type [FileDeployRequest]() +## type [FileDeployRequest]() FileDeployRequest defines model for FileDeployRequest. @@ -2663,7 +2631,7 @@ type FileDeployRequest struct { ``` -## type [FileDeployRequestContentType]() +## type [FileDeployRequestContentType]() FileDeployRequestContentType Content type — "raw" or "template". @@ -2671,17 +2639,17 @@ FileDeployRequestContentType Content type — "raw" or "template". type FileDeployRequestContentType string ``` -Defines values for FileDeployRequestContentType. +Defines values for FileDeployRequestContentType. ```go const ( - Raw FileDeployRequestContentType = "raw" - Template FileDeployRequestContentType = "template" + FileDeployRequestContentTypeRaw FileDeployRequestContentType = "raw" + FileDeployRequestContentTypeTemplate FileDeployRequestContentType = "template" ) ``` -## type [FileDeployResponse]() +## type [FileDeployResponse]() FileDeployResponse defines model for FileDeployResponse. @@ -2699,12 +2667,15 @@ type FileDeployResponse struct { ``` -## type [FileInfo]() +## type [FileInfo]() FileInfo defines model for FileInfo. ```go type FileInfo struct { + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the file. Name string `json:"name"` @@ -2717,12 +2688,15 @@ type FileInfo struct { ``` -## type [FileInfoResponse]() +## type [FileInfoResponse]() FileInfoResponse defines model for FileInfoResponse. ```go type FileInfoResponse struct { + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the file. Name string `json:"name"` @@ -2735,7 +2709,7 @@ type FileInfoResponse struct { ``` -## type [FileListResponse]() +## type [FileListResponse]() FileListResponse defines model for FileListResponse. @@ -2750,7 +2724,7 @@ type FileListResponse struct { ``` -## type [FileName]() +## type [FileName]() FileName defines model for FileName. @@ -2759,7 +2733,7 @@ type FileName = string ``` -## type [FileStatusRequest]() +## type [FileStatusRequest]() FileStatusRequest defines model for FileStatusRequest. @@ -2771,7 +2745,7 @@ type FileStatusRequest struct { ``` -## type [FileStatusResponse]() +## type [FileStatusResponse]() FileStatusResponse defines model for FileStatusResponse. @@ -2794,28 +2768,19 @@ type FileStatusResponse struct { } ``` - -## type [FileUploadRequest]() - -FileUploadRequest defines model for FileUploadRequest. - -```go -type FileUploadRequest struct { - // Content Base64-encoded file content. - Content []byte `json:"content" validate:"required"` - - // Name The name of the file. - Name string `json:"name" validate:"required,min=1,max=255"` -} -``` - -## type [FileUploadResponse]() +## type [FileUploadResponse]() FileUploadResponse defines model for FileUploadResponse. ```go type FileUploadResponse struct { + // Changed Whether the file content changed. False when the Object Store already held an object with the same SHA-256 digest. + Changed bool `json:"changed"` + + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the uploaded file. Name string `json:"name"` @@ -2828,7 +2793,7 @@ type FileUploadResponse struct { ``` -## type [GetAgentDetailsResponse]() +## type [GetAgentDetailsResponse]() @@ -2845,7 +2810,7 @@ type GetAgentDetailsResponse struct { ``` -### func [ParseGetAgentDetailsResponse]() +### func [ParseGetAgentDetailsResponse]() ```go func ParseGetAgentDetailsResponse(rsp *http.Response) (*GetAgentDetailsResponse, error) @@ -2854,7 +2819,7 @@ func ParseGetAgentDetailsResponse(rsp *http.Response) (*GetAgentDetailsResponse, ParseGetAgentDetailsResponse parses an HTTP response from a GetAgentDetailsWithResponse call -### func \(GetAgentDetailsResponse\) [Status]() +### func \(GetAgentDetailsResponse\) [Status]() ```go func (r GetAgentDetailsResponse) Status() string @@ -2863,7 +2828,7 @@ func (r GetAgentDetailsResponse) Status() string Status returns HTTPResponse.Status -### func \(GetAgentDetailsResponse\) [StatusCode]() +### func \(GetAgentDetailsResponse\) [StatusCode]() ```go func (r GetAgentDetailsResponse) StatusCode() int @@ -2872,7 +2837,7 @@ func (r GetAgentDetailsResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetAgentResponse]() +## type [GetAgentResponse]() @@ -2888,7 +2853,7 @@ type GetAgentResponse struct { ``` -### func [ParseGetAgentResponse]() +### func [ParseGetAgentResponse]() ```go func ParseGetAgentResponse(rsp *http.Response) (*GetAgentResponse, error) @@ -2897,7 +2862,7 @@ func ParseGetAgentResponse(rsp *http.Response) (*GetAgentResponse, error) ParseGetAgentResponse parses an HTTP response from a GetAgentWithResponse call -### func \(GetAgentResponse\) [Status]() +### func \(GetAgentResponse\) [Status]() ```go func (r GetAgentResponse) Status() string @@ -2906,7 +2871,7 @@ func (r GetAgentResponse) Status() string Status returns HTTPResponse.Status -### func \(GetAgentResponse\) [StatusCode]() +### func \(GetAgentResponse\) [StatusCode]() ```go func (r GetAgentResponse) StatusCode() int @@ -2915,7 +2880,7 @@ func (r GetAgentResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetAuditExportResponse]() +## type [GetAuditExportResponse]() @@ -2931,7 +2896,7 @@ type GetAuditExportResponse struct { ``` -### func [ParseGetAuditExportResponse]() +### func [ParseGetAuditExportResponse]() ```go func ParseGetAuditExportResponse(rsp *http.Response) (*GetAuditExportResponse, error) @@ -2940,7 +2905,7 @@ func ParseGetAuditExportResponse(rsp *http.Response) (*GetAuditExportResponse, e ParseGetAuditExportResponse parses an HTTP response from a GetAuditExportWithResponse call -### func \(GetAuditExportResponse\) [Status]() +### func \(GetAuditExportResponse\) [Status]() ```go func (r GetAuditExportResponse) Status() string @@ -2949,7 +2914,7 @@ func (r GetAuditExportResponse) Status() string Status returns HTTPResponse.Status -### func \(GetAuditExportResponse\) [StatusCode]() +### func \(GetAuditExportResponse\) [StatusCode]() ```go func (r GetAuditExportResponse) StatusCode() int @@ -2958,7 +2923,7 @@ func (r GetAuditExportResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetAuditLogByIDResponse]() +## type [GetAuditLogByIDResponse]() @@ -2975,7 +2940,7 @@ type GetAuditLogByIDResponse struct { ``` -### func [ParseGetAuditLogByIDResponse]() +### func [ParseGetAuditLogByIDResponse]() ```go func ParseGetAuditLogByIDResponse(rsp *http.Response) (*GetAuditLogByIDResponse, error) @@ -2984,7 +2949,7 @@ func ParseGetAuditLogByIDResponse(rsp *http.Response) (*GetAuditLogByIDResponse, ParseGetAuditLogByIDResponse parses an HTTP response from a GetAuditLogByIDWithResponse call -### func \(GetAuditLogByIDResponse\) [Status]() +### func \(GetAuditLogByIDResponse\) [Status]() ```go func (r GetAuditLogByIDResponse) Status() string @@ -2993,7 +2958,7 @@ func (r GetAuditLogByIDResponse) Status() string Status returns HTTPResponse.Status -### func \(GetAuditLogByIDResponse\) [StatusCode]() +### func \(GetAuditLogByIDResponse\) [StatusCode]() ```go func (r GetAuditLogByIDResponse) StatusCode() int @@ -3002,7 +2967,7 @@ func (r GetAuditLogByIDResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetAuditLogsParams]() +## type [GetAuditLogsParams]() GetAuditLogsParams defines parameters for GetAuditLogs. @@ -3017,7 +2982,7 @@ type GetAuditLogsParams struct { ``` -## type [GetAuditLogsResponse]() +## type [GetAuditLogsResponse]() @@ -3034,7 +2999,7 @@ type GetAuditLogsResponse struct { ``` -### func [ParseGetAuditLogsResponse]() +### func [ParseGetAuditLogsResponse]() ```go func ParseGetAuditLogsResponse(rsp *http.Response) (*GetAuditLogsResponse, error) @@ -3043,7 +3008,7 @@ func ParseGetAuditLogsResponse(rsp *http.Response) (*GetAuditLogsResponse, error ParseGetAuditLogsResponse parses an HTTP response from a GetAuditLogsWithResponse call -### func \(GetAuditLogsResponse\) [Status]() +### func \(GetAuditLogsResponse\) [Status]() ```go func (r GetAuditLogsResponse) Status() string @@ -3052,7 +3017,7 @@ func (r GetAuditLogsResponse) Status() string Status returns HTTPResponse.Status -### func \(GetAuditLogsResponse\) [StatusCode]() +### func \(GetAuditLogsResponse\) [StatusCode]() ```go func (r GetAuditLogsResponse) StatusCode() int @@ -3061,7 +3026,7 @@ func (r GetAuditLogsResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetFileByNameResponse]() +## type [GetFileByNameResponse]() @@ -3079,7 +3044,7 @@ type GetFileByNameResponse struct { ``` -### func [ParseGetFileByNameResponse]() +### func [ParseGetFileByNameResponse]() ```go func ParseGetFileByNameResponse(rsp *http.Response) (*GetFileByNameResponse, error) @@ -3088,7 +3053,7 @@ func ParseGetFileByNameResponse(rsp *http.Response) (*GetFileByNameResponse, err ParseGetFileByNameResponse parses an HTTP response from a GetFileByNameWithResponse call -### func \(GetFileByNameResponse\) [Status]() +### func \(GetFileByNameResponse\) [Status]() ```go func (r GetFileByNameResponse) Status() string @@ -3097,7 +3062,7 @@ func (r GetFileByNameResponse) Status() string Status returns HTTPResponse.Status -### func \(GetFileByNameResponse\) [StatusCode]() +### func \(GetFileByNameResponse\) [StatusCode]() ```go func (r GetFileByNameResponse) StatusCode() int @@ -3106,7 +3071,7 @@ func (r GetFileByNameResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetFilesResponse]() +## type [GetFilesResponse]() @@ -3122,7 +3087,7 @@ type GetFilesResponse struct { ``` -### func [ParseGetFilesResponse]() +### func [ParseGetFilesResponse]() ```go func ParseGetFilesResponse(rsp *http.Response) (*GetFilesResponse, error) @@ -3131,7 +3096,7 @@ func ParseGetFilesResponse(rsp *http.Response) (*GetFilesResponse, error) ParseGetFilesResponse parses an HTTP response from a GetFilesWithResponse call -### func \(GetFilesResponse\) [Status]() +### func \(GetFilesResponse\) [Status]() ```go func (r GetFilesResponse) Status() string @@ -3140,7 +3105,7 @@ func (r GetFilesResponse) Status() string Status returns HTTPResponse.Status -### func \(GetFilesResponse\) [StatusCode]() +### func \(GetFilesResponse\) [StatusCode]() ```go func (r GetFilesResponse) StatusCode() int @@ -3149,7 +3114,7 @@ func (r GetFilesResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetHealthReadyResponse]() +## type [GetHealthReadyResponse]() @@ -3163,7 +3128,7 @@ type GetHealthReadyResponse struct { ``` -### func [ParseGetHealthReadyResponse]() +### func [ParseGetHealthReadyResponse]() ```go func ParseGetHealthReadyResponse(rsp *http.Response) (*GetHealthReadyResponse, error) @@ -3172,7 +3137,7 @@ func ParseGetHealthReadyResponse(rsp *http.Response) (*GetHealthReadyResponse, e ParseGetHealthReadyResponse parses an HTTP response from a GetHealthReadyWithResponse call -### func \(GetHealthReadyResponse\) [Status]() +### func \(GetHealthReadyResponse\) [Status]() ```go func (r GetHealthReadyResponse) Status() string @@ -3181,7 +3146,7 @@ func (r GetHealthReadyResponse) Status() string Status returns HTTPResponse.Status -### func \(GetHealthReadyResponse\) [StatusCode]() +### func \(GetHealthReadyResponse\) [StatusCode]() ```go func (r GetHealthReadyResponse) StatusCode() int @@ -3190,7 +3155,7 @@ func (r GetHealthReadyResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetHealthResponse]() +## type [GetHealthResponse]() @@ -3203,7 +3168,7 @@ type GetHealthResponse struct { ``` -### func [ParseGetHealthResponse]() +### func [ParseGetHealthResponse]() ```go func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error) @@ -3212,7 +3177,7 @@ func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error) ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call -### func \(GetHealthResponse\) [Status]() +### func \(GetHealthResponse\) [Status]() ```go func (r GetHealthResponse) Status() string @@ -3221,7 +3186,7 @@ func (r GetHealthResponse) Status() string Status returns HTTPResponse.Status -### func \(GetHealthResponse\) [StatusCode]() +### func \(GetHealthResponse\) [StatusCode]() ```go func (r GetHealthResponse) StatusCode() int @@ -3230,7 +3195,7 @@ func (r GetHealthResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetHealthStatusResponse]() +## type [GetHealthStatusResponse]() @@ -3246,7 +3211,7 @@ type GetHealthStatusResponse struct { ``` -### func [ParseGetHealthStatusResponse]() +### func [ParseGetHealthStatusResponse]() ```go func ParseGetHealthStatusResponse(rsp *http.Response) (*GetHealthStatusResponse, error) @@ -3255,7 +3220,7 @@ func ParseGetHealthStatusResponse(rsp *http.Response) (*GetHealthStatusResponse, ParseGetHealthStatusResponse parses an HTTP response from a GetHealthStatusWithResponse call -### func \(GetHealthStatusResponse\) [Status]() +### func \(GetHealthStatusResponse\) [Status]() ```go func (r GetHealthStatusResponse) Status() string @@ -3264,7 +3229,7 @@ func (r GetHealthStatusResponse) Status() string Status returns HTTPResponse.Status -### func \(GetHealthStatusResponse\) [StatusCode]() +### func \(GetHealthStatusResponse\) [StatusCode]() ```go func (r GetHealthStatusResponse) StatusCode() int @@ -3273,7 +3238,7 @@ func (r GetHealthStatusResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetJobByIDResponse]() +## type [GetJobByIDResponse]() @@ -3291,7 +3256,7 @@ type GetJobByIDResponse struct { ``` -### func [ParseGetJobByIDResponse]() +### func [ParseGetJobByIDResponse]() ```go func ParseGetJobByIDResponse(rsp *http.Response) (*GetJobByIDResponse, error) @@ -3300,7 +3265,7 @@ func ParseGetJobByIDResponse(rsp *http.Response) (*GetJobByIDResponse, error) ParseGetJobByIDResponse parses an HTTP response from a GetJobByIDWithResponse call -### func \(GetJobByIDResponse\) [Status]() +### func \(GetJobByIDResponse\) [Status]() ```go func (r GetJobByIDResponse) Status() string @@ -3309,7 +3274,7 @@ func (r GetJobByIDResponse) Status() string Status returns HTTPResponse.Status -### func \(GetJobByIDResponse\) [StatusCode]() +### func \(GetJobByIDResponse\) [StatusCode]() ```go func (r GetJobByIDResponse) StatusCode() int @@ -3318,7 +3283,7 @@ func (r GetJobByIDResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetJobParams]() +## type [GetJobParams]() GetJobParams defines parameters for GetJob. @@ -3336,7 +3301,7 @@ type GetJobParams struct { ``` -## type [GetJobParamsStatus]() +## type [GetJobParamsStatus]() GetJobParamsStatus defines parameters for GetJob. @@ -3357,7 +3322,7 @@ const ( ``` -## type [GetJobResponse]() +## type [GetJobResponse]() @@ -3374,7 +3339,7 @@ type GetJobResponse struct { ``` -### func [ParseGetJobResponse]() +### func [ParseGetJobResponse]() ```go func ParseGetJobResponse(rsp *http.Response) (*GetJobResponse, error) @@ -3383,7 +3348,7 @@ func ParseGetJobResponse(rsp *http.Response) (*GetJobResponse, error) ParseGetJobResponse parses an HTTP response from a GetJobWithResponse call -### func \(GetJobResponse\) [Status]() +### func \(GetJobResponse\) [Status]() ```go func (r GetJobResponse) Status() string @@ -3392,7 +3357,7 @@ func (r GetJobResponse) Status() string Status returns HTTPResponse.Status -### func \(GetJobResponse\) [StatusCode]() +### func \(GetJobResponse\) [StatusCode]() ```go func (r GetJobResponse) StatusCode() int @@ -3401,7 +3366,7 @@ func (r GetJobResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetJobStatusResponse]() +## type [GetJobStatusResponse]() @@ -3417,7 +3382,7 @@ type GetJobStatusResponse struct { ``` -### func [ParseGetJobStatusResponse]() +### func [ParseGetJobStatusResponse]() ```go func ParseGetJobStatusResponse(rsp *http.Response) (*GetJobStatusResponse, error) @@ -3426,7 +3391,7 @@ func ParseGetJobStatusResponse(rsp *http.Response) (*GetJobStatusResponse, error ParseGetJobStatusResponse parses an HTTP response from a GetJobStatusWithResponse call -### func \(GetJobStatusResponse\) [Status]() +### func \(GetJobStatusResponse\) [Status]() ```go func (r GetJobStatusResponse) Status() string @@ -3435,7 +3400,7 @@ func (r GetJobStatusResponse) Status() string Status returns HTTPResponse.Status -### func \(GetJobStatusResponse\) [StatusCode]() +### func \(GetJobStatusResponse\) [StatusCode]() ```go func (r GetJobStatusResponse) StatusCode() int @@ -3444,7 +3409,7 @@ func (r GetJobStatusResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeDiskResponse]() +## type [GetNodeDiskResponse]() @@ -3461,7 +3426,7 @@ type GetNodeDiskResponse struct { ``` -### func [ParseGetNodeDiskResponse]() +### func [ParseGetNodeDiskResponse]() ```go func ParseGetNodeDiskResponse(rsp *http.Response) (*GetNodeDiskResponse, error) @@ -3470,7 +3435,7 @@ func ParseGetNodeDiskResponse(rsp *http.Response) (*GetNodeDiskResponse, error) ParseGetNodeDiskResponse parses an HTTP response from a GetNodeDiskWithResponse call -### func \(GetNodeDiskResponse\) [Status]() +### func \(GetNodeDiskResponse\) [Status]() ```go func (r GetNodeDiskResponse) Status() string @@ -3479,7 +3444,7 @@ func (r GetNodeDiskResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeDiskResponse\) [StatusCode]() +### func \(GetNodeDiskResponse\) [StatusCode]() ```go func (r GetNodeDiskResponse) StatusCode() int @@ -3488,7 +3453,7 @@ func (r GetNodeDiskResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeHostnameResponse]() +## type [GetNodeHostnameResponse]() @@ -3505,7 +3470,7 @@ type GetNodeHostnameResponse struct { ``` -### func [ParseGetNodeHostnameResponse]() +### func [ParseGetNodeHostnameResponse]() ```go func ParseGetNodeHostnameResponse(rsp *http.Response) (*GetNodeHostnameResponse, error) @@ -3514,7 +3479,7 @@ func ParseGetNodeHostnameResponse(rsp *http.Response) (*GetNodeHostnameResponse, ParseGetNodeHostnameResponse parses an HTTP response from a GetNodeHostnameWithResponse call -### func \(GetNodeHostnameResponse\) [Status]() +### func \(GetNodeHostnameResponse\) [Status]() ```go func (r GetNodeHostnameResponse) Status() string @@ -3523,7 +3488,7 @@ func (r GetNodeHostnameResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeHostnameResponse\) [StatusCode]() +### func \(GetNodeHostnameResponse\) [StatusCode]() ```go func (r GetNodeHostnameResponse) StatusCode() int @@ -3532,7 +3497,7 @@ func (r GetNodeHostnameResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeLoadResponse]() +## type [GetNodeLoadResponse]() @@ -3549,7 +3514,7 @@ type GetNodeLoadResponse struct { ``` -### func [ParseGetNodeLoadResponse]() +### func [ParseGetNodeLoadResponse]() ```go func ParseGetNodeLoadResponse(rsp *http.Response) (*GetNodeLoadResponse, error) @@ -3558,7 +3523,7 @@ func ParseGetNodeLoadResponse(rsp *http.Response) (*GetNodeLoadResponse, error) ParseGetNodeLoadResponse parses an HTTP response from a GetNodeLoadWithResponse call -### func \(GetNodeLoadResponse\) [Status]() +### func \(GetNodeLoadResponse\) [Status]() ```go func (r GetNodeLoadResponse) Status() string @@ -3567,7 +3532,7 @@ func (r GetNodeLoadResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeLoadResponse\) [StatusCode]() +### func \(GetNodeLoadResponse\) [StatusCode]() ```go func (r GetNodeLoadResponse) StatusCode() int @@ -3576,7 +3541,7 @@ func (r GetNodeLoadResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeMemoryResponse]() +## type [GetNodeMemoryResponse]() @@ -3593,7 +3558,7 @@ type GetNodeMemoryResponse struct { ``` -### func [ParseGetNodeMemoryResponse]() +### func [ParseGetNodeMemoryResponse]() ```go func ParseGetNodeMemoryResponse(rsp *http.Response) (*GetNodeMemoryResponse, error) @@ -3602,7 +3567,7 @@ func ParseGetNodeMemoryResponse(rsp *http.Response) (*GetNodeMemoryResponse, err ParseGetNodeMemoryResponse parses an HTTP response from a GetNodeMemoryWithResponse call -### func \(GetNodeMemoryResponse\) [Status]() +### func \(GetNodeMemoryResponse\) [Status]() ```go func (r GetNodeMemoryResponse) Status() string @@ -3611,7 +3576,7 @@ func (r GetNodeMemoryResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeMemoryResponse\) [StatusCode]() +### func \(GetNodeMemoryResponse\) [StatusCode]() ```go func (r GetNodeMemoryResponse) StatusCode() int @@ -3620,7 +3585,7 @@ func (r GetNodeMemoryResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeNetworkDNSByInterfaceResponse]() +## type [GetNodeNetworkDNSByInterfaceResponse]() @@ -3637,7 +3602,7 @@ type GetNodeNetworkDNSByInterfaceResponse struct { ``` -### func [ParseGetNodeNetworkDNSByInterfaceResponse]() +### func [ParseGetNodeNetworkDNSByInterfaceResponse]() ```go func ParseGetNodeNetworkDNSByInterfaceResponse(rsp *http.Response) (*GetNodeNetworkDNSByInterfaceResponse, error) @@ -3646,7 +3611,7 @@ func ParseGetNodeNetworkDNSByInterfaceResponse(rsp *http.Response) (*GetNodeNetw ParseGetNodeNetworkDNSByInterfaceResponse parses an HTTP response from a GetNodeNetworkDNSByInterfaceWithResponse call -### func \(GetNodeNetworkDNSByInterfaceResponse\) [Status]() +### func \(GetNodeNetworkDNSByInterfaceResponse\) [Status]() ```go func (r GetNodeNetworkDNSByInterfaceResponse) Status() string @@ -3655,7 +3620,7 @@ func (r GetNodeNetworkDNSByInterfaceResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeNetworkDNSByInterfaceResponse\) [StatusCode]() +### func \(GetNodeNetworkDNSByInterfaceResponse\) [StatusCode]() ```go func (r GetNodeNetworkDNSByInterfaceResponse) StatusCode() int @@ -3664,7 +3629,7 @@ func (r GetNodeNetworkDNSByInterfaceResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeOSResponse]() +## type [GetNodeOSResponse]() @@ -3681,7 +3646,7 @@ type GetNodeOSResponse struct { ``` -### func [ParseGetNodeOSResponse]() +### func [ParseGetNodeOSResponse]() ```go func ParseGetNodeOSResponse(rsp *http.Response) (*GetNodeOSResponse, error) @@ -3690,7 +3655,7 @@ func ParseGetNodeOSResponse(rsp *http.Response) (*GetNodeOSResponse, error) ParseGetNodeOSResponse parses an HTTP response from a GetNodeOSWithResponse call -### func \(GetNodeOSResponse\) [Status]() +### func \(GetNodeOSResponse\) [Status]() ```go func (r GetNodeOSResponse) Status() string @@ -3699,7 +3664,7 @@ func (r GetNodeOSResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeOSResponse\) [StatusCode]() +### func \(GetNodeOSResponse\) [StatusCode]() ```go func (r GetNodeOSResponse) StatusCode() int @@ -3708,7 +3673,7 @@ func (r GetNodeOSResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeStatusResponse]() +## type [GetNodeStatusResponse]() @@ -3725,7 +3690,7 @@ type GetNodeStatusResponse struct { ``` -### func [ParseGetNodeStatusResponse]() +### func [ParseGetNodeStatusResponse]() ```go func ParseGetNodeStatusResponse(rsp *http.Response) (*GetNodeStatusResponse, error) @@ -3734,7 +3699,7 @@ func ParseGetNodeStatusResponse(rsp *http.Response) (*GetNodeStatusResponse, err ParseGetNodeStatusResponse parses an HTTP response from a GetNodeStatusWithResponse call -### func \(GetNodeStatusResponse\) [Status]() +### func \(GetNodeStatusResponse\) [Status]() ```go func (r GetNodeStatusResponse) Status() string @@ -3743,7 +3708,7 @@ func (r GetNodeStatusResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeStatusResponse\) [StatusCode]() +### func \(GetNodeStatusResponse\) [StatusCode]() ```go func (r GetNodeStatusResponse) StatusCode() int @@ -3752,7 +3717,7 @@ func (r GetNodeStatusResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetNodeUptimeResponse]() +## type [GetNodeUptimeResponse]() @@ -3769,7 +3734,7 @@ type GetNodeUptimeResponse struct { ``` -### func [ParseGetNodeUptimeResponse]() +### func [ParseGetNodeUptimeResponse]() ```go func ParseGetNodeUptimeResponse(rsp *http.Response) (*GetNodeUptimeResponse, error) @@ -3778,7 +3743,7 @@ func ParseGetNodeUptimeResponse(rsp *http.Response) (*GetNodeUptimeResponse, err ParseGetNodeUptimeResponse parses an HTTP response from a GetNodeUptimeWithResponse call -### func \(GetNodeUptimeResponse\) [Status]() +### func \(GetNodeUptimeResponse\) [Status]() ```go func (r GetNodeUptimeResponse) Status() string @@ -3787,7 +3752,7 @@ func (r GetNodeUptimeResponse) Status() string Status returns HTTPResponse.Status -### func \(GetNodeUptimeResponse\) [StatusCode]() +### func \(GetNodeUptimeResponse\) [StatusCode]() ```go func (r GetNodeUptimeResponse) StatusCode() int @@ -3796,7 +3761,7 @@ func (r GetNodeUptimeResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [GetVersionResponse]() +## type [GetVersionResponse]() @@ -3809,7 +3774,7 @@ type GetVersionResponse struct { ``` -### func [ParseGetVersionResponse]() +### func [ParseGetVersionResponse]() ```go func ParseGetVersionResponse(rsp *http.Response) (*GetVersionResponse, error) @@ -3818,7 +3783,7 @@ func ParseGetVersionResponse(rsp *http.Response) (*GetVersionResponse, error) ParseGetVersionResponse parses an HTTP response from a GetVersionWithResponse call -### func \(GetVersionResponse\) [Status]() +### func \(GetVersionResponse\) [Status]() ```go func (r GetVersionResponse) Status() string @@ -3827,7 +3792,7 @@ func (r GetVersionResponse) Status() string Status returns HTTPResponse.Status -### func \(GetVersionResponse\) [StatusCode]() +### func \(GetVersionResponse\) [StatusCode]() ```go func (r GetVersionResponse) StatusCode() int @@ -3836,7 +3801,7 @@ func (r GetVersionResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [HealthResponse]() +## type [HealthResponse]() HealthResponse defines model for HealthResponse. @@ -3848,7 +3813,7 @@ type HealthResponse struct { ``` -## type [Hostname]() +## type [Hostname]() Hostname defines model for Hostname. @@ -3857,7 +3822,7 @@ type Hostname = string ``` -## type [HostnameCollectionResponse]() +## type [HostnameCollectionResponse]() HostnameCollectionResponse defines model for HostnameCollectionResponse. @@ -3870,7 +3835,7 @@ type HostnameCollectionResponse struct { ``` -## type [HostnameResponse]() +## type [HostnameResponse]() HostnameResponse The hostname of the system. @@ -3888,7 +3853,7 @@ type HostnameResponse struct { ``` -## type [HttpRequestDoer]() +## type [HttpRequestDoer]() Doer performs HTTP requests. @@ -3901,7 +3866,7 @@ type HttpRequestDoer interface { ``` -## type [JobDetailResponse]() +## type [JobDetailResponse]() JobDetailResponse defines model for JobDetailResponse. @@ -3968,7 +3933,7 @@ type JobDetailResponse struct { ``` -## type [JobStats]() +## type [JobStats]() JobStats defines model for JobStats. @@ -3995,7 +3960,7 @@ type JobStats struct { ``` -## type [KVBucketInfo]() +## type [KVBucketInfo]() KVBucketInfo defines model for KVBucketInfo. @@ -4013,7 +3978,7 @@ type KVBucketInfo struct { ``` -## type [ListAgentsResponse]() +## type [ListAgentsResponse]() ListAgentsResponse defines model for ListAgentsResponse. @@ -4027,7 +3992,7 @@ type ListAgentsResponse struct { ``` -## type [ListAuditResponse]() +## type [ListAuditResponse]() ListAuditResponse defines model for ListAuditResponse. @@ -4042,7 +4007,7 @@ type ListAuditResponse struct { ``` -## type [ListJobsResponse]() +## type [ListJobsResponse]() ListJobsResponse defines model for ListJobsResponse. @@ -4056,7 +4021,7 @@ type ListJobsResponse struct { ``` -## type [LoadAverageResponse]() +## type [LoadAverageResponse]() LoadAverageResponse The system load averages for 1, 5, and 15 minutes. @@ -4074,7 +4039,7 @@ type LoadAverageResponse struct { ``` -## type [LoadCollectionResponse]() +## type [LoadCollectionResponse]() LoadCollectionResponse defines model for LoadCollectionResponse. @@ -4087,7 +4052,7 @@ type LoadCollectionResponse struct { ``` -## type [LoadResultItem]() +## type [LoadResultItem]() LoadResultItem defines model for LoadResultItem. @@ -4105,7 +4070,7 @@ type LoadResultItem struct { ``` -## type [MemoryCollectionResponse]() +## type [MemoryCollectionResponse]() MemoryCollectionResponse defines model for MemoryCollectionResponse. @@ -4118,7 +4083,7 @@ type MemoryCollectionResponse struct { ``` -## type [MemoryResponse]() +## type [MemoryResponse]() MemoryResponse Memory usage information. @@ -4136,7 +4101,7 @@ type MemoryResponse struct { ``` -## type [MemoryResultItem]() +## type [MemoryResultItem]() MemoryResultItem defines model for MemoryResultItem. @@ -4154,7 +4119,7 @@ type MemoryResultItem struct { ``` -## type [NATSInfo]() +## type [NATSInfo]() NATSInfo defines model for NATSInfo. @@ -4169,7 +4134,7 @@ type NATSInfo struct { ``` -## type [NetworkInterfaceResponse]() +## type [NetworkInterfaceResponse]() NetworkInterfaceResponse defines model for NetworkInterfaceResponse. @@ -4185,7 +4150,7 @@ type NetworkInterfaceResponse struct { ``` -## type [NetworkInterfaceResponseFamily]() +## type [NetworkInterfaceResponseFamily]() NetworkInterfaceResponseFamily IP address family. @@ -4204,7 +4169,7 @@ const ( ``` -## type [NodeCondition]() +## type [NodeCondition]() NodeCondition defines model for NodeCondition. @@ -4218,7 +4183,7 @@ type NodeCondition struct { ``` -## type [NodeConditionType]() +## type [NodeConditionType]() NodeConditionType defines model for NodeCondition.Type. @@ -4237,7 +4202,7 @@ const ( ``` -## type [NodeStatusCollectionResponse]() +## type [NodeStatusCollectionResponse]() NodeStatusCollectionResponse defines model for NodeStatusCollectionResponse. @@ -4250,7 +4215,7 @@ type NodeStatusCollectionResponse struct { ``` -## type [NodeStatusResponse]() +## type [NodeStatusResponse]() NodeStatusResponse defines model for NodeStatusResponse. @@ -4280,7 +4245,7 @@ type NodeStatusResponse struct { ``` -## type [OSInfoCollectionResponse]() +## type [OSInfoCollectionResponse]() OSInfoCollectionResponse defines model for OSInfoCollectionResponse. @@ -4293,7 +4258,7 @@ type OSInfoCollectionResponse struct { ``` -## type [OSInfoResponse]() +## type [OSInfoResponse]() OSInfoResponse Operating system information. @@ -4308,7 +4273,7 @@ type OSInfoResponse struct { ``` -## type [OSInfoResultItem]() +## type [OSInfoResultItem]() OSInfoResultItem defines model for OSInfoResultItem. @@ -4326,7 +4291,7 @@ type OSInfoResultItem struct { ``` -## type [PingCollectionResponse]() +## type [PingCollectionResponse]() PingCollectionResponse defines model for PingCollectionResponse. @@ -4339,7 +4304,7 @@ type PingCollectionResponse struct { ``` -## type [PingResponse]() +## type [PingResponse]() PingResponse defines model for PingResponse. @@ -4371,17 +4336,65 @@ type PingResponse struct { } ``` - -## type [PostFileJSONRequestBody]() + +## type [PostFileMultipartBody]() -PostFileJSONRequestBody defines body for PostFile for application/json ContentType. +PostFileMultipartBody defines parameters for PostFile. ```go -type PostFileJSONRequestBody = FileUploadRequest +type PostFileMultipartBody struct { + // ContentType How the file should be treated during deploy. "raw" writes bytes as-is; "template" renders with Go text/template and agent facts. + ContentType *PostFileMultipartBodyContentType `json:"content_type,omitempty"` + + // File The file content. + File openapi_types.File `json:"file"` + + // Name The name of the file in the Object Store. + Name string `json:"name"` +} +``` + + +## type [PostFileMultipartBodyContentType]() + +PostFileMultipartBodyContentType defines parameters for PostFile. + +```go +type PostFileMultipartBodyContentType string +``` + +Defines values for PostFileMultipartBodyContentType. + +```go +const ( + PostFileMultipartBodyContentTypeRaw PostFileMultipartBodyContentType = "raw" + PostFileMultipartBodyContentTypeTemplate PostFileMultipartBodyContentType = "template" +) +``` + + +## type [PostFileMultipartRequestBody]() + +PostFileMultipartRequestBody defines body for PostFile for multipart/form\-data ContentType. + +```go +type PostFileMultipartRequestBody PostFileMultipartBody +``` + + +## type [PostFileParams]() + +PostFileParams defines parameters for PostFile. + +```go +type PostFileParams struct { + // Force When true, bypass the digest check and always write the file. Returns changed=true regardless of whether the content differs from the existing object. + Force *bool `form:"force,omitempty" json:"force,omitempty"` +} ``` -## type [PostFileResponse]() +## type [PostFileResponse]() @@ -4393,12 +4406,13 @@ type PostFileResponse struct { JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse + JSON409 *ErrorResponse JSON500 *ErrorResponse } ``` -### func [ParsePostFileResponse]() +### func [ParsePostFileResponse]() ```go func ParsePostFileResponse(rsp *http.Response) (*PostFileResponse, error) @@ -4407,7 +4421,7 @@ func ParsePostFileResponse(rsp *http.Response) (*PostFileResponse, error) ParsePostFileResponse parses an HTTP response from a PostFileWithResponse call -### func \(PostFileResponse\) [Status]() +### func \(PostFileResponse\) [Status]() ```go func (r PostFileResponse) Status() string @@ -4416,7 +4430,7 @@ func (r PostFileResponse) Status() string Status returns HTTPResponse.Status -### func \(PostFileResponse\) [StatusCode]() +### func \(PostFileResponse\) [StatusCode]() ```go func (r PostFileResponse) StatusCode() int @@ -4425,7 +4439,7 @@ func (r PostFileResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostJobJSONRequestBody]() +## type [PostJobJSONRequestBody]() PostJobJSONRequestBody defines body for PostJob for application/json ContentType. @@ -4434,7 +4448,7 @@ type PostJobJSONRequestBody = CreateJobRequest ``` -## type [PostJobResponse]() +## type [PostJobResponse]() @@ -4451,7 +4465,7 @@ type PostJobResponse struct { ``` -### func [ParsePostJobResponse]() +### func [ParsePostJobResponse]() ```go func ParsePostJobResponse(rsp *http.Response) (*PostJobResponse, error) @@ -4460,7 +4474,7 @@ func ParsePostJobResponse(rsp *http.Response) (*PostJobResponse, error) ParsePostJobResponse parses an HTTP response from a PostJobWithResponse call -### func \(PostJobResponse\) [Status]() +### func \(PostJobResponse\) [Status]() ```go func (r PostJobResponse) Status() string @@ -4469,7 +4483,7 @@ func (r PostJobResponse) Status() string Status returns HTTPResponse.Status -### func \(PostJobResponse\) [StatusCode]() +### func \(PostJobResponse\) [StatusCode]() ```go func (r PostJobResponse) StatusCode() int @@ -4478,7 +4492,7 @@ func (r PostJobResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostNodeCommandExecJSONRequestBody]() +## type [PostNodeCommandExecJSONRequestBody]() PostNodeCommandExecJSONRequestBody defines body for PostNodeCommandExec for application/json ContentType. @@ -4487,7 +4501,7 @@ type PostNodeCommandExecJSONRequestBody = CommandExecRequest ``` -## type [PostNodeCommandExecResponse]() +## type [PostNodeCommandExecResponse]() @@ -4504,7 +4518,7 @@ type PostNodeCommandExecResponse struct { ``` -### func [ParsePostNodeCommandExecResponse]() +### func [ParsePostNodeCommandExecResponse]() ```go func ParsePostNodeCommandExecResponse(rsp *http.Response) (*PostNodeCommandExecResponse, error) @@ -4513,7 +4527,7 @@ func ParsePostNodeCommandExecResponse(rsp *http.Response) (*PostNodeCommandExecR ParsePostNodeCommandExecResponse parses an HTTP response from a PostNodeCommandExecWithResponse call -### func \(PostNodeCommandExecResponse\) [Status]() +### func \(PostNodeCommandExecResponse\) [Status]() ```go func (r PostNodeCommandExecResponse) Status() string @@ -4522,7 +4536,7 @@ func (r PostNodeCommandExecResponse) Status() string Status returns HTTPResponse.Status -### func \(PostNodeCommandExecResponse\) [StatusCode]() +### func \(PostNodeCommandExecResponse\) [StatusCode]() ```go func (r PostNodeCommandExecResponse) StatusCode() int @@ -4531,7 +4545,7 @@ func (r PostNodeCommandExecResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostNodeCommandShellJSONRequestBody]() +## type [PostNodeCommandShellJSONRequestBody]() PostNodeCommandShellJSONRequestBody defines body for PostNodeCommandShell for application/json ContentType. @@ -4540,7 +4554,7 @@ type PostNodeCommandShellJSONRequestBody = CommandShellRequest ``` -## type [PostNodeCommandShellResponse]() +## type [PostNodeCommandShellResponse]() @@ -4557,7 +4571,7 @@ type PostNodeCommandShellResponse struct { ``` -### func [ParsePostNodeCommandShellResponse]() +### func [ParsePostNodeCommandShellResponse]() ```go func ParsePostNodeCommandShellResponse(rsp *http.Response) (*PostNodeCommandShellResponse, error) @@ -4566,7 +4580,7 @@ func ParsePostNodeCommandShellResponse(rsp *http.Response) (*PostNodeCommandShel ParsePostNodeCommandShellResponse parses an HTTP response from a PostNodeCommandShellWithResponse call -### func \(PostNodeCommandShellResponse\) [Status]() +### func \(PostNodeCommandShellResponse\) [Status]() ```go func (r PostNodeCommandShellResponse) Status() string @@ -4575,7 +4589,7 @@ func (r PostNodeCommandShellResponse) Status() string Status returns HTTPResponse.Status -### func \(PostNodeCommandShellResponse\) [StatusCode]() +### func \(PostNodeCommandShellResponse\) [StatusCode]() ```go func (r PostNodeCommandShellResponse) StatusCode() int @@ -4584,7 +4598,7 @@ func (r PostNodeCommandShellResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostNodeFileDeployJSONRequestBody]() +## type [PostNodeFileDeployJSONRequestBody]() PostNodeFileDeployJSONRequestBody defines body for PostNodeFileDeploy for application/json ContentType. @@ -4593,7 +4607,7 @@ type PostNodeFileDeployJSONRequestBody = FileDeployRequest ``` -## type [PostNodeFileDeployResponse]() +## type [PostNodeFileDeployResponse]() @@ -4610,7 +4624,7 @@ type PostNodeFileDeployResponse struct { ``` -### func [ParsePostNodeFileDeployResponse]() +### func [ParsePostNodeFileDeployResponse]() ```go func ParsePostNodeFileDeployResponse(rsp *http.Response) (*PostNodeFileDeployResponse, error) @@ -4619,7 +4633,7 @@ func ParsePostNodeFileDeployResponse(rsp *http.Response) (*PostNodeFileDeployRes ParsePostNodeFileDeployResponse parses an HTTP response from a PostNodeFileDeployWithResponse call -### func \(PostNodeFileDeployResponse\) [Status]() +### func \(PostNodeFileDeployResponse\) [Status]() ```go func (r PostNodeFileDeployResponse) Status() string @@ -4628,7 +4642,7 @@ func (r PostNodeFileDeployResponse) Status() string Status returns HTTPResponse.Status -### func \(PostNodeFileDeployResponse\) [StatusCode]() +### func \(PostNodeFileDeployResponse\) [StatusCode]() ```go func (r PostNodeFileDeployResponse) StatusCode() int @@ -4637,7 +4651,7 @@ func (r PostNodeFileDeployResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostNodeFileStatusJSONRequestBody]() +## type [PostNodeFileStatusJSONRequestBody]() PostNodeFileStatusJSONRequestBody defines body for PostNodeFileStatus for application/json ContentType. @@ -4646,7 +4660,7 @@ type PostNodeFileStatusJSONRequestBody = FileStatusRequest ``` -## type [PostNodeFileStatusResponse]() +## type [PostNodeFileStatusResponse]() @@ -4663,7 +4677,7 @@ type PostNodeFileStatusResponse struct { ``` -### func [ParsePostNodeFileStatusResponse]() +### func [ParsePostNodeFileStatusResponse]() ```go func ParsePostNodeFileStatusResponse(rsp *http.Response) (*PostNodeFileStatusResponse, error) @@ -4672,7 +4686,7 @@ func ParsePostNodeFileStatusResponse(rsp *http.Response) (*PostNodeFileStatusRes ParsePostNodeFileStatusResponse parses an HTTP response from a PostNodeFileStatusWithResponse call -### func \(PostNodeFileStatusResponse\) [Status]() +### func \(PostNodeFileStatusResponse\) [Status]() ```go func (r PostNodeFileStatusResponse) Status() string @@ -4681,7 +4695,7 @@ func (r PostNodeFileStatusResponse) Status() string Status returns HTTPResponse.Status -### func \(PostNodeFileStatusResponse\) [StatusCode]() +### func \(PostNodeFileStatusResponse\) [StatusCode]() ```go func (r PostNodeFileStatusResponse) StatusCode() int @@ -4690,7 +4704,7 @@ func (r PostNodeFileStatusResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PostNodeNetworkPingJSONBody]() +## type [PostNodeNetworkPingJSONBody]() PostNodeNetworkPingJSONBody defines parameters for PostNodeNetworkPing. @@ -4702,7 +4716,7 @@ type PostNodeNetworkPingJSONBody struct { ``` -## type [PostNodeNetworkPingJSONRequestBody]() +## type [PostNodeNetworkPingJSONRequestBody]() PostNodeNetworkPingJSONRequestBody defines body for PostNodeNetworkPing for application/json ContentType. @@ -4711,7 +4725,7 @@ type PostNodeNetworkPingJSONRequestBody PostNodeNetworkPingJSONBody ``` -## type [PostNodeNetworkPingResponse]() +## type [PostNodeNetworkPingResponse]() @@ -4728,7 +4742,7 @@ type PostNodeNetworkPingResponse struct { ``` -### func [ParsePostNodeNetworkPingResponse]() +### func [ParsePostNodeNetworkPingResponse]() ```go func ParsePostNodeNetworkPingResponse(rsp *http.Response) (*PostNodeNetworkPingResponse, error) @@ -4737,7 +4751,7 @@ func ParsePostNodeNetworkPingResponse(rsp *http.Response) (*PostNodeNetworkPingR ParsePostNodeNetworkPingResponse parses an HTTP response from a PostNodeNetworkPingWithResponse call -### func \(PostNodeNetworkPingResponse\) [Status]() +### func \(PostNodeNetworkPingResponse\) [Status]() ```go func (r PostNodeNetworkPingResponse) Status() string @@ -4746,7 +4760,7 @@ func (r PostNodeNetworkPingResponse) Status() string Status returns HTTPResponse.Status -### func \(PostNodeNetworkPingResponse\) [StatusCode]() +### func \(PostNodeNetworkPingResponse\) [StatusCode]() ```go func (r PostNodeNetworkPingResponse) StatusCode() int @@ -4755,7 +4769,7 @@ func (r PostNodeNetworkPingResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [PutNodeNetworkDNSJSONRequestBody]() +## type [PutNodeNetworkDNSJSONRequestBody]() PutNodeNetworkDNSJSONRequestBody defines body for PutNodeNetworkDNS for application/json ContentType. @@ -4764,7 +4778,7 @@ type PutNodeNetworkDNSJSONRequestBody = DNSConfigUpdateRequest ``` -## type [PutNodeNetworkDNSResponse]() +## type [PutNodeNetworkDNSResponse]() @@ -4781,7 +4795,7 @@ type PutNodeNetworkDNSResponse struct { ``` -### func [ParsePutNodeNetworkDNSResponse]() +### func [ParsePutNodeNetworkDNSResponse]() ```go func ParsePutNodeNetworkDNSResponse(rsp *http.Response) (*PutNodeNetworkDNSResponse, error) @@ -4790,7 +4804,7 @@ func ParsePutNodeNetworkDNSResponse(rsp *http.Response) (*PutNodeNetworkDNSRespo ParsePutNodeNetworkDNSResponse parses an HTTP response from a PutNodeNetworkDNSWithResponse call -### func \(PutNodeNetworkDNSResponse\) [Status]() +### func \(PutNodeNetworkDNSResponse\) [Status]() ```go func (r PutNodeNetworkDNSResponse) Status() string @@ -4799,7 +4813,7 @@ func (r PutNodeNetworkDNSResponse) Status() string Status returns HTTPResponse.Status -### func \(PutNodeNetworkDNSResponse\) [StatusCode]() +### func \(PutNodeNetworkDNSResponse\) [StatusCode]() ```go func (r PutNodeNetworkDNSResponse) StatusCode() int @@ -4808,7 +4822,7 @@ func (r PutNodeNetworkDNSResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [QueueStatsResponse]() +## type [QueueStatsResponse]() QueueStatsResponse defines model for QueueStatsResponse. @@ -4829,7 +4843,7 @@ type QueueStatsResponse struct { ``` -## type [ReadyResponse]() +## type [ReadyResponse]() ReadyResponse defines model for ReadyResponse. @@ -4844,7 +4858,7 @@ type ReadyResponse struct { ``` -## type [RequestEditorFn]() +## type [RequestEditorFn]() RequestEditorFn is the function signature for the RequestEditor callback function @@ -4853,7 +4867,7 @@ type RequestEditorFn func(ctx context.Context, req *http.Request) error ``` -## type [RetryJobByIDJSONRequestBody]() +## type [RetryJobByIDJSONRequestBody]() RetryJobByIDJSONRequestBody defines body for RetryJobByID for application/json ContentType. @@ -4862,7 +4876,7 @@ type RetryJobByIDJSONRequestBody = RetryJobRequest ``` -## type [RetryJobByIDResponse]() +## type [RetryJobByIDResponse]() @@ -4880,7 +4894,7 @@ type RetryJobByIDResponse struct { ``` -### func [ParseRetryJobByIDResponse]() +### func [ParseRetryJobByIDResponse]() ```go func ParseRetryJobByIDResponse(rsp *http.Response) (*RetryJobByIDResponse, error) @@ -4889,7 +4903,7 @@ func ParseRetryJobByIDResponse(rsp *http.Response) (*RetryJobByIDResponse, error ParseRetryJobByIDResponse parses an HTTP response from a RetryJobByIDWithResponse call -### func \(RetryJobByIDResponse\) [Status]() +### func \(RetryJobByIDResponse\) [Status]() ```go func (r RetryJobByIDResponse) Status() string @@ -4898,7 +4912,7 @@ func (r RetryJobByIDResponse) Status() string Status returns HTTPResponse.Status -### func \(RetryJobByIDResponse\) [StatusCode]() +### func \(RetryJobByIDResponse\) [StatusCode]() ```go func (r RetryJobByIDResponse) StatusCode() int @@ -4907,7 +4921,7 @@ func (r RetryJobByIDResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [RetryJobRequest]() +## type [RetryJobRequest]() RetryJobRequest defines model for RetryJobRequest. @@ -4919,7 +4933,7 @@ type RetryJobRequest struct { ``` -## type [RouteResponse]() +## type [RouteResponse]() RouteResponse A network routing table entry. @@ -4946,7 +4960,7 @@ type RouteResponse struct { ``` -## type [StatusResponse]() +## type [StatusResponse]() StatusResponse defines model for StatusResponse. @@ -4978,7 +4992,7 @@ type StatusResponse struct { ``` -## type [StreamInfo]() +## type [StreamInfo]() StreamInfo defines model for StreamInfo. @@ -4999,7 +5013,7 @@ type StreamInfo struct { ``` -## type [TimelineEvent]() +## type [TimelineEvent]() TimelineEvent defines model for TimelineEvent. @@ -5014,7 +5028,7 @@ type TimelineEvent struct { ``` -## type [UndrainAgentResponse]() +## type [UndrainAgentResponse]() @@ -5033,7 +5047,7 @@ type UndrainAgentResponse struct { ``` -### func [ParseUndrainAgentResponse]() +### func [ParseUndrainAgentResponse]() ```go func ParseUndrainAgentResponse(rsp *http.Response) (*UndrainAgentResponse, error) @@ -5042,7 +5056,7 @@ func ParseUndrainAgentResponse(rsp *http.Response) (*UndrainAgentResponse, error ParseUndrainAgentResponse parses an HTTP response from a UndrainAgentWithResponse call -### func \(UndrainAgentResponse\) [Status]() +### func \(UndrainAgentResponse\) [Status]() ```go func (r UndrainAgentResponse) Status() string @@ -5051,7 +5065,7 @@ func (r UndrainAgentResponse) Status() string Status returns HTTPResponse.Status -### func \(UndrainAgentResponse\) [StatusCode]() +### func \(UndrainAgentResponse\) [StatusCode]() ```go func (r UndrainAgentResponse) StatusCode() int @@ -5060,7 +5074,7 @@ func (r UndrainAgentResponse) StatusCode() int StatusCode returns HTTPResponse.StatusCode -## type [UptimeCollectionResponse]() +## type [UptimeCollectionResponse]() UptimeCollectionResponse defines model for UptimeCollectionResponse. @@ -5073,7 +5087,7 @@ type UptimeCollectionResponse struct { ``` -## type [UptimeResponse]() +## type [UptimeResponse]() UptimeResponse System uptime information. diff --git a/docs/gen/osapi.md b/docs/gen/osapi.md index 0206fff..9b4ff84 100644 --- a/docs/gen/osapi.md +++ b/docs/gen/osapi.md @@ -61,6 +61,7 @@ resp, err := client.Node.Exec(ctx, osapi.ExecRequest{ - [type Disk](<#Disk>) - [type DiskResult](<#DiskResult>) - [type ExecRequest](<#ExecRequest>) +- [type FileChanged](<#FileChanged>) - [type FileDelete](<#FileDelete>) - [type FileDeployOpts](<#FileDeployOpts>) - [type FileDeployResult](<#FileDeployResult>) @@ -68,10 +69,11 @@ resp, err := client.Node.Exec(ctx, osapi.ExecRequest{ - [type FileList](<#FileList>) - [type FileMetadata](<#FileMetadata>) - [type FileService](<#FileService>) + - [func \(s \*FileService\) Changed\(ctx context.Context, name string, file io.Reader\) \(\*Response\[FileChanged\], error\)](<#FileService.Changed>) - [func \(s \*FileService\) Delete\(ctx context.Context, name string\) \(\*Response\[FileDelete\], error\)](<#FileService.Delete>) - [func \(s \*FileService\) Get\(ctx context.Context, name string\) \(\*Response\[FileMetadata\], error\)](<#FileService.Get>) - [func \(s \*FileService\) List\(ctx context.Context\) \(\*Response\[FileList\], error\)](<#FileService.List>) - - [func \(s \*FileService\) Upload\(ctx context.Context, name string, content \[\]byte\) \(\*Response\[FileUpload\], error\)](<#FileService.Upload>) + - [func \(s \*FileService\) Upload\(ctx context.Context, name string, contentType string, file io.Reader, opts ...UploadOption\) \(\*Response\[FileUpload\], error\)](<#FileService.Upload>) - [type FileStatusResult](<#FileStatusResult>) - [type FileUpload](<#FileUpload>) - [type HealthService](<#HealthService>) @@ -140,6 +142,8 @@ resp, err := client.Node.Exec(ctx, osapi.ExecRequest{ - [type TimelineEvent](<#TimelineEvent>) - [type UnexpectedStatusError](<#UnexpectedStatusError>) - [func \(e \*UnexpectedStatusError\) Unwrap\(\) error](<#UnexpectedStatusError.Unwrap>) +- [type UploadOption](<#UploadOption>) + - [func WithForce\(\) UploadOption](<#WithForce>) - [type UptimeResult](<#UptimeResult>) - [type ValidationError](<#ValidationError>) - [func \(e \*ValidationError\) Unwrap\(\) error](<#ValidationError.Unwrap>) @@ -622,8 +626,21 @@ type ExecRequest struct { } ``` + +## type [FileChanged]() + +FileChanged represents the result of a change detection check. + +```go +type FileChanged struct { + Name string + Changed bool + SHA256 string +} +``` + -## type [FileDelete]() +## type [FileDelete]() FileDelete represents the result of a file deletion. @@ -669,7 +686,7 @@ type FileDeployOpts struct { ``` -## type [FileDeployResult]() +## type [FileDeployResult]() FileDeployResult represents the result of a file deploy operation. @@ -682,20 +699,21 @@ type FileDeployResult struct { ``` -## type [FileItem]() +## type [FileItem]() FileItem represents file metadata in a list. ```go type FileItem struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + ContentType string } ``` -## type [FileList]() +## type [FileList]() FileList is a collection of files with total count. @@ -707,20 +725,21 @@ type FileList struct { ``` -## type [FileMetadata]() +## type [FileMetadata]() FileMetadata represents metadata for a single file. ```go type FileMetadata struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + ContentType string } ``` -## type [FileService]() +## type [FileService]() FileService provides file management operations for the Object Store. @@ -730,8 +749,17 @@ type FileService struct { } ``` + +### func \(\*FileService\) [Changed]() + +```go +func (s *FileService) Changed(ctx context.Context, name string, file io.Reader) (*Response[FileChanged], error) +``` + +Changed computes the SHA\-256 of the provided content and compares it against the stored hash in the Object Store. Returns true if the content differs or the file does not exist yet. + -### func \(\*FileService\) [Delete]() +### func \(\*FileService\) [Delete]() ```go func (s *FileService) Delete(ctx context.Context, name string) (*Response[FileDelete], error) @@ -740,7 +768,7 @@ func (s *FileService) Delete(ctx context.Context, name string) (*Response[FileDe Delete removes a file from the Object Store. -### func \(\*FileService\) [Get]() +### func \(\*FileService\) [Get]() ```go func (s *FileService) Get(ctx context.Context, name string) (*Response[FileMetadata], error) @@ -749,7 +777,7 @@ func (s *FileService) Get(ctx context.Context, name string) (*Response[FileMetad Get retrieves metadata for a specific file in the Object Store. -### func \(\*FileService\) [List]() +### func \(\*FileService\) [List]() ```go func (s *FileService) List(ctx context.Context) (*Response[FileList], error) @@ -758,16 +786,16 @@ func (s *FileService) List(ctx context.Context) (*Response[FileList], error) List retrieves all files stored in the Object Store. -### func \(\*FileService\) [Upload]() +### func \(\*FileService\) [Upload]() ```go -func (s *FileService) Upload(ctx context.Context, name string, content []byte) (*Response[FileUpload], error) +func (s *FileService) Upload(ctx context.Context, name string, contentType string, file io.Reader, opts ...UploadOption) (*Response[FileUpload], error) ``` -Upload uploads a file to the Object Store. +Upload uploads a file to the Object Store via multipart/form\-data. By default, it computes SHA\-256 locally and compares against the stored hash to skip the upload when content is unchanged. Use WithForce to bypass this check. -## type [FileStatusResult]() +## type [FileStatusResult]() FileStatusResult represents the result of a file status check. @@ -782,15 +810,17 @@ type FileStatusResult struct { ``` -## type [FileUpload]() +## type [FileUpload]() FileUpload represents a successfully uploaded file. ```go type FileUpload struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + Changed bool + ContentType string } ``` @@ -1555,6 +1585,24 @@ func (e *UnexpectedStatusError) Unwrap() error Unwrap returns the underlying APIError. + +## type [UploadOption]() + +UploadOption configures Upload behavior. + +```go +type UploadOption func(*uploadOptions) +``` + + +### func [WithForce]() + +```go +func WithForce() UploadOption +``` + +WithForce bypasses both SDK\-side pre\-check and server\-side digest check. The file is always uploaded and changed is always true. + ## type [UptimeResult]() diff --git a/docs/osapi/file.md b/docs/osapi/file.md index 2cb3058..5126697 100644 --- a/docs/osapi/file.md +++ b/docs/osapi/file.md @@ -7,12 +7,13 @@ and delete files that can be deployed to agents via `Node.FileDeploy`. ### Object Store -| Method | Description | -| ------------------- | ----------------------------------- | -| `Upload(ctx, n, d)` | Upload file content to Object Store | -| `List(ctx)` | List all stored files | -| `Get(ctx, name)` | Get file metadata by name | -| `Delete(ctx, name)` | Delete a file from Object Store | +| Method | Description | +| ------------------------------- | ----------------------------------------------- | +| `Upload(ctx, name, ct, r, ...)` | Upload file content to Object Store | +| `Changed(ctx, name, r)` | Check if local content differs from stored file | +| `List(ctx)` | List all stored files | +| `Get(ctx, name)` | Get file metadata by name | +| `Delete(ctx, name)` | Delete a file from Object Store | ### Node File Operations @@ -37,22 +38,42 @@ specific host: | `Vars` | map[string]any | No | Template variables for `"template"` type | | `Target` | string | Yes | Host target (see Targeting below) | +## Upload Options + +| Option | Description | +| ------------- | ------------------------------------------------------- | +| `WithForce()` | Bypass SDK-side and server-side SHA check; always write | + ## Usage ```go -// Upload a file -resp, err := client.File.Upload(ctx, "nginx.conf", configBytes) +// Upload a raw file. +resp, err := client.File.Upload( + ctx, "nginx.conf", "raw", bytes.NewReader(data), +) + +// Force upload — skip SHA-256 check, always write. +resp, err := client.File.Upload( + ctx, "nginx.conf", "raw", bytes.NewReader(data), + osapi.WithForce(), +) -// List all files +// Check if content differs without uploading. +chk, err := client.File.Changed( + ctx, "nginx.conf", bytes.NewReader(data), +) +fmt.Println(chk.Data.Changed) // true if content differs + +// List all files. resp, err := client.File.List(ctx) -// Get file metadata +// Get file metadata. resp, err := client.File.Get(ctx, "nginx.conf") -// Delete a file +// Delete a file. resp, err := client.File.Delete(ctx, "nginx.conf") -// Deploy a raw file to a specific host +// Deploy a raw file to a specific host. resp, err := client.Node.FileDeploy(ctx, osapi.FileDeployOpts{ ObjectName: "nginx.conf", Path: "/etc/nginx/nginx.conf", @@ -63,7 +84,7 @@ resp, err := client.Node.FileDeploy(ctx, osapi.FileDeployOpts{ Target: "web-01", }) -// Deploy a template file with variables +// Deploy a template file with variables. resp, err := client.Node.FileDeploy(ctx, osapi.FileDeployOpts{ ObjectName: "app.conf.tmpl", Path: "/etc/app/config.yaml", @@ -75,7 +96,7 @@ resp, err := client.Node.FileDeploy(ctx, osapi.FileDeployOpts{ Target: "_all", }) -// Check file status on a host +// Check file status on a host. resp, err := client.Node.FileStatus( ctx, "web-01", "/etc/nginx/nginx.conf", ) @@ -89,6 +110,15 @@ hostname, or a label selector (`key:value`). Object Store operations (`Upload`, `List`, `Get`, `Delete`) are server-side and do not use targeting. +## Change Detection + +`Upload` computes a SHA-256 of the file content locally before uploading. If the +hash matches the stored file, the upload is skipped and `Changed: false` is +returned. Use `WithForce()` to bypass this check. + +`Changed` performs the same SHA-256 comparison without uploading. It returns +`Changed: true` when the file does not exist or the content differs. + ## Idempotency `FileDeploy` compares the SHA-256 of the Object Store content against the diff --git a/examples/orchestration/file-deploy/main.go b/examples/orchestration/file-deploy/main.go index 9158e2d..ccab283 100644 --- a/examples/orchestration/file-deploy/main.go +++ b/examples/orchestration/file-deploy/main.go @@ -32,6 +32,7 @@ package main import ( + "bytes" "context" "fmt" "log" @@ -74,15 +75,21 @@ func main() { listen_address = {{ .Vars.listen_address }} workers = {{ .Facts.cpu_count }} `) - resp, err := c.File.Upload(ctx, "app.conf.tmpl", tmpl) + resp, err := c.File.Upload( + ctx, + "app.conf.tmpl", + "template", + bytes.NewReader(tmpl), + osapi.WithForce(), + ) if err != nil { return nil, fmt.Errorf("upload: %w", err) } - fmt.Printf(" uploaded %s (sha256=%s)\n", - resp.Data.Name, resp.Data.SHA256) + fmt.Printf(" uploaded %s (sha256=%s changed=%v)\n", + resp.Data.Name, resp.Data.SHA256, resp.Data.Changed) - return &orchestrator.Result{Changed: true}, nil + return &orchestrator.Result{Changed: resp.Data.Changed}, nil }, ) @@ -92,7 +99,7 @@ workers = {{ .Facts.cpu_count }} Target: "_all", Params: map[string]any{ "object_name": "app.conf.tmpl", - "path": "/etc/app/app.conf", + "path": "/tmp/app.conf", "content_type": "template", "mode": "0644", "vars": map[string]any{ @@ -107,7 +114,7 @@ workers = {{ .Facts.cpu_count }} Operation: "file.status.get", Target: "_all", Params: map[string]any{ - "path": "/etc/app/app.conf", + "path": "/tmp/app.conf", }, }) verify.DependsOn(deploy) diff --git a/examples/osapi/file/main.go b/examples/osapi/file/main.go index 0eb4342..18e2574 100644 --- a/examples/osapi/file/main.go +++ b/examples/osapi/file/main.go @@ -18,13 +18,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// Package main demonstrates file management: upload, list, get metadata, -// deploy to an agent, check status, and delete. +// Package main demonstrates file management: upload, check for changes, +// force upload, list, get metadata, deploy to an agent, check status, +// and delete. // // Run with: OSAPI_TOKEN="" go run main.go package main import ( + "bytes" "context" "fmt" "log" @@ -47,15 +49,43 @@ func main() { client := osapi.New(url, token) ctx := context.Background() - // Upload a file to the Object Store. + // Upload a raw file to the Object Store. content := []byte("listen_address = 0.0.0.0:8080\nworkers = 4\n") - upload, err := client.File.Upload(ctx, "app.conf", content) + upload, err := client.File.Upload( + ctx, + "app.conf", + "raw", + bytes.NewReader(content), + ) if err != nil { log.Fatalf("upload: %v", err) } - fmt.Printf("Uploaded: name=%s sha256=%s size=%d\n", - upload.Data.Name, upload.Data.SHA256, upload.Data.Size) + fmt.Printf("Uploaded: name=%s sha256=%s size=%d changed=%v\n", + upload.Data.Name, upload.Data.SHA256, upload.Data.Size, upload.Data.Changed) + + // Check if the file has changed without uploading. + chk, err := client.File.Changed(ctx, "app.conf", bytes.NewReader(content)) + if err != nil { + log.Fatalf("changed: %v", err) + } + + fmt.Printf("Changed: name=%s changed=%v\n", chk.Data.Name, chk.Data.Changed) + + // Force upload bypasses both SDK-side and server-side checks. + force, err := client.File.Upload( + ctx, + "app.conf", + "raw", + bytes.NewReader(content), + osapi.WithForce(), + ) + if err != nil { + log.Fatalf("force upload: %v", err) + } + + fmt.Printf("Force upload: name=%s changed=%v\n", + force.Data.Name, force.Data.Changed) // List all stored files. list, err := client.File.List(ctx) @@ -80,7 +110,7 @@ func main() { // Deploy the file to an agent. deploy, err := client.Node.FileDeploy(ctx, osapi.FileDeployOpts{ ObjectName: "app.conf", - Path: "/etc/app/app.conf", + Path: "/tmp/app.conf", ContentType: "raw", Mode: "0644", Target: "_any", @@ -93,7 +123,7 @@ func main() { deploy.Data.JobID, deploy.Data.Hostname, deploy.Data.Changed) // Check file status on the agent. - status, err := client.Node.FileStatus(ctx, "_any", "/etc/app/app.conf") + status, err := client.Node.FileStatus(ctx, "_any", "/tmp/app.conf") if err != nil { log.Fatalf("status: %v", err) } diff --git a/go.mod b/go.mod index 9aafb40..d931db7 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/Djarvur/go-err113 v0.1.1 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/MirrexOne/unqueryvet v1.5.3 // indirect + github.com/MirrexOne/unqueryvet v1.5.4 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/VividCortex/ewma v1.2.0 // indirect @@ -47,7 +47,7 @@ require ( github.com/alecthomas/kingpin/v2 v2.4.0 // indirect github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/alexkohler/nakedret/v2 v2.0.6 // indirect - github.com/alexkohler/prealloc v1.0.2 // indirect + github.com/alexkohler/prealloc v1.1.0 // indirect github.com/alfatraining/structtag v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/alingse/nilnesserr v0.2.0 // indirect @@ -127,7 +127,7 @@ require ( github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect github.com/golangci/go-printf-func-name v0.1.1 // indirect github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect - github.com/golangci/golangci-lint/v2 v2.10.1 // indirect + github.com/golangci/golangci-lint/v2 v2.11.1 // indirect github.com/golangci/golines v0.15.0 // indirect github.com/golangci/misspell v0.8.0 // indirect github.com/golangci/plugin-module-register v0.1.2 // indirect @@ -153,7 +153,7 @@ require ( github.com/julz/importas v0.2.0 // indirect github.com/karamaru-alpha/copyloopvar v1.2.2 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/kisielk/errcheck v1.9.0 // indirect + github.com/kisielk/errcheck v1.10.0 // indirect github.com/kkHAIKE/contextcheck v1.1.6 // indirect github.com/kulti/thelper v0.7.1 // indirect github.com/kunwardeep/paralleltest v1.0.15 // indirect @@ -180,7 +180,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mgechev/revive v1.14.0 // indirect + github.com/mgechev/revive v1.15.0 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect @@ -221,13 +221,13 @@ require ( github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect - github.com/securego/gosec/v2 v2.23.0 // indirect + github.com/securego/gosec/v2 v2.24.7 // indirect github.com/segmentio/golines v0.13.0 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/sirupsen/logrus v1.9.4 // indirect github.com/sivchari/containedctx v1.0.3 // indirect github.com/skeema/knownhosts v1.3.1 // indirect - github.com/sonatard/noctx v0.4.0 // indirect + github.com/sonatard/noctx v0.5.0 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/speakeasy-api/jsonpath v0.6.0 // indirect @@ -248,7 +248,7 @@ require ( github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.2.0 // indirect github.com/ultraware/whitespace v0.2.0 // indirect - github.com/uudashr/gocognit v1.2.0 // indirect + github.com/uudashr/gocognit v1.2.1 // indirect github.com/uudashr/iface v1.4.1 // indirect github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/woodsbury/decimal128 v1.3.0 // indirect @@ -274,7 +274,7 @@ require ( golang.org/x/crypto v0.48.0 // indirect golang.org/x/exp/typeparams v0.0.0-20260209203927-2842357ff358 // indirect golang.org/x/mod v0.33.0 // indirect - golang.org/x/net v0.50.0 // indirect + golang.org/x/net v0.51.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect diff --git a/go.sum b/go.sum index 3aa095d..0c14618 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/MirrexOne/unqueryvet v1.5.3 h1:LpT3rsH+IY3cQddWF9bg4C7jsbASdGnrOSofY8IPEiw= github.com/MirrexOne/unqueryvet v1.5.3/go.mod h1:fs9Zq6eh1LRIhsDIsxf9PONVUjYdFHdtkHIgZdJnyPU= +github.com/MirrexOne/unqueryvet v1.5.4 h1:38QOxShO7JmMWT+eCdDMbcUgGCOeJphVkzzRgyLJgsQ= +github.com/MirrexOne/unqueryvet v1.5.4/go.mod h1:fs9Zq6eh1LRIhsDIsxf9PONVUjYdFHdtkHIgZdJnyPU= github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4= github.com/OpenPeeDeeP/depguard/v2 v2.2.1/go.mod h1:q4DKzC4UcVaAvcfd41CZh0PWpGgzrVxUYBlgKNGquUo= github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw= @@ -101,6 +103,8 @@ github.com/alexkohler/nakedret/v2 v2.0.6 h1:ME3Qef1/KIKr3kWX3nti3hhgNxw6aqN5pZmQ github.com/alexkohler/nakedret/v2 v2.0.6/go.mod h1:l3RKju/IzOMQHmsEvXwkqMDzHHvurNQfAgE1eVmT40Q= github.com/alexkohler/prealloc v1.0.2 h1:MPo8cIkGkZytq7WNH9UHv3DIX1mPz1RatPXnZb0zHWQ= github.com/alexkohler/prealloc v1.0.2/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= +github.com/alexkohler/prealloc v1.1.0 h1:cKGRBqlXw5iyQGLYhrXrDlcHxugXpTq4tQ5c91wkf8M= +github.com/alexkohler/prealloc v1.1.0/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= github.com/alfatraining/structtag v1.0.0 h1:2qmcUqNcCoyVJ0up879K614L9PazjBSFruTB0GOFjCc= github.com/alfatraining/structtag v1.0.0/go.mod h1:p3Xi5SwzTi+Ryj64DqjLWz7XurHxbGsq6y3ubePJPus= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -357,6 +361,8 @@ github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0a github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= github.com/golangci/golangci-lint/v2 v2.10.1 h1:flhw5Px6ojbLyEFzXvJn5B2HEdkkRlkhE1SnmCbQBiE= github.com/golangci/golangci-lint/v2 v2.10.1/go.mod h1:dBsrOk6zj0vDhlTv+IiJGqkDokR24IVTS7W3EVfPTQY= +github.com/golangci/golangci-lint/v2 v2.11.1 h1:aGbjflzzKNIdOoq/NawrhFjYpkNY4WzPSeIp2zBbzG8= +github.com/golangci/golangci-lint/v2 v2.11.1/go.mod h1:wexdFBIQNhHNhDe1oqzlGFE5dYUqlfccWJKWjoWF1GI= github.com/golangci/golines v0.15.0 h1:Qnph25g8Y1c5fdo1X7GaRDGgnMHgnxh4Gk4VfPTtRx0= github.com/golangci/golines v0.15.0/go.mod h1:AZjXd23tbHMpowhtnGlj9KCNsysj72aeZVVHnVcZx10= github.com/golangci/misspell v0.8.0 h1:qvxQhiE2/5z+BVRo1kwYA8yGz+lOlu5Jfvtx2b04Jbg= @@ -462,6 +468,8 @@ github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4 github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.9.0 h1:9xt1zI9EBfcYBvdU1nVrzMzzUPUtPKs9bVSIM3TAb3M= github.com/kisielk/errcheck v1.9.0/go.mod h1:kQxWMMVZgIkDq7U8xtG/n2juOjbLgZtedi0D+/VL/i8= +github.com/kisielk/errcheck v1.10.0 h1:Lvs/YAHP24YKg08LA8oDw2z9fJVme090RAXd90S+rrw= +github.com/kisielk/errcheck v1.10.0/go.mod h1:kQxWMMVZgIkDq7U8xtG/n2juOjbLgZtedi0D+/VL/i8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/ttjfJCE= github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg= @@ -539,6 +547,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgechev/revive v1.14.0 h1:CC2Ulb3kV7JFYt+izwORoS3VT/+Plb8BvslI/l1yZsc= github.com/mgechev/revive v1.14.0/go.mod h1:MvnujelCZBZCaoDv5B3foPo6WWgULSSFxvfxp7GsPfo= +github.com/mgechev/revive v1.15.0 h1:vJ0HzSBzfNyPbHKolgiFjHxLek9KUijhqh42yGoqZ8Q= +github.com/mgechev/revive v1.15.0/go.mod h1:LlAKO3QQe9OJ0pVZzI2GPa8CbXGZ/9lNpCGvK4T/a8A= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -679,6 +689,8 @@ github.com/sashamelentyev/usestdlibvars v1.29.0 h1:8J0MoRrw4/NAXtjQqTHrbW9NN+3iM github.com/sashamelentyev/usestdlibvars v1.29.0/go.mod h1:8PpnjHMk5VdeWlVb4wCdrB8PNbLqZ3wBZTZWkrpZZL8= github.com/securego/gosec/v2 v2.23.0 h1:h4TtF64qFzvnkqvsHC/knT7YC5fqyOCItlVR8+ptEBo= github.com/securego/gosec/v2 v2.23.0/go.mod h1:qRHEgXLFuYUDkI2T7W7NJAmOkxVhkR0x9xyHOIcMNZ0= +github.com/securego/gosec/v2 v2.24.7 h1:3k5yJnrhT1TTdsG0ZsnenlfCcT+7Y/+zeCPHbL7QAn8= +github.com/securego/gosec/v2 v2.24.7/go.mod h1:AdDJbjcG/XxFgVv7pW19vMNYlFM6+Q6Qy3t6lWAUcEY= github.com/segmentio/golines v0.13.0 h1:GfbpsxoF4eYuEZD3mxrlsN/XD30m6nOO4QLQj2JIa90= github.com/segmentio/golines v0.13.0/go.mod h1:MMEi38dnJiyxqFZqFOqN14QMzWHzj/i0+L9Q2MsVr64= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -698,6 +710,8 @@ github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnB github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/sonatard/noctx v0.4.0 h1:7MC/5Gg4SQ4lhLYR6mvOP6mQVSxCrdyiExo7atBs27o= github.com/sonatard/noctx v0.4.0/go.mod h1:64XdbzFb18XL4LporKXp8poqZtPKbCrqQ402CV+kJas= +github.com/sonatard/noctx v0.5.0 h1:e/jdaqAsuWVOKQ0P6NWiIdDNHmHT5SwuuSfojFjzwrw= +github.com/sonatard/noctx v0.5.0/go.mod h1:64XdbzFb18XL4LporKXp8poqZtPKbCrqQ402CV+kJas= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= @@ -763,6 +777,8 @@ github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSW github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/uudashr/gocognit v1.2.0 h1:3BU9aMr1xbhPlvJLSydKwdLN3tEUUrzPSSM8S4hDYRA= github.com/uudashr/gocognit v1.2.0/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= +github.com/uudashr/gocognit v1.2.1 h1:CSJynt5txTnORn/DkhiB4mZjwPuifyASC8/6Q0I/QS4= +github.com/uudashr/gocognit v1.2.1/go.mod h1:acaubQc6xYlXFEMb9nWX2dYBzJ/bIjEkc1zzvyIZg5Q= github.com/uudashr/iface v1.4.1 h1:J16Xl1wyNX9ofhpHmQ9h9gk5rnv2A6lX/2+APLTo0zU= github.com/uudashr/iface v1.4.1/go.mod h1:pbeBPlbuU2qkNDn0mmfrxP2X+wjPMIQAy+r1MBXSXtg= github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= @@ -927,6 +943,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60= golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM= +golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= +golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/pkg/osapi/file.go b/pkg/osapi/file.go index ba55fcb..235cef5 100644 --- a/pkg/osapi/file.go +++ b/pkg/osapi/file.go @@ -21,29 +21,100 @@ package osapi import ( + "bytes" "context" + "crypto/sha256" + "errors" "fmt" + "io" + "mime/multipart" "github.com/osapi-io/osapi-sdk/pkg/osapi/gen" ) +// UploadOption configures Upload behavior. +type UploadOption func(*uploadOptions) + +type uploadOptions struct { + force bool +} + +// WithForce bypasses both SDK-side pre-check and server-side digest +// check. The file is always uploaded and changed is always true. +func WithForce() UploadOption { + return func(o *uploadOptions) { o.force = true } +} + // FileService provides file management operations for the Object Store. type FileService struct { client *gen.ClientWithResponses } -// Upload uploads a file to the Object Store. +// Upload uploads a file to the Object Store via multipart/form-data. +// By default, it computes SHA-256 locally and compares against the +// stored hash to skip the upload when content is unchanged. Use +// WithForce to bypass this check. func (s *FileService) Upload( ctx context.Context, name string, - content []byte, + contentType string, + file io.Reader, + opts ...UploadOption, ) (*Response[FileUpload], error) { - body := gen.FileUploadRequest{ - Name: name, - Content: content, + var options uploadOptions + for _, o := range opts { + o(&options) } - resp, err := s.client.PostFileWithResponse(ctx, body) + // Buffer file content for hashing and multipart construction. + fileData, err := io.ReadAll(file) + if err != nil { + return nil, fmt.Errorf("read file: %w", err) + } + + // Compute SHA-256 locally. + hash := sha256.Sum256(fileData) + sha256Hex := fmt.Sprintf("%x", hash) + + // SDK-side pre-check: skip upload if content unchanged. + // Skipped when force is set. + if !options.force { + existing, err := s.Get(ctx, name) + if err == nil && existing.Data.SHA256 == sha256Hex { + return NewResponse(FileUpload{ + Name: name, + SHA256: sha256Hex, + Size: len(fileData), + Changed: false, + ContentType: contentType, + }, nil), nil + } + // On error (404, network, etc.) fall through to upload. + } + + // Build multipart body from buffered content. + body := &bytes.Buffer{} + writer := multipart.NewWriter(body) + + _ = writer.WriteField("name", name) + _ = writer.WriteField("content_type", contentType) + + part, _ := writer.CreateFormFile("file", name) + _, _ = part.Write(fileData) + _ = writer.Close() + + // Pass force as query param. + params := &gen.PostFileParams{} + if options.force { + params.Force = &options.force + } + + resp, err := s.client.PostFileWithBodyWithResponse( + ctx, + params, + writer.FormDataContentType(), + body, + ) if err != nil { return nil, fmt.Errorf("upload file: %w", err) } @@ -53,6 +124,7 @@ func (s *FileService) Upload( resp.JSON400, resp.JSON401, resp.JSON403, + resp.JSON409, resp.JSON500, ); err != nil { return nil, err @@ -157,3 +229,42 @@ func (s *FileService) Delete( return NewResponse(fileDeleteFromGen(resp.JSON200), resp.Body), nil } + +// Changed computes the SHA-256 of the provided content and compares +// it against the stored hash in the Object Store. Returns true if +// the content differs or the file does not exist yet. +func (s *FileService) Changed( + ctx context.Context, + name string, + file io.Reader, +) (*Response[FileChanged], error) { + fileData, err := io.ReadAll(file) + if err != nil { + return nil, fmt.Errorf("read file: %w", err) + } + + hash := sha256.Sum256(fileData) + sha256Hex := fmt.Sprintf("%x", hash) + + existing, err := s.Get(ctx, name) + if err != nil { + var notFound *NotFoundError + if errors.As(err, ¬Found) { + return NewResponse(FileChanged{ + Name: name, + Changed: true, + SHA256: sha256Hex, + }, nil), nil + } + + return nil, fmt.Errorf("check file %s: %w", name, err) + } + + changed := existing.Data.SHA256 != sha256Hex + + return NewResponse(FileChanged{ + Name: name, + Changed: changed, + SHA256: sha256Hex, + }, nil), nil +} diff --git a/pkg/osapi/file_public_test.go b/pkg/osapi/file_public_test.go index b394947..46c78a0 100644 --- a/pkg/osapi/file_public_test.go +++ b/pkg/osapi/file_public_test.go @@ -21,8 +21,12 @@ package osapi_test import ( + "bytes" "context" + "crypto/sha256" "errors" + "fmt" + "io" "log/slog" "net/http" "net/http/httptest" @@ -44,19 +48,32 @@ func (suite *FilePublicTestSuite) SetupTest() { } func (suite *FilePublicTestSuite) TestUpload() { + fileContent := []byte("content") + hash := sha256.Sum256(fileContent) + contentSHA := fmt.Sprintf("%x", hash) + tests := []struct { name string handler http.HandlerFunc serverURL string + file io.Reader + opts []osapi.UploadOption validateFunc func(*osapi.Response[osapi.FileUpload], error) }{ { - name: "when uploading file returns result", - handler: func(w http.ResponseWriter, _ *http.Request) { + name: "when uploading new file returns result", + handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") + if r.Method == http.MethodGet { + w.WriteHeader(http.StatusNotFound) + _, _ = w.Write([]byte(`{"error":"file not found"}`)) + return + } w.WriteHeader(http.StatusCreated) _, _ = w.Write( - []byte(`{"name":"nginx.conf","sha256":"abc123","size":1024}`), + []byte( + `{"name":"nginx.conf","sha256":"abc123","size":1024,"changed":true,"content_type":"raw"}`, + ), ) }, validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { @@ -65,12 +82,90 @@ func (suite *FilePublicTestSuite) TestUpload() { suite.Equal("nginx.conf", resp.Data.Name) suite.Equal("abc123", resp.Data.SHA256) suite.Equal(1024, resp.Data.Size) + suite.True(resp.Data.Changed) + suite.Equal("raw", resp.Data.ContentType) + }, + }, + { + name: "when pre-check SHA matches skips upload", + handler: func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + if r.Method == http.MethodGet { + w.WriteHeader(http.StatusOK) + _, _ = fmt.Fprintf(w, + `{"name":"nginx.conf","sha256":"%s","size":7,"content_type":"raw"}`, + contentSHA, + ) + return + } + // POST should NOT be called — fail if it is. + w.WriteHeader(http.StatusInternalServerError) + _, _ = w.Write([]byte(`{"error":"unexpected POST"}`)) + }, + validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { + suite.NoError(err) + suite.NotNil(resp) + suite.Equal("nginx.conf", resp.Data.Name) + suite.Equal(contentSHA, resp.Data.SHA256) + suite.False(resp.Data.Changed) + suite.Nil(resp.RawJSON()) + }, + }, + { + name: "when force skips pre-check and uploads", + opts: []osapi.UploadOption{osapi.WithForce()}, + handler: func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + if r.Method == http.MethodGet { + // GET should NOT be called — fail if it is. + w.WriteHeader(http.StatusInternalServerError) + _, _ = w.Write([]byte(`{"error":"unexpected GET"}`)) + return + } + suite.Contains(r.URL.RawQuery, "force=true") + w.WriteHeader(http.StatusCreated) + _, _ = w.Write( + []byte( + `{"name":"nginx.conf","sha256":"abc123","size":7,"changed":true,"content_type":"raw"}`, + ), + ) + }, + validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { + suite.NoError(err) + suite.NotNil(resp) + suite.True(resp.Data.Changed) + }, + }, + { + name: "when server returns 409 returns ConflictError", + handler: func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + if r.Method == http.MethodGet { + w.WriteHeader(http.StatusNotFound) + _, _ = w.Write([]byte(`{"error":"file not found"}`)) + return + } + w.WriteHeader(http.StatusConflict) + _, _ = w.Write([]byte(`{"error":"file already exists"}`)) + }, + validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { + suite.Error(err) + suite.Nil(resp) + + var target *osapi.ConflictError + suite.True(errors.As(err, &target)) + suite.Equal(http.StatusConflict, target.StatusCode) }, }, { name: "when server returns 400 returns ValidationError", - handler: func(w http.ResponseWriter, _ *http.Request) { + handler: func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") + if r.Method == http.MethodGet { + w.WriteHeader(http.StatusNotFound) + _, _ = w.Write([]byte(`{"error":"not found"}`)) + return + } w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(`{"error":"name is required"}`)) }, @@ -105,12 +200,15 @@ func (suite *FilePublicTestSuite) TestUpload() { validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { suite.Error(err) suite.Nil(resp) - suite.Contains(err.Error(), "upload file") }, }, { name: "when server returns 201 with no JSON body returns UnexpectedStatusError", - handler: func(w http.ResponseWriter, _ *http.Request) { + handler: func(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodGet { + w.WriteHeader(http.StatusNotFound) + return + } w.WriteHeader(http.StatusCreated) }, validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { @@ -123,6 +221,18 @@ func (suite *FilePublicTestSuite) TestUpload() { suite.Equal("nil response body", target.Message) }, }, + { + name: "when file reader returns error", + file: &errReader{err: errors.New("read failed")}, + handler: func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusCreated) + }, + validateFunc: func(resp *osapi.Response[osapi.FileUpload], err error) { + suite.Error(err) + suite.Nil(resp) + suite.Contains(err.Error(), "read file") + }, + }, } for _, tc := range tests { @@ -148,7 +258,18 @@ func (suite *FilePublicTestSuite) TestUpload() { osapi.WithLogger(slog.Default()), ) - resp, err := sut.File.Upload(suite.ctx, "nginx.conf", []byte("content")) + file := tc.file + if file == nil { + file = bytes.NewReader(fileContent) + } + + resp, err := sut.File.Upload( + suite.ctx, + "nginx.conf", + "raw", + file, + tc.opts..., + ) tc.validateFunc(resp, err) }) } @@ -168,7 +289,7 @@ func (suite *FilePublicTestSuite) TestList() { w.WriteHeader(http.StatusOK) _, _ = w.Write( []byte( - `{"files":[{"name":"file1.txt","sha256":"aaa","size":100}],"total":1}`, + `{"files":[{"name":"file1.txt","sha256":"aaa","size":100,"content_type":"raw"}],"total":1}`, ), ) }, @@ -178,6 +299,7 @@ func (suite *FilePublicTestSuite) TestList() { suite.Len(resp.Data.Files, 1) suite.Equal(1, resp.Data.Total) suite.Equal("file1.txt", resp.Data.Files[0].Name) + suite.Equal("raw", resp.Data.Files[0].ContentType) }, }, { @@ -266,7 +388,9 @@ func (suite *FilePublicTestSuite) TestGet() { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) _, _ = w.Write( - []byte(`{"name":"nginx.conf","sha256":"def456","size":512}`), + []byte( + `{"name":"nginx.conf","sha256":"def456","size":512,"content_type":"raw"}`, + ), ) }, validateFunc: func(resp *osapi.Response[osapi.FileMetadata], err error) { @@ -275,6 +399,7 @@ func (suite *FilePublicTestSuite) TestGet() { suite.Equal("nginx.conf", resp.Data.Name) suite.Equal("def456", resp.Data.SHA256) suite.Equal(512, resp.Data.Size) + suite.Equal("raw", resp.Data.ContentType) }, }, { @@ -518,6 +643,147 @@ func (suite *FilePublicTestSuite) TestDelete() { } } +func (suite *FilePublicTestSuite) TestChanged() { + fileContent := []byte("content") + hash := sha256.Sum256(fileContent) + contentSHA := fmt.Sprintf("%x", hash) + + differentContent := []byte("different") + diffHash := sha256.Sum256(differentContent) + diffSHA := fmt.Sprintf("%x", diffHash) + + tests := []struct { + name string + handler http.HandlerFunc + serverURL string + file io.Reader + validateFunc func(*osapi.Response[osapi.FileChanged], error) + }{ + { + name: "when file does not exist returns changed true", + handler: func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusNotFound) + _, _ = w.Write([]byte(`{"error":"file not found"}`)) + }, + validateFunc: func(resp *osapi.Response[osapi.FileChanged], err error) { + suite.NoError(err) + suite.NotNil(resp) + suite.True(resp.Data.Changed) + suite.Equal("nginx.conf", resp.Data.Name) + suite.Equal(contentSHA, resp.Data.SHA256) + }, + }, + { + name: "when SHA matches returns changed false", + handler: func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = fmt.Fprintf(w, + `{"name":"nginx.conf","sha256":"%s","size":7,"content_type":"raw"}`, + contentSHA, + ) + }, + validateFunc: func(resp *osapi.Response[osapi.FileChanged], err error) { + suite.NoError(err) + suite.NotNil(resp) + suite.False(resp.Data.Changed) + suite.Equal(contentSHA, resp.Data.SHA256) + }, + }, + { + name: "when SHA differs returns changed true", + file: bytes.NewReader(differentContent), + handler: func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = fmt.Fprintf(w, + `{"name":"nginx.conf","sha256":"%s","size":7,"content_type":"raw"}`, + contentSHA, + ) + }, + validateFunc: func(resp *osapi.Response[osapi.FileChanged], err error) { + suite.NoError(err) + suite.NotNil(resp) + suite.True(resp.Data.Changed) + suite.Equal(diffSHA, resp.Data.SHA256) + }, + }, + { + name: "when server returns 403 returns error", + handler: func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusForbidden) + _, _ = w.Write([]byte(`{"error":"forbidden"}`)) + }, + validateFunc: func(resp *osapi.Response[osapi.FileChanged], err error) { + suite.Error(err) + suite.Nil(resp) + suite.Contains(err.Error(), "check file nginx.conf") + }, + }, + { + name: "when file reader returns error", + file: &errReader{err: errors.New("read failed")}, + handler: func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + }, + validateFunc: func(resp *osapi.Response[osapi.FileChanged], err error) { + suite.Error(err) + suite.Nil(resp) + suite.Contains(err.Error(), "read file") + }, + }, + } + + for _, tc := range tests { + suite.Run(tc.name, func() { + var ( + serverURL string + cleanup func() + ) + + if tc.serverURL != "" { + serverURL = tc.serverURL + cleanup = func() {} + } else { + server := httptest.NewServer(tc.handler) + serverURL = server.URL + cleanup = server.Close + } + defer cleanup() + + sut := osapi.New( + serverURL, + "test-token", + osapi.WithLogger(slog.Default()), + ) + + file := tc.file + if file == nil { + file = bytes.NewReader(fileContent) + } + + resp, err := sut.File.Changed( + suite.ctx, + "nginx.conf", + file, + ) + tc.validateFunc(resp, err) + }) + } +} + +type errReader struct { + err error +} + +func (r *errReader) Read( + _ []byte, +) (int, error) { + return 0, r.err +} + func TestFilePublicTestSuite(t *testing.T) { suite.Run(t, new(FilePublicTestSuite)) } diff --git a/pkg/osapi/file_types.go b/pkg/osapi/file_types.go index 935d166..a09a224 100644 --- a/pkg/osapi/file_types.go +++ b/pkg/osapi/file_types.go @@ -24,16 +24,19 @@ import "github.com/osapi-io/osapi-sdk/pkg/osapi/gen" // FileUpload represents a successfully uploaded file. type FileUpload struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + Changed bool + ContentType string } // FileItem represents file metadata in a list. type FileItem struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + ContentType string } // FileList is a collection of files with total count. @@ -44,9 +47,10 @@ type FileList struct { // FileMetadata represents metadata for a single file. type FileMetadata struct { - Name string - SHA256 string - Size int + Name string + SHA256 string + Size int + ContentType string } // FileDelete represents the result of a file deletion. @@ -55,6 +59,13 @@ type FileDelete struct { Deleted bool } +// FileChanged represents the result of a change detection check. +type FileChanged struct { + Name string + Changed bool + SHA256 string +} + // FileDeployResult represents the result of a file deploy operation. type FileDeployResult struct { JobID string @@ -76,9 +87,11 @@ func fileUploadFromGen( g *gen.FileUploadResponse, ) FileUpload { return FileUpload{ - Name: g.Name, - SHA256: g.Sha256, - Size: g.Size, + Name: g.Name, + SHA256: g.Sha256, + Size: g.Size, + Changed: g.Changed, + ContentType: g.ContentType, } } @@ -89,9 +102,10 @@ func fileListFromGen( files := make([]FileItem, 0, len(g.Files)) for _, f := range g.Files { files = append(files, FileItem{ - Name: f.Name, - SHA256: f.Sha256, - Size: f.Size, + Name: f.Name, + SHA256: f.Sha256, + Size: f.Size, + ContentType: f.ContentType, }) } @@ -106,9 +120,10 @@ func fileMetadataFromGen( g *gen.FileInfoResponse, ) FileMetadata { return FileMetadata{ - Name: g.Name, - SHA256: g.Sha256, - Size: g.Size, + Name: g.Name, + SHA256: g.Sha256, + Size: g.Size, + ContentType: g.ContentType, } } diff --git a/pkg/osapi/file_types_test.go b/pkg/osapi/file_types_test.go index 99a924b..2bd8d6b 100644 --- a/pkg/osapi/file_types_test.go +++ b/pkg/osapi/file_types_test.go @@ -41,14 +41,18 @@ func (suite *FileTypesTestSuite) TestFileUploadFromGen() { { name: "when all fields populated returns FileUpload", input: &gen.FileUploadResponse{ - Name: "nginx.conf", - Sha256: "abc123", - Size: 1024, + Name: "nginx.conf", + Sha256: "abc123", + Size: 1024, + Changed: true, + ContentType: "raw", }, validateFunc: func(result FileUpload) { suite.Equal("nginx.conf", result.Name) suite.Equal("abc123", result.SHA256) suite.Equal(1024, result.Size) + suite.True(result.Changed) + suite.Equal("raw", result.ContentType) }, }, } @@ -71,8 +75,8 @@ func (suite *FileTypesTestSuite) TestFileListFromGen() { name: "when files exist returns FileList with items", input: &gen.FileListResponse{ Files: []gen.FileInfo{ - {Name: "file1.txt", Sha256: "aaa", Size: 100}, - {Name: "file2.txt", Sha256: "bbb", Size: 200}, + {Name: "file1.txt", Sha256: "aaa", Size: 100, ContentType: "raw"}, + {Name: "file2.txt", Sha256: "bbb", Size: 200, ContentType: "template"}, }, Total: 2, }, @@ -82,7 +86,9 @@ func (suite *FileTypesTestSuite) TestFileListFromGen() { suite.Equal("file1.txt", result.Files[0].Name) suite.Equal("aaa", result.Files[0].SHA256) suite.Equal(100, result.Files[0].Size) + suite.Equal("raw", result.Files[0].ContentType) suite.Equal("file2.txt", result.Files[1].Name) + suite.Equal("template", result.Files[1].ContentType) }, }, { @@ -115,14 +121,16 @@ func (suite *FileTypesTestSuite) TestFileMetadataFromGen() { { name: "when all fields populated returns FileMetadata", input: &gen.FileInfoResponse{ - Name: "config.yaml", - Sha256: "def456", - Size: 512, + Name: "config.yaml", + Sha256: "def456", + Size: 512, + ContentType: "template", }, validateFunc: func(result FileMetadata) { suite.Equal("config.yaml", result.Name) suite.Equal("def456", result.SHA256) suite.Equal(512, result.Size) + suite.Equal("template", result.ContentType) }, }, } diff --git a/pkg/osapi/gen/api.yaml b/pkg/osapi/gen/api.yaml index 8c79989..c51c067 100644 --- a/pkg/osapi/gen/api.yaml +++ b/pkg/osapi/gen/api.yaml @@ -408,13 +408,46 @@ paths: security: - BearerAuth: - file:write + parameters: + - name: force + in: query + required: false + description: > + When true, bypass the digest check and always write the file. + Returns changed=true regardless of whether the content differs from + the existing object. + schema: + type: boolean + default: false requestBody: description: The file to upload. required: true content: - application/json: + multipart/form-data: schema: - $ref: '#/components/schemas/FileUploadRequest' + type: object + properties: + name: + type: string + description: The name of the file in the Object Store. + example: nginx.conf + content_type: + type: string + description: > + How the file should be treated during deploy. "raw" writes + bytes as-is; "template" renders with Go text/template and + agent facts. + default: raw + enum: + - raw + - template + file: + type: string + format: binary + description: The file content. + required: + - name + - file responses: '201': description: File uploaded successfully. @@ -440,6 +473,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + '409': + description: > + File already exists with different content. Use ?force=true to + overwrite. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' '500': description: Error uploading file. content: @@ -2032,25 +2073,6 @@ components: required: - total_items - items - FileUploadRequest: - type: object - properties: - name: - type: string - description: The name of the file. - example: nginx.conf - x-oapi-codegen-extra-tags: - validate: required,min=1,max=255 - content: - type: string - format: byte - description: Base64-encoded file content. - example: c2VydmVyIHsgbGlzdGVuIDgwOyB9 - x-oapi-codegen-extra-tags: - validate: required - required: - - name - - content FileInfo: type: object properties: @@ -2066,10 +2088,16 @@ components: type: integer description: File size in bytes. example: 1024 + content_type: + type: string + description: | + How the file should be treated during deploy (raw or template). + example: raw required: - name - sha256 - size + - content_type FileUploadResponse: type: object properties: @@ -2085,10 +2113,23 @@ components: type: integer description: File size in bytes. example: 1024 + changed: + type: boolean + description: > + Whether the file content changed. False when the Object Store + already held an object with the same SHA-256 digest. + example: true + content_type: + type: string + description: | + How the file should be treated during deploy (raw or template). + example: raw required: - name - sha256 - size + - changed + - content_type FileListResponse: type: object properties: @@ -2119,10 +2160,16 @@ components: type: integer description: File size in bytes. example: 1024 + content_type: + type: string + description: | + How the file should be treated during deploy (raw or template). + example: raw required: - name - sha256 - size + - content_type FileDeleteResponse: type: object properties: diff --git a/pkg/osapi/gen/cfg.yaml b/pkg/osapi/gen/cfg.yaml index da04b9d..692fbab 100644 --- a/pkg/osapi/gen/cfg.yaml +++ b/pkg/osapi/gen/cfg.yaml @@ -4,3 +4,5 @@ output: client.gen.go generate: models: true client: true +output-options: + skip-prune: true diff --git a/pkg/osapi/gen/client.gen.go b/pkg/osapi/gen/client.gen.go index 1d82de2..b90f95d 100644 --- a/pkg/osapi/gen/client.gen.go +++ b/pkg/osapi/gen/client.gen.go @@ -43,8 +43,8 @@ const ( // Defines values for FileDeployRequestContentType. const ( - Raw FileDeployRequestContentType = "raw" - Template FileDeployRequestContentType = "template" + FileDeployRequestContentTypeRaw FileDeployRequestContentType = "raw" + FileDeployRequestContentTypeTemplate FileDeployRequestContentType = "template" ) // Defines values for NetworkInterfaceResponseFamily. @@ -61,6 +61,12 @@ const ( MemoryPressure NodeConditionType = "MemoryPressure" ) +// Defines values for PostFileMultipartBodyContentType. +const ( + PostFileMultipartBodyContentTypeRaw PostFileMultipartBodyContentType = "raw" + PostFileMultipartBodyContentTypeTemplate PostFileMultipartBodyContentType = "template" +) + // Defines values for GetJobParamsStatus. const ( GetJobParamsStatusCompleted GetJobParamsStatus = "completed" @@ -472,6 +478,9 @@ type FileDeployResponse struct { // FileInfo defines model for FileInfo. type FileInfo struct { + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the file. Name string `json:"name"` @@ -484,6 +493,9 @@ type FileInfo struct { // FileInfoResponse defines model for FileInfoResponse. type FileInfoResponse struct { + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the file. Name string `json:"name"` @@ -527,17 +539,14 @@ type FileStatusResponse struct { Status string `json:"status"` } -// FileUploadRequest defines model for FileUploadRequest. -type FileUploadRequest struct { - // Content Base64-encoded file content. - Content []byte `json:"content" validate:"required"` - - // Name The name of the file. - Name string `json:"name" validate:"required,min=1,max=255"` -} - // FileUploadResponse defines model for FileUploadResponse. type FileUploadResponse struct { + // Changed Whether the file content changed. False when the Object Store already held an object with the same SHA-256 digest. + Changed bool `json:"changed"` + + // ContentType How the file should be treated during deploy (raw or template). + ContentType string `json:"content_type"` + // Name The name of the uploaded file. Name string `json:"name"` @@ -1015,6 +1024,27 @@ type GetAuditLogsParams struct { Offset *int `form:"offset,omitempty" json:"offset,omitempty" validate:"omitempty,min=0"` } +// PostFileMultipartBody defines parameters for PostFile. +type PostFileMultipartBody struct { + // ContentType How the file should be treated during deploy. "raw" writes bytes as-is; "template" renders with Go text/template and agent facts. + ContentType *PostFileMultipartBodyContentType `json:"content_type,omitempty"` + + // File The file content. + File openapi_types.File `json:"file"` + + // Name The name of the file in the Object Store. + Name string `json:"name"` +} + +// PostFileParams defines parameters for PostFile. +type PostFileParams struct { + // Force When true, bypass the digest check and always write the file. Returns changed=true regardless of whether the content differs from the existing object. + Force *bool `form:"force,omitempty" json:"force,omitempty"` +} + +// PostFileMultipartBodyContentType defines parameters for PostFile. +type PostFileMultipartBodyContentType string + // GetJobParams defines parameters for GetJob. type GetJobParams struct { // Status Filter jobs by status. @@ -1036,8 +1066,8 @@ type PostNodeNetworkPingJSONBody struct { Address string `json:"address" validate:"required,ip_or_fact"` } -// PostFileJSONRequestBody defines body for PostFile for application/json ContentType. -type PostFileJSONRequestBody = FileUploadRequest +// PostFileMultipartRequestBody defines body for PostFile for multipart/form-data ContentType. +type PostFileMultipartRequestBody PostFileMultipartBody // PostJobJSONRequestBody defines body for PostJob for application/json ContentType. type PostJobJSONRequestBody = CreateJobRequest @@ -1161,9 +1191,7 @@ type ClientInterface interface { GetFiles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // PostFileWithBody request with any body - PostFileWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - PostFile(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostFileWithBody(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // DeleteFileByName request DeleteFileByName(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1356,20 +1384,8 @@ func (c *Client) GetFiles(ctx context.Context, reqEditors ...RequestEditorFn) (* return c.Client.Do(req) } -func (c *Client) PostFileWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFileRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) PostFile(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostFileRequest(c.Server, body) +func (c *Client) PostFileWithBody(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostFileRequestWithBody(c.Server, params, contentType, body) if err != nil { return nil, err } @@ -2070,19 +2086,8 @@ func NewGetFilesRequest(server string) (*http.Request, error) { return req, nil } -// NewPostFileRequest calls the generic PostFile builder with application/json body -func NewPostFileRequest(server string, body PostFileJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostFileRequestWithBody(server, "application/json", bodyReader) -} - // NewPostFileRequestWithBody generates requests for PostFile with any type of body -func NewPostFileRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +func NewPostFileRequestWithBody(server string, params *PostFileParams, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -2100,6 +2105,28 @@ func NewPostFileRequestWithBody(server string, contentType string, body io.Reade return nil, err } + if params != nil { + queryValues := queryURL.Query() + + if params.Force != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "force", runtime.ParamLocationQuery, *params.Force); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err @@ -3178,9 +3205,7 @@ type ClientWithResponsesInterface interface { GetFilesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFilesResponse, error) // PostFileWithBodyWithResponse request with any body - PostFileWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) - - PostFileWithResponse(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileResponse, error) + PostFileWithBodyWithResponse(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) // DeleteFileByNameWithResponse request DeleteFileByNameWithResponse(ctx context.Context, name FileName, reqEditors ...RequestEditorFn) (*DeleteFileByNameResponse, error) @@ -3493,6 +3518,7 @@ type PostFileResponse struct { JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse + JSON409 *ErrorResponse JSON500 *ErrorResponse } @@ -4252,16 +4278,8 @@ func (c *ClientWithResponses) GetFilesWithResponse(ctx context.Context, reqEdito } // PostFileWithBodyWithResponse request with arbitrary body returning *PostFileResponse -func (c *ClientWithResponses) PostFileWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) { - rsp, err := c.PostFileWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePostFileResponse(rsp) -} - -func (c *ClientWithResponses) PostFileWithResponse(ctx context.Context, body PostFileJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileResponse, error) { - rsp, err := c.PostFile(ctx, body, reqEditors...) +func (c *ClientWithResponses) PostFileWithBodyWithResponse(ctx context.Context, params *PostFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileResponse, error) { + rsp, err := c.PostFileWithBody(ctx, params, contentType, body, reqEditors...) if err != nil { return nil, err } @@ -5023,6 +5041,13 @@ func ParsePostFileResponse(rsp *http.Response) (*PostFileResponse, error) { } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest ErrorResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON409 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest ErrorResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil {