Ejemplo n.º 1
0
 private Amazon.TimestreamQuery.Model.CreateScheduledQueryResponse CallAWSServiceOperation(IAmazonTimestreamQuery client, Amazon.TimestreamQuery.Model.CreateScheduledQueryRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Timestream Query", "CreateScheduledQuery");
     try
     {
         #if DESKTOP
         return(client.CreateScheduledQuery(request));
         #elif CORECLR
         return(client.CreateScheduledQueryAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.TimestreamQuery.Model.CreateScheduledQueryRequest();

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

            // populate ErrorReportConfiguration
            var requestErrorReportConfigurationIsNull = true;

            request.ErrorReportConfiguration = new Amazon.TimestreamQuery.Model.ErrorReportConfiguration();
            Amazon.TimestreamQuery.Model.S3Configuration requestErrorReportConfiguration_errorReportConfiguration_S3Configuration = null;

            // populate S3Configuration
            var requestErrorReportConfiguration_errorReportConfiguration_S3ConfigurationIsNull = true;

            requestErrorReportConfiguration_errorReportConfiguration_S3Configuration = new Amazon.TimestreamQuery.Model.S3Configuration();
            System.String requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_BucketName = null;
            if (cmdletContext.S3Configuration_BucketName != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_BucketName = cmdletContext.S3Configuration_BucketName;
            }
            if (requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_BucketName != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration.BucketName = requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_BucketName;
                requestErrorReportConfiguration_errorReportConfiguration_S3ConfigurationIsNull      = false;
            }
            Amazon.TimestreamQuery.S3EncryptionOption requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_EncryptionOption = null;
            if (cmdletContext.S3Configuration_EncryptionOption != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_EncryptionOption = cmdletContext.S3Configuration_EncryptionOption;
            }
            if (requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_EncryptionOption != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration.EncryptionOption = requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_EncryptionOption;
                requestErrorReportConfiguration_errorReportConfiguration_S3ConfigurationIsNull            = false;
            }
            System.String requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_ObjectKeyPrefix = null;
            if (cmdletContext.S3Configuration_ObjectKeyPrefix != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_ObjectKeyPrefix = cmdletContext.S3Configuration_ObjectKeyPrefix;
            }
            if (requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_ObjectKeyPrefix != null)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration.ObjectKeyPrefix = requestErrorReportConfiguration_errorReportConfiguration_S3Configuration_s3Configuration_ObjectKeyPrefix;
                requestErrorReportConfiguration_errorReportConfiguration_S3ConfigurationIsNull           = false;
            }
            // determine if requestErrorReportConfiguration_errorReportConfiguration_S3Configuration should be set to null
            if (requestErrorReportConfiguration_errorReportConfiguration_S3ConfigurationIsNull)
            {
                requestErrorReportConfiguration_errorReportConfiguration_S3Configuration = null;
            }
            if (requestErrorReportConfiguration_errorReportConfiguration_S3Configuration != null)
            {
                request.ErrorReportConfiguration.S3Configuration = requestErrorReportConfiguration_errorReportConfiguration_S3Configuration;
                requestErrorReportConfigurationIsNull            = false;
            }
            // determine if request.ErrorReportConfiguration should be set to null
            if (requestErrorReportConfigurationIsNull)
            {
                request.ErrorReportConfiguration = null;
            }
            if (cmdletContext.KmsKeyId != null)
            {
                request.KmsKeyId = cmdletContext.KmsKeyId;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            // populate NotificationConfiguration
            var requestNotificationConfigurationIsNull = true;

            request.NotificationConfiguration = new Amazon.TimestreamQuery.Model.NotificationConfiguration();
            Amazon.TimestreamQuery.Model.SnsConfiguration requestNotificationConfiguration_notificationConfiguration_SnsConfiguration = null;

            // populate SnsConfiguration
            var requestNotificationConfiguration_notificationConfiguration_SnsConfigurationIsNull = true;

            requestNotificationConfiguration_notificationConfiguration_SnsConfiguration = new Amazon.TimestreamQuery.Model.SnsConfiguration();
            System.String requestNotificationConfiguration_notificationConfiguration_SnsConfiguration_snsConfiguration_TopicArn = null;
            if (cmdletContext.SnsConfiguration_TopicArn != null)
            {
                requestNotificationConfiguration_notificationConfiguration_SnsConfiguration_snsConfiguration_TopicArn = cmdletContext.SnsConfiguration_TopicArn;
            }
            if (requestNotificationConfiguration_notificationConfiguration_SnsConfiguration_snsConfiguration_TopicArn != null)
            {
                requestNotificationConfiguration_notificationConfiguration_SnsConfiguration.TopicArn = requestNotificationConfiguration_notificationConfiguration_SnsConfiguration_snsConfiguration_TopicArn;
                requestNotificationConfiguration_notificationConfiguration_SnsConfigurationIsNull    = false;
            }
            // determine if requestNotificationConfiguration_notificationConfiguration_SnsConfiguration should be set to null
            if (requestNotificationConfiguration_notificationConfiguration_SnsConfigurationIsNull)
            {
                requestNotificationConfiguration_notificationConfiguration_SnsConfiguration = null;
            }
            if (requestNotificationConfiguration_notificationConfiguration_SnsConfiguration != null)
            {
                request.NotificationConfiguration.SnsConfiguration = requestNotificationConfiguration_notificationConfiguration_SnsConfiguration;
                requestNotificationConfigurationIsNull             = false;
            }
            // determine if request.NotificationConfiguration should be set to null
            if (requestNotificationConfigurationIsNull)
            {
                request.NotificationConfiguration = null;
            }
            if (cmdletContext.QueryString != null)
            {
                request.QueryString = cmdletContext.QueryString;
            }

            // populate ScheduleConfiguration
            var requestScheduleConfigurationIsNull = true;

            request.ScheduleConfiguration = new Amazon.TimestreamQuery.Model.ScheduleConfiguration();
            System.String requestScheduleConfiguration_scheduleConfiguration_ScheduleExpression = null;
            if (cmdletContext.ScheduleConfiguration_ScheduleExpression != null)
            {
                requestScheduleConfiguration_scheduleConfiguration_ScheduleExpression = cmdletContext.ScheduleConfiguration_ScheduleExpression;
            }
            if (requestScheduleConfiguration_scheduleConfiguration_ScheduleExpression != null)
            {
                request.ScheduleConfiguration.ScheduleExpression = requestScheduleConfiguration_scheduleConfiguration_ScheduleExpression;
                requestScheduleConfigurationIsNull = false;
            }
            // determine if request.ScheduleConfiguration should be set to null
            if (requestScheduleConfigurationIsNull)
            {
                request.ScheduleConfiguration = null;
            }
            if (cmdletContext.ScheduledQueryExecutionRoleArn != null)
            {
                request.ScheduledQueryExecutionRoleArn = cmdletContext.ScheduledQueryExecutionRoleArn;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            // populate TargetConfiguration
            var requestTargetConfigurationIsNull = true;

            request.TargetConfiguration = new Amazon.TimestreamQuery.Model.TargetConfiguration();
            Amazon.TimestreamQuery.Model.TimestreamConfiguration requestTargetConfiguration_targetConfiguration_TimestreamConfiguration = null;

            // populate TimestreamConfiguration
            var requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull = true;

            requestTargetConfiguration_targetConfiguration_TimestreamConfiguration = new Amazon.TimestreamQuery.Model.TimestreamConfiguration();
            System.String requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DatabaseName = null;
            if (cmdletContext.TimestreamConfiguration_DatabaseName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DatabaseName = cmdletContext.TimestreamConfiguration_DatabaseName;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DatabaseName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.DatabaseName = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DatabaseName;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull        = false;
            }
            List <Amazon.TimestreamQuery.Model.DimensionMapping> requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DimensionMapping = null;

            if (cmdletContext.TimestreamConfiguration_DimensionMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DimensionMapping = cmdletContext.TimestreamConfiguration_DimensionMapping;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DimensionMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.DimensionMappings = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_DimensionMapping;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull             = false;
            }
            System.String requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MeasureNameColumn = null;
            if (cmdletContext.TimestreamConfiguration_MeasureNameColumn != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MeasureNameColumn = cmdletContext.TimestreamConfiguration_MeasureNameColumn;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MeasureNameColumn != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.MeasureNameColumn = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MeasureNameColumn;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull             = false;
            }
            List <Amazon.TimestreamQuery.Model.MixedMeasureMapping> requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MixedMeasureMapping = null;

            if (cmdletContext.TimestreamConfiguration_MixedMeasureMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MixedMeasureMapping = cmdletContext.TimestreamConfiguration_MixedMeasureMapping;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MixedMeasureMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.MixedMeasureMappings = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_MixedMeasureMapping;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull = false;
            }
            System.String requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TableName = null;
            if (cmdletContext.TimestreamConfiguration_TableName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TableName = cmdletContext.TimestreamConfiguration_TableName;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TableName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.TableName = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TableName;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull     = false;
            }
            System.String requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TimeColumn = null;
            if (cmdletContext.TimestreamConfiguration_TimeColumn != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TimeColumn = cmdletContext.TimestreamConfiguration_TimeColumn;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TimeColumn != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.TimeColumn = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_timestreamConfiguration_TimeColumn;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull      = false;
            }
            Amazon.TimestreamQuery.Model.MultiMeasureMappings requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings = null;

            // populate MultiMeasureMappings
            var requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappingsIsNull = true;

            requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings = new Amazon.TimestreamQuery.Model.MultiMeasureMappings();
            List <Amazon.TimestreamQuery.Model.MultiMeasureAttributeMapping> requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_MultiMeasureAttributeMapping = null;

            if (cmdletContext.MultiMeasureMappings_MultiMeasureAttributeMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_MultiMeasureAttributeMapping = cmdletContext.MultiMeasureMappings_MultiMeasureAttributeMapping;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_MultiMeasureAttributeMapping != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings.MultiMeasureAttributeMappings = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_MultiMeasureAttributeMapping;
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappingsIsNull = false;
            }
            System.String requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_TargetMultiMeasureName = null;
            if (cmdletContext.MultiMeasureMappings_TargetMultiMeasureName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_TargetMultiMeasureName = cmdletContext.MultiMeasureMappings_TargetMultiMeasureName;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_TargetMultiMeasureName != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings.TargetMultiMeasureName = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings_multiMeasureMappings_TargetMultiMeasureName;
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappingsIsNull = false;
            }
            // determine if requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings should be set to null
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappingsIsNull)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings = null;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings != null)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration.MultiMeasureMappings = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration_targetConfiguration_TimestreamConfiguration_MultiMeasureMappings;
                requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull = false;
            }
            // determine if requestTargetConfiguration_targetConfiguration_TimestreamConfiguration should be set to null
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfigurationIsNull)
            {
                requestTargetConfiguration_targetConfiguration_TimestreamConfiguration = null;
            }
            if (requestTargetConfiguration_targetConfiguration_TimestreamConfiguration != null)
            {
                request.TargetConfiguration.TimestreamConfiguration = requestTargetConfiguration_targetConfiguration_TimestreamConfiguration;
                requestTargetConfigurationIsNull = false;
            }
            // determine if request.TargetConfiguration should be set to null
            if (requestTargetConfigurationIsNull)
            {
                request.TargetConfiguration = null;
            }

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