bool InvalidToken { get; }
Source
Gets whether the response contained invalid token fields rather than an unavailable response.
Reports only whether metadata token acquisition failed because data was invalid or unavailable.
No provider response, exception, token, URI, or configuration value is retained.
bool InvalidToken { get; }
Source
Gets whether the response contained invalid token fields rather than an unavailable response.
Obtains an OAuth access token from the documented Cloud Run metadata endpoint only.
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.
ValueTask<string> GetAccessTokenAsync(CancellationToken cancellationToken = default)
Obtains a token using the configured standalone metadata request timeout.
cancellationToken
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.
budget
cancellationToken
A validated bare OAuth access token.
void Dispose()
Disposes the owned metadata HTTP client and its private handler.
Implements bounded, provider-independent syntax checks for Cloud Tasks caller values.
Validation is local only. It never establishes provider resource existence, IAM, or queue configuration.
ArgumentException Required(string parameterName, string constraint)
Creates the required-field exception without exposing any supplied value.
ArgumentException Syntax(string parameterName, string constraint)
Creates the syntax exception without exposing any supplied value.
ArgumentOutOfRangeException Range(string parameterName, string constraint, string safeFix)
Creates the range exception without exposing any supplied value.
TimeSpan ValidateTimeout(TimeSpan timeout, string parameterName)
Validates a timeout against positive finite and timer-range policy.
string ValidateProjectId(string? value, string parameterName)
Validates the project resource segment, including supported numeric and legacy forms.
string ValidateLocationId(string? value, string parameterName)
Validates a lowercase location resource segment.
string ValidateQueueId(string? value, string parameterName)
Validates a provider-style queue ID.
string ValidateTaskId(string? value, string parameterName)
Validates a task ID accepted by the package contract.
Uri ValidateEndpoint(Uri? value, string parameterName)
Validates the worker endpoint shape and encoded URI length.
string ValidateEmail(string? value, string parameterName)
Validates a bounded ASCII service account email without network or ownership checks.
string ValidateAudience(string? value, string parameterName)
Validates an explicit bounded OIDC audience without inferring it from an endpoint.
TimeSpan ValidateDispatchDeadline(TimeSpan value, string parameterName)
Validates Google worker dispatch deadline range and precision.
string ValidateTaskName(string? value, string parameterName)
Validates an expected canonical task resource name, never a provider-returned name.
bool IsValidToken(string? token)
Checks the bare RFC 6750 bearer token syntax and package byte limit.
Explicit singleton registration for the optional Google Cloud Tasks transport.
Register a single singleton token source before activation. See https://github.com/forge-trust/AppSurface/blob/main/Durable/cloudtasks-activation.md#registration
.
IServiceCollection AddCloudTasksActivation(this IServiceCollection services, CloudTasksActivationClientOptions options)
Registers one reusable activation client and its container-owned SDK channel without I/O.
services
options
The supplied collection.
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.
IServiceCollection AddCloudRunMetadataAccessTokenSource(this IServiceCollection services, CloudRunMetadataAccessTokenOptions options)
Explicitly opts into the fixed Cloud Run metadata OAuth source as a container-owned singleton.
services
options
The supplied collection.
Call once before activation registration, with no other token-source descriptor present. This call performs no HTTP or credential discovery.
Owns the reusable SDK channel and HTTP handler; no ambient credentials or retry policy.
SocketsHttpHandler CreateHandler()
Constructs the fixed-policy handler, allowing concurrent calls to exceed one connection's stream limit.
bool IsDisposed { get; }
Source
Lifecycle observation seam for container ownership tests.
Observes generated RPC calls for internal fixtures before transport-level replay.
Rejects unsupported response encodings before SDK-local statuses can resemble provider rejections.
Uses the supported channel compression seam to enforce the decoded cap before protobuf parsing.
Reads at most limit-plus-one decoded bytes and never hands the excess byte to a protobuf decoder.
Describes the fixed Cloud Tasks queue and payload-free worker wake target.
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
.
string ProjectId { get; }
Source
Gets the project identifier used in the Cloud Tasks resource name.
string LocationId { get; }
Source
Gets the location segment used in the Cloud Tasks resource name.
string QueueId { get; }
Source
Gets the queue segment used in the Cloud Tasks resource name.
Uri WorkerEndpoint { get; }
Source
Gets the validated HTTPS endpoint requested for the worker.
string OidcServiceAccountEmail { get; }
Source
Gets the explicit service-account email used for the task's OIDC token.
string Audience { get; }
Source
Gets the explicit audience requested for the task's OIDC token.
TimeSpan DispatchDeadline { get; }
Source
Gets the worker dispatch deadline with whole-millisecond precision.
string QueueName { get; }
Source
Gets the canonical queue resource name derived from validated target values.
Describes one caller-selected task identity to submit as an empty worker wake.
CloudTasksActivationTarget Target { get; }
Source
Gets the immutable target used for the submission.
string TaskId { get; }
Source
Gets the validated caller-selected task ID.
string TaskName { get; }
Source
Gets the expected task resource name derived from the validated target and task ID.
Contains a validated expected task name and a closed, package-owned diagnostic.
A receipt reports creation evidence only. It does not prove delivery, Work selection, or Work completion.
string TaskName { get; }
Source
Gets the expected task resource name derived from caller request intent.
CloudTasksDispatchDisposition Disposition { get; }
Source
Gets the safe dispatch disposition.
string DiagnosticCode { get; }
Source
Gets the canonical package-owned diagnostic code.
Supplies only an OAuth access token used to authorize Cloud Tasks task creation.
Implementations must be thread-safe singletons, honor cancellation, and avoid logging returned secrets.
ValueTask<string> GetAccessTokenAsync(CancellationToken cancellationToken = default)
Obtains an OAuth access token cooperatively under the caller's linked submission budget.
cancellationToken
The bare token without a Bearer
prefix.
OperationCanceledException
Dispatches one logical named, payload-free Cloud Tasks activation task.
Task<CloudTasksDispatchReceipt> DispatchAsync(CloudTasksActivationRequest request, CancellationToken cancellationToken = default)
Submits one validated task request and returns bounded, safe creation evidence.
request
cancellationToken
A safe receipt; creation acceptance does not establish worker delivery or completion.
ArgumentException
OperationCanceledException
Defines the required overall budget for token acquisition plus Cloud Tasks creation.
TimeSpan SubmissionTimeout { get; }
Source
Gets the budget covering token acquisition and provider creation together.
Defines the required bound for one Cloud Run metadata-server token request.
TimeSpan RequestTimeout { get; }
Source
Gets the configured upper bound for a standalone metadata request.
Maps the closed package diagnostic catalog to its sole valid dispatch disposition.
bool IsAllowed(CloudTasksDispatchDisposition disposition, string? code)
Returns whether the exact ordinal diagnostic is valid for the specified disposition.
Invocation-local monotonic time remaining, shared only with the built-in metadata source.
TimeProvider TimeProvider { get; }
Source
Clock whose monotonic timestamps govern this invocation.
TimeSpan Remaining { get; }
Source
Unconsumed duration, clamped to zero.
bool IsExpired { get; }
Source
Whether the invocation's original duration has elapsed.
Owns one explicitly credentialed creation invocation and classifies only safe evidence.
Internal SDK boundary: no provider types cross the public package API.
Task<string?> CreateAsync(CloudTasksActivationRequest request, string token, TimeSpan remaining, CancellationToken cancellationToken)
Creates one empty named wake, returning only the observed provider task name.
Closed local response-bound signal without provider data.
Observational, redacted diagnostics; ordinary listener failures cannot affect dispatch.
bool IsFatal(Exception exception)
Identifies process-corrupting errors which must never become receipts.
void Unexpected(string operation, string cause, string code)
Emits only package-owned stage/cause/code values, linked to the current caller activity.
Identifies the closed set of safe Cloud Tasks creation outcomes.