private Amazon.RecycleBin.Model.UpdateRuleResponse CallAWSServiceOperation(IAmazonRecycleBin client, Amazon.RecycleBin.Model.UpdateRuleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Recycle Bin", "UpdateRule"); try { #if DESKTOP return(client.UpdateRule(request)); #elif CORECLR return(client.UpdateRuleAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.RecycleBin.Model.UpdateRuleRequest(); if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Identifier != null) { request.Identifier = cmdletContext.Identifier; } if (cmdletContext.ResourceTag != null) { request.ResourceTags = cmdletContext.ResourceTag; } if (cmdletContext.ResourceType != null) { request.ResourceType = cmdletContext.ResourceType; } // populate RetentionPeriod var requestRetentionPeriodIsNull = true; request.RetentionPeriod = new Amazon.RecycleBin.Model.RetentionPeriod(); Amazon.RecycleBin.RetentionPeriodUnit requestRetentionPeriod_retentionPeriod_RetentionPeriodUnit = null; if (cmdletContext.RetentionPeriod_RetentionPeriodUnit != null) { requestRetentionPeriod_retentionPeriod_RetentionPeriodUnit = cmdletContext.RetentionPeriod_RetentionPeriodUnit; } if (requestRetentionPeriod_retentionPeriod_RetentionPeriodUnit != null) { request.RetentionPeriod.RetentionPeriodUnit = requestRetentionPeriod_retentionPeriod_RetentionPeriodUnit; requestRetentionPeriodIsNull = false; } System.Int32?requestRetentionPeriod_retentionPeriod_RetentionPeriodValue = null; if (cmdletContext.RetentionPeriod_RetentionPeriodValue != null) { requestRetentionPeriod_retentionPeriod_RetentionPeriodValue = cmdletContext.RetentionPeriod_RetentionPeriodValue.Value; } if (requestRetentionPeriod_retentionPeriod_RetentionPeriodValue != null) { request.RetentionPeriod.RetentionPeriodValue = requestRetentionPeriod_retentionPeriod_RetentionPeriodValue.Value; requestRetentionPeriodIsNull = false; } // determine if request.RetentionPeriod should be set to null if (requestRetentionPeriodIsNull) { request.RetentionPeriod = 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); }