Skip to content

Commit

Permalink
Python SDK changes to enable experimental APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-mairose-sp committed Jul 12, 2024
1 parent 4a7b682 commit c8b7e5f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ target/
.ipynb_checkpoints

config.json
api-specs/
api-specs/
test.py
3 changes: 3 additions & 0 deletions sailpoint/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def __init__(self, configurationParams: ConfigurationParams = None) -> None:
if self.access_token == None:
self.access_token = self.get_access_token(url, self.client_id, self.client_secret)


self.experimental = False

self.temp_folder_path = None
"""Temp file folder for downloading files
"""
Expand Down
3 changes: 3 additions & 0 deletions sdk-resources/postscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const fixFiles = function (myArray) {
if (line.includes("from sailpoint.beta.models.dict[str,_object_export_import_options] import Dict[str, ObjectExportImportOptions]")) {
fileOut.push(line.replaceAll("from sailpoint.beta.models.dict[str,_object_export_import_options] import Dict[str, ObjectExportImportOptions]", ""));
madeChange = true;
} else if (line.includes("from sailpoint.v2024.models.dict[str,_object_export_import_options] import Dict[str, ObjectExportImportOptions]")) {
fileOut.push(line.replaceAll("from sailpoint.v2024.models.dict[str,_object_export_import_options] import Dict[str, ObjectExportImportOptions]", ""));
madeChange = true;
} else {
fileOut.push(line);
}
Expand Down
20 changes: 15 additions & 5 deletions sdk-resources/resources/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ from {{packageName}}.exceptions import (
ServiceException
)

class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'


class ApiClient:
"""Generic API client for OpenAPI client library builds.
Expand Down Expand Up @@ -191,13 +202,12 @@ class ApiClient:
# Add Authentication header to request
header_params['Authorization'] = self.configuration.access_token

if self.configuration.experimental and 'X-SailPoint-Experimental' in header_params:
print("TESTING")
print(f"{bcolors.WARNING}Warning: No active frommets remain. Continue?{bcolors.ENDC}")
if not self.configuration.experimental and 'X-SailPoint-Experimental' in header_params:
del header_params['X-SailPoint-Experimental']
print(f"{bcolors.WARNING}Warning: You are using Experimental APIs. Set configuration.experimental = True to enable these APIs in the SDK.{bcolors.ENDC}")
pass
elif self.configuration.experimental == True:
print(f"{bcolors.WARNING}Warning: No active frommets remain. Continue?{bcolors.ENDC}")
#del header_params['X-SailPoint-Experimental']
print(f"{bcolors.WARNING}Warning: You are using Experimental APIs{bcolors.ENDC}")

# path parameters
if path_params:
Expand Down
7 changes: 7 additions & 0 deletions sdk-resources/resources/partial_api_args.mustache
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
(
self,
{{#allParams}}
{{^isHeaderParam}}
{{paramName}}: {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}},
{{/isHeaderParam}}
{{/allParams}}
{{#allParams}}
{{#isHeaderParam}}
{{paramName}}: {{{vendorExtensions.x-py-typing}}}{{#required}}{{#isHeaderParam}} = {{{defaultValue}}}{{/isHeaderParam}}{{/required}}{{^required}} = None{{/required}},
{{/isHeaderParam}}
{{/allParams}}
_request_timeout: Union[
None,
Expand Down

0 comments on commit c8b7e5f

Please sign in to comment.