pulp_glue.common.openapi¶
pulp_glue.common.openapi
¶
OpenAPI(base_url: str, doc_path: str, headers: CIMultiDict[str] | CIMultiDictProxy[str] | None = None, auth_provider: AuthProviderBase | None = None, cert: str | None = None, key: str | None = None, verify_ssl: bool | str | None = True, refresh_cache: bool = False, dry_run: bool = False, debug_callback: t.Callable[[int, str], t.Any] | None = None, user_agent: str | None = None, cid: str | None = None, validate_certs: bool | None = None, safe_calls_only: bool | None = None, patch_api_hook: t.Callable[[t.Any], t.Any] | None = None)
¶
The abstraction Layer to interact with a server providing an openapi v3 specification.
Parameters:
-
base_url(str) –The base URL inlcuding the HTTP scheme, hostname and optional subpaths of the served api.
-
doc_path(str) –Path of the json api doc schema relative to the
base_url. -
headers(CIMultiDict[str] | CIMultiDictProxy[str] | None, default:None) –Dictionary of additional request headers.
-
auth_provider(AuthProviderBase | None, default:None) –Object that can be questioned for credentials according to the api spec.
-
cert(str | None, default:None) –Client certificate used for auth.
-
key(str | None, default:None) –Matching key for
certif not already included. -
verify_ssl(bool | str | None, default:True) –Whether to check server TLS certificates agains a CA.
-
refresh_cache(bool, default:False) –Whether to fetch the api doc regardless.
-
dry_run(bool, default:False) –Flag to disallow issuing POST, PUT, PATCH or DELETE calls.
-
debug_callback(Callable[[int, str], Any] | None, default:None) –Callback that will be called with strings useful for logging or debugging.
-
user_agent(str | None, default:None) –String to use in the User-Agent header.
-
cid(str | None, default:None) –Correlation ID to send with all requests.
-
validate_certs(bool | None, default:None) –DEPRECATED use verify_ssl instead.
-
safe_calls_only(bool | None, default:None) –DEPRECATED use dry_run instead.
call(operation_id: str, parameters: dict[str, t.Any] | None = None, body: dict[str, t.Any] | None = None, validate_body: bool = True) -> t.Any
¶
Make a call to the server.
Parameters:
-
operation_id(str) –ID of the operation in the openapi v3 specification.
-
parameters(dict[str, Any] | None, default:None) –Arguments that are to be sent as headers, querystrings or part of the URI.
-
body(dict[str, Any] | None, default:None) –Body payload for POST, PUT, PATCH calls.
-
validate_body(bool, default:True) –Indicate whether the body should be validated.
Returns:
-
Any–The JSON decoded server response if any.
Raises:
-
ValidationError–on failed input validation (no request was sent to the server).
-
OpenAPIError–on failures related to the HTTP call made.