Container for the parameters to the CreateDataSourceFromRedshift operation. Creates a DataSource from a database hosted on an Amazon Redshift cluster. A DataSource references data that can be used to perform either CreateMLModel, CreateEvaluation, or CreateBatchPrediction operations.

CreateDataSourceFromRedshift is an asynchronous operation. In response to CreateDataSourceFromRedshift, Amazon Machine Learning (Amazon ML) immediately returns and sets the DataSource status to PENDING. After the DataSource is created and ready for use, Amazon ML sets the Status parameter to COMPLETED. DataSource in COMPLETED or PENDING states can be used to perform only CreateMLModel, CreateEvaluation, or CreateBatchPrediction operations.

If Amazon ML can't accept the input source, it sets the Status parameter to FAILED and includes an error message in the Message attribute of the GetDataSource operation response.

The observations should be contained in the database hosted on an Amazon Redshift cluster and should be specified by a SelectSqlQuery query. Amazon ML executes an Unload command in Amazon Redshift to transfer the result set of the SelectSqlQuery query to S3StagingLocation.

After the DataSource has been created, it's ready for use in evaluations and batch predictions. If you plan to use the DataSource to train an MLModel, the DataSource also requires a recipe. A recipe describes how each input variable will be used in training an MLModel. Will the variable be included or excluded from training? Will the variable be manipulated; for example, will it be combined with another variable or will it be split apart into word combinations? The recipe provides answers to these questions.

You can't change an existing datasource, but you can copy and modify the settings from an existing Amazon Redshift datasource to create a new datasource. To do so, call GetDataSource for an existing datasource and copy the values to a CreateDataSource call. Change the settings that you want to change and make sure that all required fields have the appropriate values.

Inheritance: AmazonMachineLearningRequest
        /// <summary>
        /// Initiates the asynchronous execution of the CreateDataSourceFromRedshift operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDataSourceFromRedshift 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<CreateDataSourceFromRedshiftResponse> CreateDataSourceFromRedshiftAsync(CreateDataSourceFromRedshiftRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateDataSourceFromRedshiftRequestMarshaller();
            var unmarshaller = CreateDataSourceFromRedshiftResponseUnmarshaller.Instance;

            return InvokeAsync<CreateDataSourceFromRedshiftRequest,CreateDataSourceFromRedshiftResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal CreateDataSourceFromRedshiftResponse CreateDataSourceFromRedshift(CreateDataSourceFromRedshiftRequest request)
        {
            var marshaller = new CreateDataSourceFromRedshiftRequestMarshaller();
            var unmarshaller = CreateDataSourceFromRedshiftResponseUnmarshaller.Instance;

            return Invoke<CreateDataSourceFromRedshiftRequest,CreateDataSourceFromRedshiftResponse>(request, marshaller, unmarshaller);
        }
Exemplo n.º 3
0
 private Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse CallAWSServiceOperation(IAmazonMachineLearning client, Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Machine Learning", "CreateDataSourceFromRedshift");
     try
     {
         #if DESKTOP
         return(client.CreateDataSourceFromRedshift(request));
         #elif CORECLR
         return(client.CreateDataSourceFromRedshiftAsync(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 CreateDataSourceFromRedshift operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateDataSourceFromRedshift 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 EndCreateDataSourceFromRedshift
        ///         operation.</returns>
        public IAsyncResult BeginCreateDataSourceFromRedshift(CreateDataSourceFromRedshiftRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateDataSourceFromRedshiftRequestMarshaller();
            var unmarshaller = CreateDataSourceFromRedshiftResponseUnmarshaller.Instance;

            return BeginInvoke<CreateDataSourceFromRedshiftRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Exemplo n.º 5
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftRequest();

            if (cmdletContext.ComputeStatistic != null)
            {
                request.ComputeStatistics = cmdletContext.ComputeStatistic.Value;
            }
            if (cmdletContext.DataSourceId != null)
            {
                request.DataSourceId = cmdletContext.DataSourceId;
            }
            if (cmdletContext.DataSourceName != null)
            {
                request.DataSourceName = cmdletContext.DataSourceName;
            }

            // populate DataSpec
            var requestDataSpecIsNull = true;

            request.DataSpec = new Amazon.MachineLearning.Model.RedshiftDataSpec();
            System.String requestDataSpec_dataSpec_DataRearrangement = null;
            if (cmdletContext.DataSpec_DataRearrangement != null)
            {
                requestDataSpec_dataSpec_DataRearrangement = cmdletContext.DataSpec_DataRearrangement;
            }
            if (requestDataSpec_dataSpec_DataRearrangement != null)
            {
                request.DataSpec.DataRearrangement = requestDataSpec_dataSpec_DataRearrangement;
                requestDataSpecIsNull = false;
            }
            System.String requestDataSpec_dataSpec_DataSchema = null;
            if (cmdletContext.DataSpec_DataSchema != null)
            {
                requestDataSpec_dataSpec_DataSchema = cmdletContext.DataSpec_DataSchema;
            }
            if (requestDataSpec_dataSpec_DataSchema != null)
            {
                request.DataSpec.DataSchema = requestDataSpec_dataSpec_DataSchema;
                requestDataSpecIsNull       = false;
            }
            System.String requestDataSpec_dataSpec_DataSchemaUri = null;
            if (cmdletContext.DataSpec_DataSchemaUri != null)
            {
                requestDataSpec_dataSpec_DataSchemaUri = cmdletContext.DataSpec_DataSchemaUri;
            }
            if (requestDataSpec_dataSpec_DataSchemaUri != null)
            {
                request.DataSpec.DataSchemaUri = requestDataSpec_dataSpec_DataSchemaUri;
                requestDataSpecIsNull          = false;
            }
            System.String requestDataSpec_dataSpec_S3StagingLocation = null;
            if (cmdletContext.DataSpec_S3StagingLocation != null)
            {
                requestDataSpec_dataSpec_S3StagingLocation = cmdletContext.DataSpec_S3StagingLocation;
            }
            if (requestDataSpec_dataSpec_S3StagingLocation != null)
            {
                request.DataSpec.S3StagingLocation = requestDataSpec_dataSpec_S3StagingLocation;
                requestDataSpecIsNull = false;
            }
            System.String requestDataSpec_dataSpec_SelectSqlQuery = null;
            if (cmdletContext.DataSpec_SelectSqlQuery != null)
            {
                requestDataSpec_dataSpec_SelectSqlQuery = cmdletContext.DataSpec_SelectSqlQuery;
            }
            if (requestDataSpec_dataSpec_SelectSqlQuery != null)
            {
                request.DataSpec.SelectSqlQuery = requestDataSpec_dataSpec_SelectSqlQuery;
                requestDataSpecIsNull           = false;
            }
            Amazon.MachineLearning.Model.RedshiftDatabaseCredentials requestDataSpec_dataSpec_DatabaseCredentials = null;

            // populate DatabaseCredentials
            var requestDataSpec_dataSpec_DatabaseCredentialsIsNull = true;

            requestDataSpec_dataSpec_DatabaseCredentials = new Amazon.MachineLearning.Model.RedshiftDatabaseCredentials();
            System.String requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Password = null;
            if (cmdletContext.DatabaseCredentials_Password != null)
            {
                requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Password = cmdletContext.DatabaseCredentials_Password;
            }
            if (requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Password != null)
            {
                requestDataSpec_dataSpec_DatabaseCredentials.Password = requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Password;
                requestDataSpec_dataSpec_DatabaseCredentialsIsNull    = false;
            }
            System.String requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Username = null;
            if (cmdletContext.DatabaseCredentials_Username != null)
            {
                requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Username = cmdletContext.DatabaseCredentials_Username;
            }
            if (requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Username != null)
            {
                requestDataSpec_dataSpec_DatabaseCredentials.Username = requestDataSpec_dataSpec_DatabaseCredentials_databaseCredentials_Username;
                requestDataSpec_dataSpec_DatabaseCredentialsIsNull    = false;
            }
            // determine if requestDataSpec_dataSpec_DatabaseCredentials should be set to null
            if (requestDataSpec_dataSpec_DatabaseCredentialsIsNull)
            {
                requestDataSpec_dataSpec_DatabaseCredentials = null;
            }
            if (requestDataSpec_dataSpec_DatabaseCredentials != null)
            {
                request.DataSpec.DatabaseCredentials = requestDataSpec_dataSpec_DatabaseCredentials;
                requestDataSpecIsNull = false;
            }
            Amazon.MachineLearning.Model.RedshiftDatabase requestDataSpec_dataSpec_DatabaseInformation = null;

            // populate DatabaseInformation
            var requestDataSpec_dataSpec_DatabaseInformationIsNull = true;

            requestDataSpec_dataSpec_DatabaseInformation = new Amazon.MachineLearning.Model.RedshiftDatabase();
            System.String requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_ClusterIdentifier = null;
            if (cmdletContext.DatabaseInformation_ClusterIdentifier != null)
            {
                requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_ClusterIdentifier = cmdletContext.DatabaseInformation_ClusterIdentifier;
            }
            if (requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_ClusterIdentifier != null)
            {
                requestDataSpec_dataSpec_DatabaseInformation.ClusterIdentifier = requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_ClusterIdentifier;
                requestDataSpec_dataSpec_DatabaseInformationIsNull             = false;
            }
            System.String requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_DatabaseName = null;
            if (cmdletContext.DatabaseInformation_DatabaseName != null)
            {
                requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_DatabaseName = cmdletContext.DatabaseInformation_DatabaseName;
            }
            if (requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_DatabaseName != null)
            {
                requestDataSpec_dataSpec_DatabaseInformation.DatabaseName = requestDataSpec_dataSpec_DatabaseInformation_databaseInformation_DatabaseName;
                requestDataSpec_dataSpec_DatabaseInformationIsNull        = false;
            }
            // determine if requestDataSpec_dataSpec_DatabaseInformation should be set to null
            if (requestDataSpec_dataSpec_DatabaseInformationIsNull)
            {
                requestDataSpec_dataSpec_DatabaseInformation = null;
            }
            if (requestDataSpec_dataSpec_DatabaseInformation != null)
            {
                request.DataSpec.DatabaseInformation = requestDataSpec_dataSpec_DatabaseInformation;
                requestDataSpecIsNull = false;
            }
            // determine if request.DataSpec should be set to null
            if (requestDataSpecIsNull)
            {
                request.DataSpec = null;
            }
            if (cmdletContext.RoleARN != null)
            {
                request.RoleARN = cmdletContext.RoleARN;
            }

            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);
        }