Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.MachineLearning.Model.GetDataSourceRequest();

            if (cmdletContext.DataSourceId != null)
            {
                request.DataSourceId = cmdletContext.DataSourceId;
            }
            if (cmdletContext.VerboseResponse != null)
            {
                request.Verbose = cmdletContext.VerboseResponse.Value;
            }

            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);
        }
 /// <summary>
 /// Returns a <code>DataSource</code> that includes metadata and data file information,
 /// as well as the current status of the <code>DataSource</code>.
 /// 
 ///  
 /// <para>
 /// <code>GetDataSource</code> provides results in normal or verbose format. The verbose
 /// format adds the schema description and the list of files pointed to by the DataSource
 /// to the normal format.
 /// </para>
 /// </summary>
 /// <param name="dataSourceId">The ID assigned to the <code>DataSource</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 GetDataSource 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<GetDataSourceResponse> GetDataSourceAsync(string dataSourceId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new GetDataSourceRequest();
     request.DataSourceId = dataSourceId;
     return GetDataSourceAsync(request, cancellationToken);
 }
        internal GetDataSourceResponse GetDataSource(GetDataSourceRequest request)
        {
            var marshaller = new GetDataSourceRequestMarshaller();
            var unmarshaller = GetDataSourceResponseUnmarshaller.Instance;

            return Invoke<GetDataSourceRequest,GetDataSourceResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the GetDataSource operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetDataSource 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<GetDataSourceResponse> GetDataSourceAsync(GetDataSourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetDataSourceRequestMarshaller();
            var unmarshaller = GetDataSourceResponseUnmarshaller.Instance;

            return InvokeAsync<GetDataSourceRequest,GetDataSourceResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 /// <summary>
 /// Returns a <code>DataSource</code> that includes metadata and data file information,
 /// as well as the current status of the <code>DataSource</code>.
 /// 
 ///  
 /// <para>
 /// <code>GetDataSource</code> provides results in normal or verbose format. The verbose
 /// format adds the schema description and the list of files pointed to by the DataSource
 /// to the normal format.
 /// </para>
 /// </summary>
 /// <param name="dataSourceId">The ID assigned to the <code>DataSource</code> at creation.</param>
 /// <param name="verbose">Specifies whether the <code>GetDataSource</code> operation should return <code>DataSourceSchema</code>. If true, <code>DataSourceSchema</code> is returned. If false, <code>DataSourceSchema</code> is not returned.</param>
 /// 
 /// <returns>The response from the GetDataSource 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 GetDataSourceResponse GetDataSource(string dataSourceId, bool verbose)
 {
     var request = new GetDataSourceRequest();
     request.DataSourceId = dataSourceId;
     request.Verbose = verbose;
     return GetDataSource(request);
 }
 /// <summary>
 /// Returns a <code>DataSource</code> that includes metadata and data file information,
 /// as well as the current status of the <code>DataSource</code>.
 /// 
 ///  
 /// <para>
 /// <code>GetDataSource</code> provides results in normal or verbose format. The verbose
 /// format adds the schema description and the list of files pointed to by the DataSource
 /// to the normal format.
 /// </para>
 /// </summary>
 /// <param name="dataSourceId">The ID assigned to the <code>DataSource</code> at creation.</param>
 /// 
 /// <returns>The response from the GetDataSource 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 GetDataSourceResponse GetDataSource(string dataSourceId)
 {
     var request = new GetDataSourceRequest();
     request.DataSourceId = dataSourceId;
     return GetDataSource(request);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GetDataSource operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetDataSource 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 EndGetDataSource
        ///         operation.</returns>
        public IAsyncResult BeginGetDataSource(GetDataSourceRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetDataSourceRequestMarshaller();
            var unmarshaller = GetDataSourceResponseUnmarshaller.Instance;

            return BeginInvoke<GetDataSourceRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Example #8
0
 private Amazon.MachineLearning.Model.GetDataSourceResponse CallAWSServiceOperation(IAmazonMachineLearning client, Amazon.MachineLearning.Model.GetDataSourceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Machine Learning", "GetDataSource");
     try
     {
         #if DESKTOP
         return(client.GetDataSource(request));
         #elif CORECLR
         return(client.GetDataSourceAsync(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;
     }
 }