/******************************************************************************* * Copyright 2012-2019 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. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.MachineLearning; using Amazon.MachineLearning.Model; namespace Amazon.PowerShell.Cmdlets.ML { /// /// 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. /// /// [Cmdlet("New", "MLDataSourceFromRedshift", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("System.String")] [AWSCmdlet("Calls the Amazon Machine Learning CreateDataSourceFromRedshift API operation.", Operation = new[] {"CreateDataSourceFromRedshift"}, SelectReturnType = typeof(Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse))] [AWSCmdletOutput("System.String or Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse", "This cmdlet returns a System.String object.", "The service call response (type Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class NewMLDataSourceFromRedshiftCmdlet : AmazonMachineLearningClientCmdlet, IExecutor { #region Parameter DatabaseInformation_ClusterIdentifier /// /// /// The service has not provided documentation for this parameter; please refer to the service's API reference documentation for the latest available information. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("DataSpec_DatabaseInformation_ClusterIdentifier")] public System.String DatabaseInformation_ClusterIdentifier { get; set; } #endregion #region Parameter ComputeStatistic /// /// /// 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. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("ComputeStatistics")] public System.Boolean? ComputeStatistic { get; set; } #endregion #region Parameter DatabaseInformation_DatabaseName /// /// /// The service has not provided documentation for this parameter; please refer to the service's API reference documentation for the latest available information. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("DataSpec_DatabaseInformation_DatabaseName")] public System.String DatabaseInformation_DatabaseName { get; set; } #endregion #region Parameter DataSpec_DataRearrangement /// /// /// A JSON string that represents the splitting and rearrangement processing to be applied /// to a DataSource. If the DataRearrangement parameter is not /// provided, all of the input data is used to create the Datasource.There are multiple parameters that control what data is used to create a datasource: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DataSpec_DataRearrangement { get; set; } #endregion #region Parameter DataSpec_DataSchema /// /// /// A JSON string that represents the schema for an Amazon Redshift DataSource. /// The DataSchema defines the structure of the observation data in the data /// file(s) referenced in the DataSource.A DataSchema is not required if you specify a DataSchemaUri.Define your DataSchema as a series of key-value pairs. attributes /// and excludedVariableNames have an array of key-value pairs for their /// value. Use the following format to define your DataSchema.{ "version": "1.0","recordAnnotationFieldName": "F1","recordWeightFieldName": "F2","targetFieldName": "F3","dataFormat": "CSV","dataFileContainsHeader": true,"attributes": [{ "fieldName": "F1", "fieldType": "TEXT" }, { "fieldName": "F2", "fieldType": "NUMERIC" /// }, { "fieldName": "F3", "fieldType": "CATEGORICAL" }, { "fieldName": "F4", "fieldType": /// "NUMERIC" }, { "fieldName": "F5", "fieldType": "CATEGORICAL" }, { "fieldName": "F6", /// "fieldType": "TEXT" }, { "fieldName": "F7", "fieldType": "WEIGHTED_INT_SEQUENCE" }, /// { "fieldName": "F8", "fieldType": "WEIGHTED_STRING_SEQUENCE" } ],"excludedVariableNames": [ "F6" ] } /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DataSpec_DataSchema { get; set; } #endregion #region Parameter DataSpec_DataSchemaUri /// /// /// Describes the schema location for an Amazon Redshift DataSource. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DataSpec_DataSchemaUri { get; set; } #endregion #region Parameter DataSourceId /// /// /// A user-supplied ID that uniquely identifies the DataSource. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String DataSourceId { get; set; } #endregion #region Parameter DataSourceName /// /// /// A user-supplied name or description of the DataSource. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DataSourceName { get; set; } #endregion #region Parameter DatabaseCredentials_Password /// /// /// The service has not provided documentation for this parameter; please refer to the service's API reference documentation for the latest available information. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("DataSpec_DatabaseCredentials_Password")] public System.String DatabaseCredentials_Password { get; set; } #endregion #region Parameter RoleARN /// /// /// A fully specified role Amazon Resource Name (ARN). Amazon ML assumes the role on behalf /// of the user to create the following: /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String RoleARN { get; set; } #endregion #region Parameter DataSpec_S3StagingLocation /// /// /// Describes an Amazon S3 location to store the result set of the SelectSqlQuery /// query. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String DataSpec_S3StagingLocation { get; set; } #endregion #region Parameter DataSpec_SelectSqlQuery /// /// /// Describes the SQL Query to execute on an Amazon Redshift database for an Amazon Redshift /// DataSource. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String DataSpec_SelectSqlQuery { get; set; } #endregion #region Parameter DatabaseCredentials_Username /// /// /// The service has not provided documentation for this parameter; please refer to the service's API reference documentation for the latest available information. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("DataSpec_DatabaseCredentials_Username")] public System.String DatabaseCredentials_Username { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is 'DataSourceId'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse). /// Specifying the name of a property of type Amazon.MachineLearning.Model.CreateDataSourceFromRedshiftResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "DataSourceId"; #endregion #region Parameter Force /// /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { this._AWSSignerType = "v4"; base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DataSourceName), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-MLDataSourceFromRedshift (CreateDataSourceFromRedshift)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); } context.ComputeStatistic = this.ComputeStatistic; context.DataSourceId = this.DataSourceId; #if MODULAR if (this.DataSourceId == null && ParameterWasBound(nameof(this.DataSourceId))) { WriteWarning("You are passing $null as a value for parameter DataSourceId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DataSourceName = this.DataSourceName; context.DatabaseCredentials_Password = this.DatabaseCredentials_Password; #if MODULAR if (this.DatabaseCredentials_Password == null && ParameterWasBound(nameof(this.DatabaseCredentials_Password))) { WriteWarning("You are passing $null as a value for parameter DatabaseCredentials_Password which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DatabaseCredentials_Username = this.DatabaseCredentials_Username; #if MODULAR if (this.DatabaseCredentials_Username == null && ParameterWasBound(nameof(this.DatabaseCredentials_Username))) { WriteWarning("You are passing $null as a value for parameter DatabaseCredentials_Username which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DatabaseInformation_ClusterIdentifier = this.DatabaseInformation_ClusterIdentifier; #if MODULAR if (this.DatabaseInformation_ClusterIdentifier == null && ParameterWasBound(nameof(this.DatabaseInformation_ClusterIdentifier))) { WriteWarning("You are passing $null as a value for parameter DatabaseInformation_ClusterIdentifier which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DatabaseInformation_DatabaseName = this.DatabaseInformation_DatabaseName; #if MODULAR if (this.DatabaseInformation_DatabaseName == null && ParameterWasBound(nameof(this.DatabaseInformation_DatabaseName))) { WriteWarning("You are passing $null as a value for parameter DatabaseInformation_DatabaseName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DataSpec_DataRearrangement = this.DataSpec_DataRearrangement; context.DataSpec_DataSchema = this.DataSpec_DataSchema; context.DataSpec_DataSchemaUri = this.DataSpec_DataSchemaUri; context.DataSpec_S3StagingLocation = this.DataSpec_S3StagingLocation; #if MODULAR if (this.DataSpec_S3StagingLocation == null && ParameterWasBound(nameof(this.DataSpec_S3StagingLocation))) { WriteWarning("You are passing $null as a value for parameter DataSpec_S3StagingLocation which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.DataSpec_SelectSqlQuery = this.DataSpec_SelectSqlQuery; #if MODULAR if (this.DataSpec_SelectSqlQuery == null && ParameterWasBound(nameof(this.DataSpec_SelectSqlQuery))) { WriteWarning("You are passing $null as a value for parameter DataSpec_SelectSqlQuery which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.RoleARN = this.RoleARN; #if MODULAR if (this.RoleARN == null && ParameterWasBound(nameof(this.RoleARN))) { WriteWarning("You are passing $null as a value for parameter RoleARN which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members 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; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call 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; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.Boolean? ComputeStatistic { get; set; } public System.String DataSourceId { get; set; } public System.String DataSourceName { get; set; } public System.String DatabaseCredentials_Password { get; set; } public System.String DatabaseCredentials_Username { get; set; } public System.String DatabaseInformation_ClusterIdentifier { get; set; } public System.String DatabaseInformation_DatabaseName { get; set; } public System.String DataSpec_DataRearrangement { get; set; } public System.String DataSpec_DataSchema { get; set; } public System.String DataSpec_DataSchemaUri { get; set; } public System.String DataSpec_S3StagingLocation { get; set; } public System.String DataSpec_SelectSqlQuery { get; set; } public System.String RoleARN { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response.DataSourceId; } } }