Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions .github/workflows/main_pr_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ jobs:
- name: Tests
run: make test

exp-integration-tests:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'

- name: Install
run: make install

- name: Run Integration Tests
run: make test-all
env:
JAMF_PRO_HOST: ${{ vars.JAMF_PRO_HOST }}
JAMF_PRO_CLIENT_ID: ${{ vars.JAMF_PRO_CLIENT_ID }}
JAMF_PRO_CLIENT_SECRET: ${{ vars.JAMF_PRO_CLIENT_SECRET }}
# exp-integration-tests:
# continue-on-error: true
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.9'
# cache: 'pip'

# - name: Install
# run: make install

# - name: Run Integration Tests
# run: make test-all
# env:
# JAMF_PRO_HOST: ${{ vars.JAMF_PRO_HOST }}
# JAMF_PRO_CLIENT_ID: ${{ vars.JAMF_PRO_CLIENT_ID }}
# JAMF_PRO_CLIENT_SECRET: ${{ vars.JAMF_PRO_CLIENT_SECRET }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
A client library for the Jamf Pro APIs and webhooks.

```python
from jamf_pro_sdk import JamfProClient, BasicAuthProvider
from jamf_pro_sdk import JamfProClient, ApiClientCredentialsProvider

client = JamfProClient(
server="dummy.jamfcloud.com",
credentials=BasicAuthProvider("username", "password")
credentials=ApiClientCredentialsProvider("client_id", "client_secret")
)

all_computers = client.pro_api.get_computer_inventory_v1()
Expand Down
Binary file added docs/_static/api-keychain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/user-keychain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
pygments_style = "default"
pygments_dark_style = "material"

# html_static_path = ["_static"]
html_static_path = ["_static"]

html_theme = "furo"

Expand Down
39 changes: 26 additions & 13 deletions docs/reference/credentials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,43 @@
Credentials Providers
=====================

API Client Providers
--------------------
The Jamf Pro SDK has two primary types of credential providers: **API Client Credentials** and **User Credentials**.

These credentials providers use Jamf Pro API clients for API authentication.
API Client Credentials Provider
-------------------------------

Use Jamf Pro `API clients <https://developer.jamf.com/jamf-pro/docs/client-credentials>`_ for API authentication.

.. autoclass:: jamf_pro_sdk.clients.auth.ApiClientCredentialsProvider
:members:

Basic Auth Providers
--------------------
User Credentials Provider
-------------------------

These credentials providers use a username and password for API authentication.
User credential providers use a username and password for API authentication.

.. autoclass:: jamf_pro_sdk.clients.auth.BasicAuthProvider
.. autoclass:: jamf_pro_sdk.clients.auth.UserCredentialsProvider
:members:

.. autoclass:: jamf_pro_sdk.clients.auth.PromptForCredentials
:members:
Utilities for Credential Providers
----------------------------------

.. autoclass:: jamf_pro_sdk.clients.auth.LoadFromKeychain
:members:
These functions return an instantiated credentials provider of the specified type.

.. autoclass:: jamf_pro_sdk.clients.auth.LoadFromAwsSecretsManager
:members:
Prompt for Credentials
^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: jamf_pro_sdk.clients.auth.prompt_for_credentials

Load from AWS Secrets Manager
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: jamf_pro_sdk.clients.auth.load_from_aws_secrets_manager

Load from Keychain
^^^^^^^^^^^^^^^^^^

.. autofunction:: jamf_pro_sdk.clients.auth.load_from_keychain

Access Token
------------
Expand Down
10 changes: 8 additions & 2 deletions docs/user/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ A :class:`~jamf_pro_sdk.clients.auth.CredentialsProvider` is an interface for th

The following example does not accept a username or password and retrieves a token from a DynamoDB table in an AWS account (it is assumed an external process is managing this table entry).

.. code-block:: python

>>> import boto3
>>> from jamf_pro_sdk.clients.auth import CredentialsProvider
>>> from jamf_pro_sdk.models.client import AccessToken
Expand Down Expand Up @@ -35,13 +37,17 @@ The SDK's clients provide curated methods to a large number of Jamf Pro APIs. No

Here is the built-in method for getting a computer from the Classic API:

.. code-block:: python

>>> computer = client.classic_api.get_computer_by_id(1)
>>> type(computer)
<class 'jamf_pro_sdk.models.classic.computers.Computer'>
>>>

The same operation can be performed by using the :meth:`~jamf_pro_sdk.clients.JamfProClient.classic_api_request` method directly:

.. code-block:: python

>>> response = client.classic_api_request(method='get', resource_path='computers/id/1')
>>> type(response)
<class 'requests.models.Response'>
Expand All @@ -59,12 +65,12 @@ Here is a code example using :meth:`~jamf_pro_sdk.clients.JamfProClient.concurre

.. code-block:: python

from jamf_pro_sdk import JamfProClient, BasicAuthProvider
from jamf_pro_sdk import JamfProClient, ApiClientCredentialsProvider

# The default concurrency setting is 10.
client = JamfProClient(
server="jamf.my.org",
credentials=BasicAuthProvider("oscar", "j@mf1234!")
credentials=ApiClientCredentialsProvider("client_id", "client_secret")
)

# Get a list of all computers, and then their IDs.
Expand Down
4 changes: 2 additions & 2 deletions docs/user/classic_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ Assume this client has been instantiated for the examples shown below.

.. code-block:: python

>>> from jamf_pro_sdk import JamfProClient, BasicAuthProvider
>>> from jamf_pro_sdk import JamfProClient, ApiClientCredentialsProvider
>>> client = JamfProClient(
... server="jamf.my.org",
... credentials=BasicAuthProvider("oscar", "j@mf1234!")
... credentials=ApiClientCredentialsProvider("client_id", "client_secret")
... )
>>>

Expand Down
Loading