AppSurface Search
API Reference

CloudTasks

Type

TokenAcquisitionException

Source

Reports only whether metadata token acquisition failed because data was invalid or unavailable.

Remarks

No provider response, exception, token, URI, or configuration value is retained.

Property

InvalidToken

bool InvalidToken { get; } Source

Gets whether the response contained invalid token fields rather than an unavailable response.

Type

CloudRunMetadataAccessTokenSource

Source

Obtains an OAuth access token from the documented Cloud Run metadata endpoint only.

Remarks

The metadata identity authorizes task creation; it is distinct from the OIDC service account that Cloud Tasks uses when dispatching to the worker. This source does not cache tokens, use credential files, or select a fallback.

Method

GetAccessTokenAsync

2 overloads
ValueTask<string> GetAccessTokenAsync(CancellationToken cancellationToken = default)

Obtains a token using the configured standalone metadata request timeout.

Parameters

  • cancellationToken
    Caller cancellation.

Returns

A validated bare OAuth access token.

ValueTask<string> GetAccessTokenAsync(SubmissionBudget budget, CancellationToken cancellationToken)

Obtains a token using the lesser of the source timeout and the invocation's remaining budget.

Parameters

  • budget
    The invocation-local monotonic submission budget.
  • cancellationToken
    Caller or overall submission cancellation.

Returns

A validated bare OAuth access token.

Method

Dispose

void Dispose()

Disposes the owned metadata HTTP client and its private handler.

Type

CloudTasksValidation

Source

Implements bounded, provider-independent syntax checks for Cloud Tasks caller values.

Remarks

Validation is local only. It never establishes provider resource existence, IAM, or queue configuration.

Method

Required

ArgumentException Required(string parameterName, string constraint)

Creates the required-field exception without exposing any supplied value.

Method

Syntax

ArgumentException Syntax(string parameterName, string constraint)

Creates the syntax exception without exposing any supplied value.

Method

Range

ArgumentOutOfRangeException Range(string parameterName, string constraint, string safeFix)

Creates the range exception without exposing any supplied value.

Method

ValidateTimeout

TimeSpan ValidateTimeout(TimeSpan timeout, string parameterName)

Validates a timeout against positive finite and timer-range policy.

Method

ValidateProjectId

string ValidateProjectId(string? value, string parameterName)

Validates the project resource segment, including supported numeric and legacy forms.

Method

ValidateLocationId

string ValidateLocationId(string? value, string parameterName)

Validates a lowercase location resource segment.

Method

ValidateQueueId

string ValidateQueueId(string? value, string parameterName)

Validates a provider-style queue ID.

Method

ValidateTaskId

string ValidateTaskId(string? value, string parameterName)

Validates a task ID accepted by the package contract.

Method

ValidateEndpoint

Uri ValidateEndpoint(Uri? value, string parameterName)

Validates the worker endpoint shape and encoded URI length.

Method

ValidateEmail

string ValidateEmail(string? value, string parameterName)

Validates a bounded ASCII service account email without network or ownership checks.

Method

ValidateAudience

string ValidateAudience(string? value, string parameterName)

Validates an explicit bounded OIDC audience without inferring it from an endpoint.

Method

ValidateDispatchDeadline

TimeSpan ValidateDispatchDeadline(TimeSpan value, string parameterName)

Validates Google worker dispatch deadline range and precision.

Method

ValidateTaskName

string ValidateTaskName(string? value, string parameterName)

Validates an expected canonical task resource name, never a provider-returned name.

Method

IsValidToken

bool IsValidToken(string? token)

Checks the bare RFC 6750 bearer token syntax and package byte limit.

Type

CloudTasksServiceCollectionExtensions

Source

Explicit singleton registration for the optional Google Cloud Tasks transport.

Remarks

Register a single singleton token source before activation. See https://github.com/forge-trust/AppSurface/blob/main/Durable/cloudtasks-activation.md#registration .

Method

AddCloudTasksActivation

IServiceCollection AddCloudTasksActivation(this IServiceCollection services, CloudTasksActivationClientOptions options)

Registers one reusable activation client and its container-owned SDK channel without I/O.

Parameters

  • services
    Host services.
  • options
    Explicit overall token-plus-submission timeout.

Returns

The supplied collection.

Remarks

A missing source remains passive until explicit client resolution. Duplicate/non-singleton sources and repeated registration are rejected atomically. Externally supplied singleton instances stay application-owned.

Method

AddCloudRunMetadataAccessTokenSource

IServiceCollection AddCloudRunMetadataAccessTokenSource(this IServiceCollection services, CloudRunMetadataAccessTokenOptions options)

Explicitly opts into the fixed Cloud Run metadata OAuth source as a container-owned singleton.

Parameters

  • services
    Host services.
  • options
    Explicit per-metadata-request timeout.

Returns

The supplied collection.

Remarks

Call once before activation registration, with no other token-source descriptor present. This call performs no HTTP or credential discovery.

Type

CloudTasksSdkTransport

Source

Owns the reusable SDK channel and HTTP handler; no ambient credentials or retry policy.

Method

CreateHandler

SocketsHttpHandler CreateHandler()

Constructs the fixed-policy handler, allowing concurrent calls to exceed one connection's stream limit.

Property

IsDisposed

bool IsDisposed { get; } Source

Lifecycle observation seam for container ownership tests.

Type

RpcInvocationObserver

Source

Observes generated RPC calls for internal fixtures before transport-level replay.

Type

ResponseGuardHandler

Source

Rejects unsupported response encodings before SDK-local statuses can resemble provider rejections.

Type

BoundedGzipProvider

Source

Uses the supported channel compression seam to enforce the decoded cap before protobuf parsing.

Type

LimitedReadStream

Source

Reads at most limit-plus-one decoded bytes and never hands the excess byte to a protobuf decoder.

Type

CloudTasksActivationTarget

Source

Describes the fixed Cloud Tasks queue and payload-free worker wake target.

Remarks

This value validates syntax only; it does not prove that the queue, location, service account, permissions, or effective queue routing exist. The OIDC account identifies the task's worker request identity. It is distinct from the OAuth access token used by the creator. See https://github.com/forge-trust/AppSurface/blob/main/Durable/cloudtasks-activation.md#reference .

Property

ProjectId

string ProjectId { get; } Source

Gets the project identifier used in the Cloud Tasks resource name.

Property

LocationId

string LocationId { get; } Source

Gets the location segment used in the Cloud Tasks resource name.

Property

QueueId

string QueueId { get; } Source

Gets the queue segment used in the Cloud Tasks resource name.

Property

WorkerEndpoint

Uri WorkerEndpoint { get; } Source

Gets the validated HTTPS endpoint requested for the worker.

Property

OidcServiceAccountEmail

string OidcServiceAccountEmail { get; } Source

Gets the explicit service-account email used for the task's OIDC token.

Property

Audience

string Audience { get; } Source

Gets the explicit audience requested for the task's OIDC token.

Property

DispatchDeadline

TimeSpan DispatchDeadline { get; } Source

Gets the worker dispatch deadline with whole-millisecond precision.

Property

QueueName

string QueueName { get; } Source

Gets the canonical queue resource name derived from validated target values.

Type

CloudTasksActivationRequest

Source

Describes one caller-selected task identity to submit as an empty worker wake.

Property

Target

CloudTasksActivationTarget Target { get; } Source

Gets the immutable target used for the submission.

Property

TaskId

string TaskId { get; } Source

Gets the validated caller-selected task ID.

Property

TaskName

string TaskName { get; } Source

Gets the expected task resource name derived from the validated target and task ID.

Type

CloudTasksDispatchReceipt

Source

Contains a validated expected task name and a closed, package-owned diagnostic.

Remarks

A receipt reports creation evidence only. It does not prove delivery, Work selection, or Work completion.

Property

TaskName

string TaskName { get; } Source

Gets the expected task resource name derived from caller request intent.

Property

Disposition

CloudTasksDispatchDisposition Disposition { get; } Source

Gets the safe dispatch disposition.

Property

DiagnosticCode

string DiagnosticCode { get; } Source

Gets the canonical package-owned diagnostic code.

Type

ICloudTasksAccessTokenSource

Source

Supplies only an OAuth access token used to authorize Cloud Tasks task creation.

Remarks

Implementations must be thread-safe singletons, honor cancellation, and avoid logging returned secrets.

Method

GetAccessTokenAsync

ValueTask<string> GetAccessTokenAsync(CancellationToken cancellationToken = default)

Obtains an OAuth access token cooperatively under the caller's linked submission budget.

Parameters

  • cancellationToken
    Caller cancellation or the overall submission budget signal.

Returns

The bare token without a Bearer prefix.

Exceptions

  • OperationCanceledException
    The source honors a requested cancellation signal.
Type

ICloudTasksActivationClient

Source

Dispatches one logical named, payload-free Cloud Tasks activation task.

Method

DispatchAsync

Task<CloudTasksDispatchReceipt> DispatchAsync(CloudTasksActivationRequest request, CancellationToken cancellationToken = default)

Submits one validated task request and returns bounded, safe creation evidence.

Parameters

  • request
    The immutable caller intent.
  • cancellationToken
    Caller cancellation, propagated as a sanitized cancellation exception.

Returns

A safe receipt; creation acceptance does not establish worker delivery or completion.

Exceptions

  • ArgumentException
    The request is null; ASCTV001 validation metadata identifies the required request.
  • OperationCanceledException
    Caller cancellation is observed before or during the operation.
Type

CloudTasksActivationClientOptions

Source

Defines the required overall budget for token acquisition plus Cloud Tasks creation.

Property

SubmissionTimeout

TimeSpan SubmissionTimeout { get; } Source

Gets the budget covering token acquisition and provider creation together.

Type

CloudRunMetadataAccessTokenOptions

Source

Defines the required bound for one Cloud Run metadata-server token request.

Property

RequestTimeout

TimeSpan RequestTimeout { get; } Source

Gets the configured upper bound for a standalone metadata request.

Type

CloudTasksDiagnosticCatalog

Source

Maps the closed package diagnostic catalog to its sole valid dispatch disposition.

Method

IsAllowed

bool IsAllowed(CloudTasksDispatchDisposition disposition, string? code)

Returns whether the exact ordinal diagnostic is valid for the specified disposition.

Type

SubmissionBudget

Source

Invocation-local monotonic time remaining, shared only with the built-in metadata source.

Property

TimeProvider

TimeProvider TimeProvider { get; } Source

Clock whose monotonic timestamps govern this invocation.

Property

Remaining

TimeSpan Remaining { get; } Source

Unconsumed duration, clamped to zero.

Property

IsExpired

bool IsExpired { get; } Source

Whether the invocation's original duration has elapsed.

Type

CloudTasksActivationClient

Source

Owns one explicitly credentialed creation invocation and classifies only safe evidence.

Type

ICloudTasksRpcTransport

Source

Internal SDK boundary: no provider types cross the public package API.

Method

CreateAsync

Task<string?> CreateAsync(CloudTasksActivationRequest request, string token, TimeSpan remaining, CancellationToken cancellationToken)

Creates one empty named wake, returning only the observed provider task name.

Type

CloudTasksResponseLimitException

Source

Closed local response-bound signal without provider data.

Type

CloudTasksDiagnostics

Source

Observational, redacted diagnostics; ordinary listener failures cannot affect dispatch.

Method

IsFatal

bool IsFatal(Exception exception)

Identifies process-corrupting errors which must never become receipts.

Method

Unexpected

void Unexpected(string operation, string cause, string code)

Emits only package-owned stage/cause/code values, linked to the current caller activity.

Enum

CloudTasksDispatchDisposition

Source

Identifies the closed set of safe Cloud Tasks creation outcomes.