Udostępnij za pośrednictwem


SolutionInference.CreateOrUpdateAsync Method

Definition

Creates a job trigger for a solution.

public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CreateOrUpdateAsync (Azure.WaitUntil waitUntil, string solutionId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrUpdateAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
override this.CreateOrUpdateAsync : Azure.WaitUntil * string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
Public Overridable Function CreateOrUpdateAsync (waitUntil As WaitUntil, solutionId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation(Of BinaryData))

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

solutionId
String

Id of the solution resource.

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 Operation representing an asynchronous operation on 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 CreateOrUpdateAsync 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>",
};

var operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "<solutionId>", RequestContent.Create(data));

BinaryData data = operation.Value;
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("<test>").ToString());

This sample shows how to call CreateOrUpdateAsync 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 {},
    },
};

var operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "<solutionId>", RequestContent.Create(data));

BinaryData data = operation.Value;
JsonElement result = JsonDocument.Parse(data.ToStream()).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