Class ApiClient
HTTP engine for the generated Pulumi Cloud SDK, built on
HttpClient. Generated *Api methods build an
ApiRequest and hand it to Call<T>(ApiRequest);
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.
The public API is synchronous, mirroring the Java SDK; requests are
dispatched through the async HttpClient and awaited.
Namespace: Pulumi.Cloud.Sdk
Assembly: Pulumi.Cloud.Sdk.dll
Syntax
public sealed class ApiClient
Constructors
View Source
ApiClient()
Declaration
View Source
ApiClient(ApiClientConfiguration)
Declaration
public ApiClient(ApiClientConfiguration configuration)
Parameters
View Source
ApiClient(ApiClientConfiguration, HttpMessageHandler)
Constructs a client whose transport is the given HttpMessageHandler
instead of the default one — a seam for tests to stub responses (including
response headers) without a real network call. Not used by generated code.
Declaration
public ApiClient(ApiClientConfiguration configuration, HttpMessageHandler handler)
Parameters
Properties
View Source
Configuration
Declaration
public ApiClientConfiguration Configuration { get; }
Property Value
Methods
View Source
Call(ApiRequest)
Perform a request whose response body is ignored (void operations).
Declaration
public void Call(ApiRequest request)
Parameters
View Source
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.
Declaration
public H CallWithHeadersOnly<H>(ApiRequest request, Func<HttpHeaders, H> parseHeaders)
Parameters
Returns
Type Parameters
View Source
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 Execute(ApiRequest, Type)'s body via ExecuteWithHeaders(ApiRequest, Type))
rather than added as an optional code path on Call<T>(ApiRequest),
so every other generated method's call site is untouched.
Declaration
public ResponseWithHeaders<T, H> CallWithHeaders<T, H>(ApiRequest request, Func<HttpHeaders, H> parseHeaders)
Parameters
Returns
Type Parameters
View Source
Call<T>(ApiRequest)
Perform a request and deserialize the 2xx response into T.
When T is byte[] or string the raw body is
returned without JSON parsing; a 204 / empty body returns the default.
Declaration
public T Call<T>(ApiRequest request)
Parameters
Returns
Type Parameters