Skip to content

Commit 80d976e

Browse files
authored
Merge pull request #725 from deploymenttheory/dev-timeouts-fix
feat: to latest http client, packages now have a custom timeout
2 parents 425d728 + 8e4a78e commit 80d976e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
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.3.0
9+
github.com/deploymenttheory/go-api-http-client v0.4.0
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.3.0 h1:ld71pjbdLktvC9UfS2QFVpnQccJnjguOg/S2UXohBB4=
46-
github.com/deploymenttheory/go-api-http-client v0.3.0/go.mod h1:wJIFm4S1jj4io+G3E3pxyhmHQXXiZ5ft0xZxorsWOSo=
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=
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/jamfproapi_packages.go

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

1516
// URI for Packages in the Jamf Pro Classic API
1617
const uriPackages = "/api/v1/packages"
18+
const packagesHttpTimeout = 10 * time.Minute
1719

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

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

0 commit comments

Comments
 (0)