-
Notifications
You must be signed in to change notification settings - Fork 36
Support responseTimeout profile property for z/OSMF operations #369
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
Open
aadityasinha-dotcom
wants to merge
24
commits into
zowe:main
Choose a base branch
from
aadityasinha-dotcom:response_timeout
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bbf42b3
Support responseTimeout profile property for z/OSMF operations
aadityasinha-dotcom 9412974
Merge branch 'main' into response_timeout
aadityasinha-dotcom f3285e6
Update src/core/zowe/core_for_zowe_sdk/sdk_api.py
aadityasinha-dotcom 2aa377b
moved the response_timeout in zosmf package and added unit test
aadityasinha-dotcom ebd612a
Merge branch 'main' into response_timeout
zFernand0 1da40ae
Merge branch 'main' into response_timeout
aadityasinha-dotcom e46f89e
Merge branch 'main' into response_timeout
aadityasinha-dotcom fc70e08
same funcitonality in the files.py
aadityasinha-dotcom 683d5e6
added test for file.py
aadityasinha-dotcom 1f95621
fixes
aadityasinha-dotcom 433a077
moved to zos_files_constants
aadityasinha-dotcom 6d8fe6a
Merge branch 'main' into response_timeout
aadityasinha-dotcom cc4db15
fixed lint errors
aadityasinha-dotcom c4e88f1
Merge branch 'main' into response_timeout
aadityasinha-dotcom f77ff42
added changes to remove header from zosmf
aadityasinha-dotcom 345347b
Merge branch 'main' into response_timeout
aadityasinha-dotcom a417f0c
Refactor zos_files_for_zowe_sdk to use BaseFilesApi
t1m0thyj 021c0ea
Add docs string to new api class
t1m0thyj c362795
remove asyncThreshold check and updated changelog
aadityasinha-dotcom de1d45f
fixed changes
aadityasinha-dotcom 8b3ab97
removed else block
aadityasinha-dotcom 86cd785
Merge branch 'main' into response_timeout
aadityasinha-dotcom 1b24743
fixed unit test
aadityasinha-dotcom 76e45ac
Merge branch 'response_timeout' of github.com:aadityasinha-dotcom/zow…
aadityasinha-dotcom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """Zowe Client Python SDK. | ||
|
|
||
| This program and the accompanying materials are made available under the terms of the | ||
| Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
|
|
||
| https://www.eclipse.org/legal/epl-v20.html | ||
|
|
||
| SPDX-License-Identifier: EPL-2.0 | ||
|
|
||
| Copyright Contributors to the Zowe Project. | ||
| """ | ||
|
|
||
| from typing import Any | ||
|
|
||
| from zowe.core_for_zowe_sdk import SdkApi | ||
| from zowe.zos_files_for_zowe_sdk.constants import zos_file_constants | ||
|
|
||
| _MIN_TIMEOUT = zos_file_constants["min_timeout"] | ||
| _MAX_TIMEOUT = zos_file_constants["max_timeout"] | ||
|
|
||
|
|
||
| class BaseFilesApi(SdkApi): | ||
| """ | ||
| Extends the SdkApi class to support headers specific to z/OSMF Files APIs. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| profile : dict[str, Any] | ||
| Profile information in json (dict) format | ||
| log : bool | ||
| Flag to disable logger | ||
| """ | ||
|
|
||
| def __init__(self, profile: dict[str, Any], log: bool = True): | ||
| super().__init__(profile, "/zosmf/restfiles/", logger_name=__name__, log=log) | ||
| self._default_headers["Accept-Encoding"] = "gzip" | ||
| self._set_response_timeout(profile) | ||
|
|
||
| def _set_response_timeout(self, profile: dict[str, Any]): | ||
| if profile.get("X-IBM-Async-Threshold") is not None: | ||
| return | ||
|
|
||
| resp_to = profile.get("responseTimeout") | ||
| if resp_to is not None: | ||
| try: | ||
| resp_to_int = int(resp_to) | ||
| clamped = max(_MIN_TIMEOUT, min(_MAX_TIMEOUT, resp_to_int)) | ||
| if clamped != resp_to_int and hasattr(self, "logger"): | ||
| self.logger.warning( | ||
| f"responseTimeout {resp_to_int} out of range; clamped to {clamped} " | ||
| f"(allowed {_MIN_TIMEOUT}-{_MAX_TIMEOUT})" | ||
| ) | ||
| self._default_headers["X-IBM-Response-Timeout"] = str(clamped) | ||
| except (TypeError, ValueError): | ||
| if hasattr(self, "logger"): | ||
| self.logger.warning("responseTimeout must be an integer between 5 and 600; header not set") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the test failing, please review it☺️