public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.XRay.Model.PutTraceSegmentsRequest(); if (cmdletContext.TraceSegmentDocument != null) { request.TraceSegmentDocuments = cmdletContext.TraceSegmentDocument; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
private Amazon.XRay.Model.PutTraceSegmentsResponse CallAWSServiceOperation(IAmazonXRay client, Amazon.XRay.Model.PutTraceSegmentsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS X-Ray", "PutTraceSegments"); try { #if DESKTOP return(client.PutTraceSegments(request)); #elif CORECLR return(client.PutTraceSegmentsAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Uploads segment documents to AWS X-Ray. The X-Ray SDK generates segment documents /// and sends them to the X-Ray daemon, which uploads them in batches. A segment document /// can be a completed segment, an in-progress segment, or an array of subsegments. /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutTraceSegments service method.</param> /// /// <returns>The response from the PutTraceSegments service method, as returned by XRay.</returns> /// <exception cref="Amazon.XRay.Model.InvalidRequestException"> /// The request is missing required parameters or has invalid parameters. /// </exception> /// <exception cref="Amazon.XRay.Model.ThrottledException"> /// The request exceeds the maximum number of requests per second. /// </exception> public PutTraceSegmentsResponse PutTraceSegments(PutTraceSegmentsRequest request) { var marshaller = new PutTraceSegmentsRequestMarshaller(); var unmarshaller = PutTraceSegmentsResponseUnmarshaller.Instance; return Invoke<PutTraceSegmentsRequest,PutTraceSegmentsResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the PutTraceSegments operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutTraceSegments operation on AmazonXRayClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutTraceSegments /// operation.</returns> public IAsyncResult BeginPutTraceSegments(PutTraceSegmentsRequest request, AsyncCallback callback, object state) { var marshaller = new PutTraceSegmentsRequestMarshaller(); var unmarshaller = PutTraceSegmentsResponseUnmarshaller.Instance; return BeginInvoke<PutTraceSegmentsRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the PutTraceSegments operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutTraceSegments operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<PutTraceSegmentsResponse> PutTraceSegmentsAsync(PutTraceSegmentsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutTraceSegmentsRequestMarshaller(); var unmarshaller = PutTraceSegmentsResponseUnmarshaller.Instance; return InvokeAsync<PutTraceSegmentsRequest,PutTraceSegmentsResponse>(request, marshaller, unmarshaller, cancellationToken); }