Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.machinelearning.model;
 
 
Container for the parameters to the CreateDataSourceFromRedshift operation.

Creates a DataSource from Amazon Redshift . 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 status can only be used to perform CreateMLModel, CreateEvaluation, or CreateBatchPrediction operations.

If Amazon ML cannot 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 exist in the database hosted on an Amazon Redshift cluster and should be specified by a SelectSqlQuery . Amazon ML executes Unload command in Amazon Redshift to transfer the result set of SelectSqlQuery to S3StagingLocation.

After the DataSource is created, it's ready for use in evaluations and batch predictions. If you plan to use the DataSource to train an MLModel , the DataSource requires another item -- a recipe. A recipe describes the observation variables that participate in training an MLModel . A recipe describes how each input variable will be used in training. Will the variable be included or excluded from training? Will the variable be manipulated, for example, combined with another variable or split apart into word combinations? The recipe provides answers to these questions. For more information, see the Amazon Machine Learning Developer Guide.

 
 public class CreateDataSourceFromRedshiftRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
A user-supplied ID that uniquely identifies the DataSource.

Constraints:
Length: 1 - 64
Pattern: [a-zA-Z0-9_.-]+

 
     private String dataSourceId;

    
A user-supplied name or description of the DataSource.

Constraints:
Length: 0 - 1024
Pattern: .*\S.*|^$

 
     private String dataSourceName;

    
The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

    private RedshiftDataSpec dataSpec;

    
A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

Constraints:
Length: 1 - 100

    private String roleARN;

    
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training
    private Boolean computeStatistics;

    
A user-supplied ID that uniquely identifies the DataSource.

Constraints:
Length: 1 - 64
Pattern: [a-zA-Z0-9_.-]+

Returns:
A user-supplied ID that uniquely identifies the DataSource.
    public String getDataSourceId() {
        return ;
    }
    
    
A user-supplied ID that uniquely identifies the DataSource.

Constraints:
Length: 1 - 64
Pattern: [a-zA-Z0-9_.-]+

Parameters:
dataSourceId A user-supplied ID that uniquely identifies the DataSource.
    public void setDataSourceId(String dataSourceId) {
        this. = dataSourceId;
    }
    
    
A user-supplied ID that uniquely identifies the DataSource.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 64
Pattern: [a-zA-Z0-9_.-]+

Parameters:
dataSourceId A user-supplied ID that uniquely identifies the DataSource.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = dataSourceId;
        return this;
    }

    
A user-supplied name or description of the DataSource.

Constraints:
Length: 0 - 1024
Pattern: .*\S.*|^$

Returns:
A user-supplied name or description of the DataSource.
    public String getDataSourceName() {
        return ;
    }
    
    
A user-supplied name or description of the DataSource.

Constraints:
Length: 0 - 1024
Pattern: .*\S.*|^$

Parameters:
dataSourceName A user-supplied name or description of the DataSource.
    public void setDataSourceName(String dataSourceName) {
        this. = dataSourceName;
    }
    
    
A user-supplied name or description of the DataSource.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 0 - 1024
Pattern: .*\S.*|^$

Parameters:
dataSourceName A user-supplied name or description of the DataSource.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = dataSourceName;
        return this;
    }

    
The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

Returns:
The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

    public RedshiftDataSpec getDataSpec() {
        return ;
    }
    
    
The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

Parameters:
dataSpec The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

    public void setDataSpec(RedshiftDataSpec dataSpec) {
        this. = dataSpec;
    }
    
    
The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

Returns a reference to this object so that method calls can be chained together.

Parameters:
dataSpec The data specification of an Amazon Redshift DataSource:
  • DatabaseInformation -

    • DatabaseName - Name of the Amazon Redshift database.
    • ClusterIdentifier - Unique ID for the Amazon Redshift cluster.
  • DatabaseCredentials - AWS Identity abd Access Management (IAM) credentials that are used to connect to the Amazon Redshift database.

  • SelectSqlQuery - Query that is used to retrieve the observation data for the Datasource.

  • S3StagingLocation - Amazon Simple Storage Service (Amazon S3) location for staging Amazon Redshift data. The data retrieved from Amazon Relational Database Service (Amazon RDS) using SelectSqlQuery is stored in this location.

  • DataSchemaUri - Amazon S3 location of the DataSchema.

  • DataSchema - A JSON string representing the schema. This is not required if DataSchemaUri is specified.

  • DataRearrangement - A JSON string representing the splitting requirement of a Datasource.

    Sample - "{\"randomSeed\":\"some-random-seed\", \"splitting\":{\"percentBegin\":10,\"percentEnd\":60}}"

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = dataSpec;
        return this;
    }

    
A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

Constraints:
Length: 1 - 100

Returns:
A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

    public String getRoleARN() {
        return ;
    }
    
    
A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

Constraints:
Length: 1 - 100

Parameters:
roleARN A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

    public void setRoleARN(String roleARN) {
        this. = roleARN;
    }
    
    
A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 100

Parameters:
roleARN A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf of the user to create the following:

  • A security group to allow Amazon ML to execute the SelectSqlQuery query on an Amazon Redshift cluster

  • An Amazon S3 bucket policy to grant Amazon ML read/write permissions on the S3StagingLocation

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = roleARN;
        return this;
    }

    
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training

Returns:
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training
    public Boolean isComputeStatistics() {
        return ;
    }
    
    
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training

Parameters:
computeStatistics The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training
    public void setComputeStatistics(Boolean computeStatistics) {
        this. = computeStatistics;
    }
    
    
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training

Returns a reference to this object so that method calls can be chained together.

Parameters:
computeStatistics The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = computeStatistics;
        return this;
    }

    
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training

Returns:
The compute statistics for a DataSource. The statistics are generated from the observation data referenced by a DataSource. Amazon ML uses the statistics internally during MLModel training. This parameter must be set to true if the DataSource needs to be used for MLModel training
    public Boolean getComputeStatistics() {
        return ;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDataSourceId() != nullsb.append("DataSourceId: " + getDataSourceId() + ",");
        if (getDataSourceName() != nullsb.append("DataSourceName: " + getDataSourceName() + ",");
        if (getDataSpec() != nullsb.append("DataSpec: " + getDataSpec() + ",");
        if (getRoleARN() != nullsb.append("RoleARN: " + getRoleARN() + ",");
        if (isComputeStatistics() != nullsb.append("ComputeStatistics: " + isComputeStatistics() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getDataSourceId() == null) ? 0 : getDataSourceId().hashCode()); 
        hashCode = prime * hashCode + ((getDataSourceName() == null) ? 0 : getDataSourceName().hashCode()); 
        hashCode = prime * hashCode + ((getDataSpec() == null) ? 0 : getDataSpec().hashCode()); 
        hashCode = prime * hashCode + ((getRoleARN() == null) ? 0 : getRoleARN().hashCode()); 
        hashCode = prime * hashCode + ((isComputeStatistics() == null) ? 0 : isComputeStatistics().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateDataSourceFromRedshiftRequest == falsereturn false;
        
        if (other.getDataSourceId() == null ^ this.getDataSourceId() == nullreturn false;
        if (other.getDataSourceId() != null && other.getDataSourceId().equals(this.getDataSourceId()) == falsereturn false
        if (other.getDataSourceName() == null ^ this.getDataSourceName() == nullreturn false;
        if (other.getDataSourceName() != null && other.getDataSourceName().equals(this.getDataSourceName()) == falsereturn false
        if (other.getDataSpec() == null ^ this.getDataSpec() == nullreturn false;
        if (other.getDataSpec() != null && other.getDataSpec().equals(this.getDataSpec()) == falsereturn false
        if (other.getRoleARN() == null ^ this.getRoleARN() == nullreturn false;
        if (other.getRoleARN() != null && other.getRoleARN().equals(this.getRoleARN()) == falsereturn false
        if (other.isComputeStatistics() == null ^ this.isComputeStatistics() == nullreturn false;
        if (other.isComputeStatistics() != null && other.isComputeStatistics().equals(this.isComputeStatistics()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (CreateDataSourceFromRedshiftRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X