[Feedback] Handling Jamf Pro Versioning in the SDK
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách theo dõi quá trình khởi tạo JamfProClient và SessionConfig, sau đó xem xét cách endpoint jamf-pro-version và module warnings của Python sẽ phù hợp với vòng đời của client. Công việc được xem là hoàn tất khi đã thống nhất thiết kế cấu hình, mô hình siêu dữ liệu API, hành vi cảnh báo đối với các phiên bản tối thiểu, không còn được hỗ trợ và tối đa, cùng tài liệu về việc thu thập cảnh báo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
During the JNUC presentation a question was raised about SDK compatibility with different versions of Jamf Pro as APIs are added, deprecated, and removed. This proposal outlines an approach to alerting developers to when they are using an API that may not be compatible with the version of Jamf Pro they've connected a client to, or if they are using an API that has been deprecated.
Current
Currently all API changes have to be referenced from release notes for each Jamf Pro version. The SDK does not include any mechanisms for alerting developers.
Proposed
The SDK should contain metadata about the API methods that have been added that track the version they were added (minimum), if they are deprecated (a true/false flag), and the version they were removed (maximum).
Client Jamf Pro Version
The SDK would need to know the version of Jamf Pro during client init. This could be provided statically, automatically retrieved from the Pro API jamf-pro-version endpoint, or ignored.
As a part of this proposal the default behavior on client init would include an authenticated call to GET jamf-pro-version. This behavior may not be desirable as it requires authentication which means the client is making two network calls immediately.
Passing the version string on init would bypass this. Choosing to ignore the client version through an argument would then disable ALL of the warning system.
This new option should be added to the client config.
from jamf_pro_sdk import JamfProClient, BasicAuthProvider, SessionConfig
config = SessionConfig()
config.server_version = "10.50"
client.server_version = None # <-- Default, triggers call to jamf-pro-version API
client.ignore_server_version = True # <-- Default is False, setting True will disable all Jamf Pro version warnings
client = JamfProClient(
server="jamf.my.org",
credentials=BasicAuthProvider("oscar", "j@mf1234!"),
config=config
)
API Warnings
If the client is instantiated with a version then all endpoints would need to emit WARNINGS when a method is being used that:
- Has a minimum version ABOVE the client's Jamf Pro version.
- Has been flagged as deprecated and should be migrated off of.
- Has a maximum version LOWER than the client's Jamf Pro version.
This will be handled using Python's warnings module. Each unique warning will only appear once. The loggers can be configured to capture warning messages so developers will know when a particular client is making requests that meet one of the conditions above.
import logging
import warnings
from jamf_pro_sdk import logger_quick_setup
logger_quick_setup() # Updated to include capturing warnings
# logging.captureWarnings(True)
# warnings_logger = logging.getLogger("py.warnings")
# warnings_logger.addHandler(handler)
warnings.warn("This API is deprecated as of version 10.50 and will be removed in a future.")
# 2023-10-05 10:30:04,746 py.warnings WARNING MainThread <stdin>:1: UserWarning: This API is deprecated as of Jamf Pro 10.50 and will be removed in a future version.
When a deprecation flag is set there should be included a message for which API method the developer should migrate to using (if one exists). This migration message should carry forward for case 3.
The SDK will NOT throw version exceptions as a part of this warnings system. The client will return 404 errors if the API does not exist and the warning message can be captured in logs if the developer follows guidance in the documentation.
- Ngôn ngữ chính
- Python
- Star
- 69
- Fork
- 16
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của macadmins/jamf-pro-sdk-python
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
[Bug] preview/mdm/commands deprecated & removed which breaks send_mdm_command_preview() method.Có thể làm lại được @liquidz00 đã nhận 427 ngày trước và không có pull request nào đang mở. Đang mởbug
macadmins/jamf-pro-sdk-python#68 · 1 bình luận · 1 người được giao ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
macadmins/jamf-pro-sdk-python#55 · 1 bình luận ·
-
[Feature Request] Pass a model to the Classic and Pro API request methods as the return type.Có thể làm lại được @liquidz00 đã nhận 481 ngày trước và không có pull request nào đang mở. Đang mởenhancement
macadmins/jamf-pro-sdk-python#52 · 1 bình luận · 2 người được giao ·
-
[Feature Request] Option to parse XML from Classic API endpointsCó thể làm lại được @brysontyrrell đã nhận 1051 ngày trước và không có pull request nào đang mở. Đang mởenhancement feedback
macadmins/jamf-pro-sdk-python#33 · 4 bình luận · 1 người được giao ·
Tất cả issue của macadmins/jamf-pro-sdk-python
Issue tương tự
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
WingedGuardian/GENesis-AGI#3375 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
githubnext/gh-aw-workshop#4601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
approved Good First Issue scope: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
hiero-ledger/hiero-sdk-python#2730 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày