Beispiel #1
0
 private Amazon.TimestreamWrite.Model.WriteRecordsResponse CallAWSServiceOperation(IAmazonTimestreamWrite client, Amazon.TimestreamWrite.Model.WriteRecordsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Timestream Write", "WriteRecords");
     try
     {
         #if DESKTOP
         return(client.WriteRecords(request));
         #elif CORECLR
         return(client.WriteRecordsAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.TimestreamWrite.Model.WriteRecordsRequest();


            // populate CommonAttributes
            var requestCommonAttributesIsNull = true;

            request.CommonAttributes = new Amazon.TimestreamWrite.Model.Record();
            List <Amazon.TimestreamWrite.Model.Dimension> requestCommonAttributes_commonAttributes_Dimension = null;

            if (cmdletContext.CommonAttributes_Dimension != null)
            {
                requestCommonAttributes_commonAttributes_Dimension = cmdletContext.CommonAttributes_Dimension;
            }
            if (requestCommonAttributes_commonAttributes_Dimension != null)
            {
                request.CommonAttributes.Dimensions = requestCommonAttributes_commonAttributes_Dimension;
                requestCommonAttributesIsNull       = false;
            }
            System.String requestCommonAttributes_commonAttributes_MeasureName = null;
            if (cmdletContext.CommonAttributes_MeasureName != null)
            {
                requestCommonAttributes_commonAttributes_MeasureName = cmdletContext.CommonAttributes_MeasureName;
            }
            if (requestCommonAttributes_commonAttributes_MeasureName != null)
            {
                request.CommonAttributes.MeasureName = requestCommonAttributes_commonAttributes_MeasureName;
                requestCommonAttributesIsNull        = false;
            }
            System.String requestCommonAttributes_commonAttributes_MeasureValue = null;
            if (cmdletContext.CommonAttributes_MeasureValue != null)
            {
                requestCommonAttributes_commonAttributes_MeasureValue = cmdletContext.CommonAttributes_MeasureValue;
            }
            if (requestCommonAttributes_commonAttributes_MeasureValue != null)
            {
                request.CommonAttributes.MeasureValue = requestCommonAttributes_commonAttributes_MeasureValue;
                requestCommonAttributesIsNull         = false;
            }
            List <Amazon.TimestreamWrite.Model.MeasureValue> requestCommonAttributes_commonAttributes_MeasureValueList = null;

            if (cmdletContext.CommonAttributes_MeasureValueList != null)
            {
                requestCommonAttributes_commonAttributes_MeasureValueList = cmdletContext.CommonAttributes_MeasureValueList;
            }
            if (requestCommonAttributes_commonAttributes_MeasureValueList != null)
            {
                request.CommonAttributes.MeasureValues = requestCommonAttributes_commonAttributes_MeasureValueList;
                requestCommonAttributesIsNull          = false;
            }
            Amazon.TimestreamWrite.MeasureValueType requestCommonAttributes_commonAttributes_MeasureValueType = null;
            if (cmdletContext.CommonAttributes_MeasureValueType != null)
            {
                requestCommonAttributes_commonAttributes_MeasureValueType = cmdletContext.CommonAttributes_MeasureValueType;
            }
            if (requestCommonAttributes_commonAttributes_MeasureValueType != null)
            {
                request.CommonAttributes.MeasureValueType = requestCommonAttributes_commonAttributes_MeasureValueType;
                requestCommonAttributesIsNull             = false;
            }
            System.String requestCommonAttributes_commonAttributes_Time = null;
            if (cmdletContext.CommonAttributes_Time != null)
            {
                requestCommonAttributes_commonAttributes_Time = cmdletContext.CommonAttributes_Time;
            }
            if (requestCommonAttributes_commonAttributes_Time != null)
            {
                request.CommonAttributes.Time = requestCommonAttributes_commonAttributes_Time;
                requestCommonAttributesIsNull = false;
            }
            Amazon.TimestreamWrite.TimeUnit requestCommonAttributes_commonAttributes_TimeUnit = null;
            if (cmdletContext.CommonAttributes_TimeUnit != null)
            {
                requestCommonAttributes_commonAttributes_TimeUnit = cmdletContext.CommonAttributes_TimeUnit;
            }
            if (requestCommonAttributes_commonAttributes_TimeUnit != null)
            {
                request.CommonAttributes.TimeUnit = requestCommonAttributes_commonAttributes_TimeUnit;
                requestCommonAttributesIsNull     = false;
            }
            System.Int64?requestCommonAttributes_commonAttributes_Version = null;
            if (cmdletContext.CommonAttributes_Version != null)
            {
                requestCommonAttributes_commonAttributes_Version = cmdletContext.CommonAttributes_Version.Value;
            }
            if (requestCommonAttributes_commonAttributes_Version != null)
            {
                request.CommonAttributes.Version = requestCommonAttributes_commonAttributes_Version.Value;
                requestCommonAttributesIsNull    = false;
            }
            // determine if request.CommonAttributes should be set to null
            if (requestCommonAttributesIsNull)
            {
                request.CommonAttributes = null;
            }
            if (cmdletContext.DatabaseName != null)
            {
                request.DatabaseName = cmdletContext.DatabaseName;
            }
            if (cmdletContext.Record != null)
            {
                request.Records = cmdletContext.Record;
            }
            if (cmdletContext.TableName != null)
            {
                request.TableName = cmdletContext.TableName;
            }

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