Skip to content

Commit

Permalink
Update api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sapnajainEntrust authored Nov 15, 2023
1 parent 419e08a commit 58b0e04
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions plugins/module_utils/entrust_cagw/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, error):
self.errors = [to_native(err.get("message")) for err in error.get("errors", {})]
self.message = to_native(" ".join(self.errors))


def generate_docstring(operation_spec):
"""Generate a docstring for an operation defined in operation_spec (swagger)"""
# Description of the operation
Expand Down Expand Up @@ -121,14 +122,19 @@ def __init__(self, session, uri, method, parameters=None):
self.parameters = {}
else:
self.parameters = parameters
self.url = "{scheme}://{host}:{port}{base_path}{uri}".format(scheme="https", host=("example.com"), port=("443"), base_path=session._spec.get("basePath"), uri=uri)
self.url = "{scheme}://{host}:{port}{base_path}{uri}".format(scheme="https", host=("example.com"),
port=("443"),
base_path=session._spec.get("basePath"), uri=uri)

def restmethod(self, *args, **kwargs):
"""Do the hard work of making the request here"""
validate_certs_val = kwargs.get("validate_certs", True)
host = kwargs.get("host", None)
port = kwargs.get("port", None)
url = "{scheme}://{host}:{port}{base_path}{uri}".format(scheme="https", host=host, port=port, base_path=self.session._spec.get("basePath"), uri=self.uri)
url = "{scheme}://{host}:{port}{base_path}{uri}".format(scheme="https",
host=host, port=port,
base_path=self.session._spec.get("basePath"),
uri=self.uri)
# gather named path parameters and do substitution on the URL
if self.parameters:
path_parameters = {}
Expand Down Expand Up @@ -257,7 +263,6 @@ def _set_config(self, name, **kwargs):
if self._config is None:
raise SessionConfigurationException(to_native("No Configuration Found."))


# set up client certificate if passed (support all-in one or cert + key)
cagw_api_cert = self.get_config("cagw_api_cert")
cagw_api_cert_key = self.get_config("cagw_api_cert_key")
Expand Down Expand Up @@ -335,10 +340,6 @@ def CAGWClient(cagw_api_cert=None, cagw_api_cert_key=None, cagw_api_specificatio
if not YAML_FOUND:
raise SessionConfigurationException(missing_required_lib("PyYAML"), exception=YAML_IMP_ERR)

#if cagw_api_specification_path is None:
# cagw_api_specification_path = "https://cloud.entrust.net/EntrustCloud/documentation/cms-api-2.1.0.yaml"

# Not functionally necessary with current uses of this module_util, but better to be explicit for future use cases
cagw_api_cert_key = to_text(cagw_api_cert_key)
cagw_api_specification_path = to_text(cagw_api_specification_path)

Expand Down

0 comments on commit 58b0e04

Please sign in to comment.