Class ApiClient


  • public class ApiClient
    extends java.lang.Object
    HTTP engine for the generated Pulumi Cloud SDK, built on the JDK HttpClient. Generated *Api methods build an ApiRequest and hand it to call(ApiRequest, TypeReference); this class substitutes path parameters, encodes the query string, applies authentication and headers, serializes the body, performs the request, and deserializes the 2xx response into the requested type. Non-2xx responses and transport/serialization failures surface as ApiException.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void call​(ApiRequest request)
      Perform a request whose response body is ignored (void operations).
      <T> T call​(ApiRequest request, com.fasterxml.jackson.core.type.TypeReference<T> responseType)
      Perform a request and deserialize the 2xx response into responseType.
      <T,​H>
      ResponseWithHeaders<T,​H>
      callWithHeaders​(ApiRequest request, com.fasterxml.jackson.core.type.TypeReference<T> responseType, java.util.function.Function<java.net.http.HttpHeaders,​H> parseHeaders)
      Perform a request and return both the deserialized 2xx response body and the response's headers, converted by parseHeaders — for operations whose response declares typed response headers.
      <H> H callWithHeadersOnly​(ApiRequest request, java.util.function.Function<java.net.http.HttpHeaders,​H> parseHeaders)
      Perform a request and return just the response's headers, converted by parseHeaders — for a no-body (e.g.
      ApiClientConfiguration getConfiguration()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApiClient

        public ApiClient()
      • ApiClient

        public ApiClient​(ApiClientConfiguration configuration,
                         java.net.http.HttpClient http)
        Use a caller-supplied HttpClient (custom proxy, executor, or a test transport).
    • Method Detail

      • call

        public void call​(ApiRequest request)
        Perform a request whose response body is ignored (void operations).
      • call

        public <T> T call​(ApiRequest request,
                          com.fasterxml.jackson.core.type.TypeReference<T> responseType)
        Perform a request and deserialize the 2xx response into responseType. When responseType is byte[] or String the raw body is returned without JSON parsing; a null type (or a 204 / empty body) returns null.
      • callWithHeaders

        public <T,​H> ResponseWithHeaders<T,​H> callWithHeaders​(ApiRequest request,
                                                                          com.fasterxml.jackson.core.type.TypeReference<T> responseType,
                                                                          java.util.function.Function<java.net.http.HttpHeaders,​H> parseHeaders)
        Perform a request and return both the deserialized 2xx response body and the response's headers, converted by parseHeaders — for operations whose response declares typed response headers. Kept as its own method (duplicating call(ApiRequest, TypeReference)'s body via executeWithHeaders(com.pulumi.cloud.sdk.ApiRequest, com.fasterxml.jackson.core.type.TypeReference<T>)) rather than added as an optional code path on call, so every other generated method's call site is untouched.
      • callWithHeadersOnly

        public <H> H callWithHeadersOnly​(ApiRequest request,
                                         java.util.function.Function<java.net.http.HttpHeaders,​H> parseHeaders)
        Perform a request and return just the response's headers, converted by parseHeaders — for a no-body (e.g. 204) operation that still carries typed response headers.