Show / Hide Table of Contents

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.

Inheritance
object
ApiClient
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Pulumi.Cloud.Sdk
Assembly: Pulumi.Cloud.Sdk.dll
Syntax
public sealed class ApiClient

Constructors

View Source

ApiClient()

Declaration
public ApiClient()
View Source

ApiClient(ApiClientConfiguration)

Declaration
public ApiClient(ApiClientConfiguration configuration)
Parameters
Type Name Description
ApiClientConfiguration configuration
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
Type Name Description
ApiClientConfiguration configuration
HttpMessageHandler handler

Properties

View Source

Configuration

Declaration
public ApiClientConfiguration Configuration { get; }
Property Value
Type Description
ApiClientConfiguration

Methods

View Source

Call(ApiRequest)

Perform a request whose response body is ignored (void operations).

Declaration
public void Call(ApiRequest request)
Parameters
Type Name Description
ApiRequest request
View Source

CallWithHeadersOnly<H>(ApiRequest, Func<HttpHeaders, H>)

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
Type Name Description
ApiRequest request
Func<HttpHeaders, H> parseHeaders
Returns
Type Description
H
Type Parameters
Name Description
H
View Source

CallWithHeaders<T, H>(ApiRequest, Func<HttpHeaders, H>)

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
Type Name Description
ApiRequest request
Func<HttpHeaders, H> parseHeaders
Returns
Type Description
ResponseWithHeaders<T, H>
Type Parameters
Name Description
T
H
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
Type Name Description
ApiRequest request
Returns
Type Description
T
Type Parameters
Name Description
T

Version 2026.10.9

  • View Source
Back to top Copyright 2016-2026, Pulumi Corporation.