Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: implement API calls for GET /v1/jamf-connect/config-profiles and PUT /v1/jamf-connect/config-profiles/{id} #472

Open
ecanault opened this issue Nov 25, 2024 · 5 comments

Comments

@ecanault
Copy link

Hi,

Implementation of API calls for GET /v1/jamf-connect/config-profiles and PUT /v1/jamf-connect/config-profiles/{id} are missing in the provider to be able to manage with terraform the deployment and the updates of Jamf Connect.

Is it possible to add this?

Thanks,
Emmanuel

@ShocOne
Copy link
Contributor

ShocOne commented Nov 26, 2024

Hi @ecanault , i have updated the SDK based on the available documentation to support jamf connect. However, i do not have jamf connect as part of my lab environment, so i don't have a direct way to test currently.

Before i implement any changes to the provider for this, i need some testing of the SDK functionality first.

There are some examples here - https://github.com/deploymenttheory/go-api-sdk-jamfpro/tree/main/examples/jamf_connect . could you potentially run this in your test environment please ?

Many thanks

@ecanault
Copy link
Author

Hi,

I never played with golang 😬 (shame on me!) but the result of my first try is:

[...]
{"level":"info","ts":1732885758.080389,"caller":"httpclient/request.go:226","msg":"GET request successful at https://devnetopie.jamfcloud.com/api/v1/jamf-connect/config-profiles?page=0&page-size=200"}
{"level":"debug","ts":1732885758.080485,"caller":"response/success.go:43","msg":"Raw HTTP Response","Body":"{\n  \"totalCount\" : 4,\n  \"results\" : [ {\n    \"uuid\" : \"018ec186-bdab-48a5-8060-5f6f6e381484\",\n    \"profileId\" : 281,\n    \"profileName\" : \"cp_jamfconnect_menubar\",\n    \"scopeDescription\" : \"All computers, smcg_all_inventory excluded\",\n    \"siteId\" : \"-1\",\n    \"version\" : \"\",\n    \"autoDeploymentType\" : \"NONE\"\n  }, {\n    \"uuid\" : \"431d1ea0-b7f1-41ca-b18c-77f325285b8a\",\n    \"profileId\" : 285,\n    \"profileName\" : \"cp_jamfconnect_login_for_setup\",\n    \"scopeDescription\" : \"smcg_all_setup\",\n    \"siteId\" : \"-1\",\n    \"version\" : \"\",\n    \"autoDeploymentType\" : \"NONE\"\n  }, {\n    \"uuid\" : \"8840d136-68e5-4521-968b-819731464ba4\",\n    \"profileId\" : 282,\n    \"profileName\" : \"cp_jamfconnect_login_for_production\",\n    \"scopeDescription\" : \"smcg_all_production\",\n    \"siteId\" : \"-1\",\n    \"version\" : \"\",\n    \"autoDeploymentType\" : \"NONE\"\n  }, {\n    \"uuid\" : \"b0d692ae-729d-4d1c-bbbd-8a1490f4f043\",\n    \"profileId\" : 294,\n    \"profileName\" : \"cp_jamfconnect_license\",\n    \"scopeDescription\" : \"All computers, smcg_all_inventory excluded\",\n    \"siteId\" : \"-1\",\n    \"version\" : \"\",\n    \"autoDeploymentType\" : \"NONE\"\n  } ]\n}"}
{"level":"info","ts":1732885758.080865,"caller":"response/success.go:84","msg":"Successfully unmarshalled JSON response{content type 15 0 application/json <nil>}"}
2024/11/29 14:09:18 Error fetching Jamf Connect config profiles: failed to map interfaced jamf connect config profile to structs, error: 1 error(s) decoding:

* 'ProfileID' expected type 'string', got unconvertible type 'float64', value: '281'
exit status 1

It seems that the API call returns correctly the datas, but theres an ssue regarding the ProfileID type: it is declared as a string in jamfproapi_jamf_connect.go (line 56) and a number (the Jamf Pro ID of the profile) is returned?

Regards,
Emmanuel

@ecanault
Copy link
Author

I filled up a bug report here deploymenttheory/go-api-sdk-jamfpro#587 if necessary.

@ecanault
Copy link
Author

ecanault commented Nov 29, 2024

I also had a look at UpdateJamfConnectConfigProfileByID.go example: no problem with this one.

But GetJamfConnectSettings.go produces an error; by the way a direct call to the API returns a 204 error for me, despite the fact I'm using an admin account for basic authentication or a ClientID with required privileges.

{"level":"info","ts":1732895164.650843,"caller":"httpclient/request.go:226","msg":"GET request successful at https://devnetopie.jamfcloud.com/api/v1/jamf-connect"}
{"level":"debug","ts":1732895164.6509042,"caller":"response/success.go:43","msg":"Raw HTTP Response","Body":""}
{"level":"error","ts":1732895164.651032,"caller":"response/success.go:63","msg":"Unmarshal error","content type":"","error":"unexpected MIME type: ","stacktrace":"github.com/deploymenttheory/go-api-http-client/response.HandleAPISuccessResponse\n\t/Users/ecanault/go/pkg/mod/github.com/deploymenttheory/[email protected]/response/success.go:63\ngithub.com/deploymenttheory/go-api-http-client/httpclient.(*Client).requestNoRetries\n\t/Users/ecanault/go/pkg/mod/github.com/deploymenttheory/[email protected]/httpclient/request.go:228\ngithub.com/deploymenttheory/go-api-http-client/httpclient.(*Client).DoRequest\n\t/Users/ecanault/go/pkg/mod/github.com/deploymenttheory/[email protected]/httpclient/request.go:64\ngithub.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro.(*Client).GetJamfConnectSettings\n\t/Users/ecanault/Documents/GitLab-Netopie/terraform_POC/go_tests/go-api-sdk-jamfpro-1.14.0/sdk/jamfpro/jamfproapi_jamf_connect.go:81\nmain.main\n\t/Users/ecanault/Documents/GitLab-Netopie/terraform_POC/go_tests/main.go:36\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:272"}
2024/11/29 16:46:04 Error fetching Jamf Connect settings: failed to get jamf connect settings, error: unexpected MIME type: 
exit status 1

@ShocOne
Copy link
Contributor

ShocOne commented Dec 10, 2024

Quick update, i have got a license from jamf for my lab to start the jamf connect work. I'll be starting the work next week. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants