ResourceCommandService.ExecuteCommandAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ExecuteCommandAsync(IResource, String, CancellationToken) |
Execute a command for the specified resource. |
ExecuteCommandAsync(String, String, CancellationToken) |
Execute a command for the specified resource. |
ExecuteCommandAsync(IResource, String, CancellationToken)
- Source:
- ResourceCommandService.cs
Execute a command for the specified resource.
public System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult> ExecuteCommandAsync(Aspire.Hosting.ApplicationModel.IResource resource, string commandName, System.Threading.CancellationToken cancellationToken = default);
member this.ExecuteCommandAsync : Aspire.Hosting.ApplicationModel.IResource * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult>
Public Function ExecuteCommandAsync (resource As IResource, commandName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ExecuteCommandResult)
Parameters
- resource
- IResource
The resource. If the resource has multiple instances, such as replicas, then the command will be executed for each instance.
- commandName
- String
The command name.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
The ExecuteCommandResult indicates command success or failure.
Applies to
ExecuteCommandAsync(String, String, CancellationToken)
- Source:
- ResourceCommandService.cs
Execute a command for the specified resource.
public System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult> ExecuteCommandAsync(string resourceId, string commandName, System.Threading.CancellationToken cancellationToken = default);
member this.ExecuteCommandAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Aspire.Hosting.ApplicationModel.ExecuteCommandResult>
Public Function ExecuteCommandAsync (resourceId As String, commandName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ExecuteCommandResult)
Parameters
- resourceId
- String
The resource id. This id can either exactly match the unique id of the resource or the displayed resource name if the resource name doesn't have duplicates (i.e. replicas).
- commandName
- String
The command name.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
The ExecuteCommandResult indicates command success or failure.
Remarks
A resource id can be either the unique id of the resource or the displayed resource name.
Projects, executables and containers typically have a unique id that combines the display name and a unique suffix. For example, a resource named cache
could have a resource id of cache-abcdwxyz
. This id is used to uniquely identify the resource in the app host.
The resource name can be also be used to retrieve the resource state, but it must be unique. If there are multiple resources with the same name, then this method will not return a match. For example, if a resource named cache
has multiple replicas, then specifing cache
won't return a match.