# ParameterResource.SetValueAsync

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [ParameterResource](/reference/api/go/aspire.hosting/parameterresource.md)
- Version: `17.0.0`
- Kind: `method`

Sets or replaces the value for this parameter.

## Remarks

Setting a value directly on the resource updates dashboard state after the resource has been observed by the host.
It does not save the value to deployment state. Required parameters set to `null` or an empty string
are faulted with `MissingParameterValueException`, while optional parameters can be cleared to `null`.
Cancellation is checked before assignment. After assignment, cancellation does not roll back the value or
prevent the host from synchronizing dashboard and parameter-resolution state, even if another observer reports cancellation.

## Definition

```go
type ParameterResource interface {
    // ... omitted for brevity
    SetValueAsync(options ...*SetValueAsyncOptions) error
}
```

## Signature

```go
SetValueAsync(options ...*SetValueAsyncOptions) error
```

## Parameters

- `options` (`...*SetValueAsyncOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*SetValueAsyncOptions` argument.

- `Value` (`*string`) -- The value to use for this parameter.
- `CancellationToken` (`*CancellationToken`) -- The cancellation token to observe while applying the value.

## Returns

`error` -- A task that completes when the value has been applied and observers have processed the change.

Returns `error`.

## Defined on

- [ParameterResource](/reference/api/go/aspire.hosting/parameterresource.md) -- `handle`
