Пример #1
0
 private Amazon.DynamoDBv2.Model.UpdateTimeToLiveResponse CallAWSServiceOperation(IAmazonDynamoDB client, Amazon.DynamoDBv2.Model.UpdateTimeToLiveRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon DynamoDB", "UpdateTimeToLive");
     try
     {
         #if DESKTOP
         return(client.UpdateTimeToLive(request));
         #elif CORECLR
         return(client.UpdateTimeToLiveAsync(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;
     }
 }
Пример #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.DynamoDBv2.Model.UpdateTimeToLiveRequest();

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

            // populate TimeToLiveSpecification
            var requestTimeToLiveSpecificationIsNull = true;

            request.TimeToLiveSpecification = new Amazon.DynamoDBv2.Model.TimeToLiveSpecification();
            System.String requestTimeToLiveSpecification_timeToLiveSpecification_AttributeName = null;
            if (cmdletContext.TimeToLiveSpecification_AttributeName != null)
            {
                requestTimeToLiveSpecification_timeToLiveSpecification_AttributeName = cmdletContext.TimeToLiveSpecification_AttributeName;
            }
            if (requestTimeToLiveSpecification_timeToLiveSpecification_AttributeName != null)
            {
                request.TimeToLiveSpecification.AttributeName = requestTimeToLiveSpecification_timeToLiveSpecification_AttributeName;
                requestTimeToLiveSpecificationIsNull          = false;
            }
            System.Boolean?requestTimeToLiveSpecification_timeToLiveSpecification_Enabled = null;
            if (cmdletContext.TimeToLiveSpecification_Enabled != null)
            {
                requestTimeToLiveSpecification_timeToLiveSpecification_Enabled = cmdletContext.TimeToLiveSpecification_Enabled.Value;
            }
            if (requestTimeToLiveSpecification_timeToLiveSpecification_Enabled != null)
            {
                request.TimeToLiveSpecification.Enabled = requestTimeToLiveSpecification_timeToLiveSpecification_Enabled.Value;
                requestTimeToLiveSpecificationIsNull    = false;
            }
            // determine if request.TimeToLiveSpecification should be set to null
            if (requestTimeToLiveSpecificationIsNull)
            {
                request.TimeToLiveSpecification = 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);
        }