Exemplo n.º 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.MachineLearning.Model.GetBatchPredictionRequest();

            if (cmdletContext.BatchPredictionId != null)
            {
                request.BatchPredictionId = cmdletContext.BatchPredictionId;
            }

            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);
        }
Exemplo n.º 2
0
 private Amazon.MachineLearning.Model.GetBatchPredictionResponse CallAWSServiceOperation(IAmazonMachineLearning client, Amazon.MachineLearning.Model.GetBatchPredictionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Machine Learning", "GetBatchPrediction");
     try
     {
         #if DESKTOP
         return(client.GetBatchPrediction(request));
         #elif CORECLR
         return(client.GetBatchPredictionAsync(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>
        /// Initiates the asynchronous execution of the GetBatchPrediction operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBatchPrediction 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<GetBatchPredictionResponse> GetBatchPredictionAsync(GetBatchPredictionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetBatchPredictionRequestMarshaller();
            var unmarshaller = GetBatchPredictionResponseUnmarshaller.Instance;

            return InvokeAsync<GetBatchPredictionRequest,GetBatchPredictionResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 /// <summary>
 /// Returns a <code>BatchPrediction</code> that includes detailed metadata, status, and
 /// data file information for a <code>Batch Prediction</code> request.
 /// </summary>
 /// <param name="batchPredictionId">An ID assigned to the <code>BatchPrediction</code> at creation.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the GetBatchPrediction service method, as returned by MachineLearning.</returns>
 /// <exception cref="Amazon.MachineLearning.Model.InternalServerException">
 /// An error on the server occurred when trying to process a request.
 /// </exception>
 /// <exception cref="Amazon.MachineLearning.Model.InvalidInputException">
 /// An error on the client occurred. Typically, the cause is an invalid input value.
 /// </exception>
 /// <exception cref="Amazon.MachineLearning.Model.ResourceNotFoundException">
 /// A specified resource cannot be located.
 /// </exception>
 public Task<GetBatchPredictionResponse> GetBatchPredictionAsync(string batchPredictionId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new GetBatchPredictionRequest();
     request.BatchPredictionId = batchPredictionId;
     return GetBatchPredictionAsync(request, cancellationToken);
 }
        internal GetBatchPredictionResponse GetBatchPrediction(GetBatchPredictionRequest request)
        {
            var marshaller = new GetBatchPredictionRequestMarshaller();
            var unmarshaller = GetBatchPredictionResponseUnmarshaller.Instance;

            return Invoke<GetBatchPredictionRequest,GetBatchPredictionResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Returns a <code>BatchPrediction</code> that includes detailed metadata, status, and
 /// data file information for a <code>Batch Prediction</code> request.
 /// </summary>
 /// <param name="batchPredictionId">An ID assigned to the <code>BatchPrediction</code> at creation.</param>
 /// 
 /// <returns>The response from the GetBatchPrediction service method, as returned by MachineLearning.</returns>
 /// <exception cref="Amazon.MachineLearning.Model.InternalServerException">
 /// An error on the server occurred when trying to process a request.
 /// </exception>
 /// <exception cref="Amazon.MachineLearning.Model.InvalidInputException">
 /// An error on the client occurred. Typically, the cause is an invalid input value.
 /// </exception>
 /// <exception cref="Amazon.MachineLearning.Model.ResourceNotFoundException">
 /// A specified resource cannot be located.
 /// </exception>
 public GetBatchPredictionResponse GetBatchPrediction(string batchPredictionId)
 {
     var request = new GetBatchPredictionRequest();
     request.BatchPredictionId = batchPredictionId;
     return GetBatchPrediction(request);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GetBatchPrediction operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBatchPrediction operation on AmazonMachineLearningClient.</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 EndGetBatchPrediction
        ///         operation.</returns>
        public IAsyncResult BeginGetBatchPrediction(GetBatchPredictionRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetBatchPredictionRequestMarshaller();
            var unmarshaller = GetBatchPredictionResponseUnmarshaller.Instance;

            return BeginInvoke<GetBatchPredictionRequest>(request, marshaller, unmarshaller,
                callback, state);
        }