Udostępnij za pośrednictwem


SolutionInference.Cancel(String, RequestContent, RequestContext) Method

Definition

Cancels a job for given solution id.

public virtual Azure.Response Cancel (string solutionId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Cancel : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.Cancel : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function Cancel (solutionId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response

Parameters

solutionId
String

Id of solution for which job is to be cancelled.

content
RequestContent

The content to send as the body of the request. Details of the request body schema are in the Remarks section below.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

solutionId or content is null.

solutionId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call Cancel with required parameters and request content, and how to parse the result.

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetSolutionInferenceClient(<2022-11-01-preview>);

var data = new {
    requestPath = "<requestPath>",
};

Response response = client.Cancel("<solutionId>", RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("<test>").ToString());

This sample shows how to call Cancel with all parameters and request content, and how to parse the result.

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetSolutionInferenceClient(<2022-11-01-preview>);

var data = new {
    requestPath = "<requestPath>",
    partnerRequestBody = new {
        key = new {},
    },
};

Response response = client.Cancel("<solutionId>", RequestContent.Create(data));

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("<test>").ToString());

Remarks

Below is the JSON schema for the request payload.

Request Body:

Schema for SolutionInference:

{
  requestPath: string, # Required. RequestPath containing the api-version, query parameters and path route to be called for partner request.
Expected format is "/{api-version}/{resourceExposedByPartner}/{customerDefinedJobId}?query1=value1".
Not following this format may result into validation errors.
  partnerRequestBody: Dictionary<string, any>, # Optional. Api input parameters required by partner to trigger/cancel job request.
}

Applies to