private Amazon.Batch.Model.UpdateSchedulingPolicyResponse CallAWSServiceOperation(IAmazonBatch client, Amazon.Batch.Model.UpdateSchedulingPolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Batch", "UpdateSchedulingPolicy"); try { #if DESKTOP return(client.UpdateSchedulingPolicy(request)); #elif CORECLR return(client.UpdateSchedulingPolicyAsync(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.Batch.Model.UpdateSchedulingPolicyRequest(); if (cmdletContext.Arn != null) { request.Arn = cmdletContext.Arn; } // populate FairsharePolicy var requestFairsharePolicyIsNull = true; request.FairsharePolicy = new Amazon.Batch.Model.FairsharePolicy(); System.Int32?requestFairsharePolicy_fairsharePolicy_ComputeReservation = null; if (cmdletContext.FairsharePolicy_ComputeReservation != null) { requestFairsharePolicy_fairsharePolicy_ComputeReservation = cmdletContext.FairsharePolicy_ComputeReservation.Value; } if (requestFairsharePolicy_fairsharePolicy_ComputeReservation != null) { request.FairsharePolicy.ComputeReservation = requestFairsharePolicy_fairsharePolicy_ComputeReservation.Value; requestFairsharePolicyIsNull = false; } System.Int32?requestFairsharePolicy_fairsharePolicy_ShareDecaySecond = null; if (cmdletContext.FairsharePolicy_ShareDecaySecond != null) { requestFairsharePolicy_fairsharePolicy_ShareDecaySecond = cmdletContext.FairsharePolicy_ShareDecaySecond.Value; } if (requestFairsharePolicy_fairsharePolicy_ShareDecaySecond != null) { request.FairsharePolicy.ShareDecaySeconds = requestFairsharePolicy_fairsharePolicy_ShareDecaySecond.Value; requestFairsharePolicyIsNull = false; } List <Amazon.Batch.Model.ShareAttributes> requestFairsharePolicy_fairsharePolicy_ShareDistribution = null; if (cmdletContext.FairsharePolicy_ShareDistribution != null) { requestFairsharePolicy_fairsharePolicy_ShareDistribution = cmdletContext.FairsharePolicy_ShareDistribution; } if (requestFairsharePolicy_fairsharePolicy_ShareDistribution != null) { request.FairsharePolicy.ShareDistribution = requestFairsharePolicy_fairsharePolicy_ShareDistribution; requestFairsharePolicyIsNull = false; } // determine if request.FairsharePolicy should be set to null if (requestFairsharePolicyIsNull) { request.FairsharePolicy = 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); }