Skip to content

Commit 5cb0eb3

Browse files
authored
Merge pull request #726 from deploymenttheory/dev-bug-package-upload
feat: removed mandatory package timeout, made it adjustable via funcs
2 parents 80d976e + d13c182 commit 5cb0eb3

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.23.6
66

77
// Deploymenttheory
88
require (
9-
github.com/deploymenttheory/go-api-http-client v0.4.0
9+
github.com/deploymenttheory/go-api-http-client v0.4.1
1010
github.com/deploymenttheory/go-api-http-client-integrations v0.0.13
1111
)
1212

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
4242
github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
4343
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4444
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
45-
github.com/deploymenttheory/go-api-http-client v0.4.0 h1:YSgt8Gx3LzmSh5Pjt7zJ6ilAuTCmsy9Wzo2V4NajXmw=
46-
github.com/deploymenttheory/go-api-http-client v0.4.0/go.mod h1:wJIFm4S1jj4io+G3E3pxyhmHQXXiZ5ft0xZxorsWOSo=
45+
github.com/deploymenttheory/go-api-http-client v0.4.1 h1:NPvlOs2XT/QbF3r1LbKq7Wgzab6dt517hiysihRVjK0=
46+
github.com/deploymenttheory/go-api-http-client v0.4.1/go.mod h1:wJIFm4S1jj4io+G3E3pxyhmHQXXiZ5ft0xZxorsWOSo=
4747
github.com/deploymenttheory/go-api-http-client-integrations v0.0.13 h1:zqGfWtdtRpYaCcsje2//Hpha1eSO0vblbSVvRr8ax7k=
4848
github.com/deploymenttheory/go-api-http-client-integrations v0.0.13/go.mod h1:m9XNzP2pNsw8eg+Bdqjrnmn/QK1vrGsDDboabc//IdQ=
4949
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=

sdk/jamfpro/api_client_builders.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func BuildClient(config *ConfigContainer) (*Client, error) {
9090
MaxRetryAttempts: config.MaxRetryAttempts,
9191
MaxConcurrentRequests: config.MaxConcurrentRequests,
9292
EnableDynamicRateLimiting: config.EnableDynamicRateLimiting,
93-
CustomTimeout: time.Duration(config.CustomTimeout) * time.Second,
93+
Timeout: time.Duration(config.CustomTimeout) * time.Second,
9494
TokenRefreshBufferPeriod: time.Duration(config.TokenRefreshBufferPeriod) * time.Second,
9595
TotalRetryDuration: time.Duration(config.TotalRetryDuration) * time.Second,
9696
MaxRedirects: config.MaxRedirects,

sdk/jamfpro/jamfproapi_packages.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import (
1010
"fmt"
1111
"net/http"
1212
"net/url"
13-
"time"
1413
)
1514

1615
// URI for Packages in the Jamf Pro Classic API
1716
const uriPackages = "/api/v1/packages"
18-
const packagesHttpTimeout = 10 * time.Minute
1917

2018
// ResponsePackagesList struct to capture the JSON response for packages list
2119
type ResponsePackagesList struct {
@@ -276,9 +274,6 @@ func (c *Client) CreatePackage(packageMetadata ResourcePackage) (*ResponsePackag
276274
func (c *Client) UploadPackage(id string, filePaths []string) (*ResponsePackageCreatedAndUpdated, error) {
277275
endpoint := fmt.Sprintf("%s/%s/upload", uriPackages, id)
278276

279-
c.HTTP.ModifyHttpTimeout(packagesHttpTimeout)
280-
defer c.HTTP.ResetTimeout()
281-
282277
// Create a map for the files to be uploaded
283278
files := map[string][]string{
284279
"file": filePaths,

0 commit comments

Comments
 (0)