private Amazon.SimpleSystemsManagement.Model.PutComplianceItemsResponse CallAWSServiceOperation(IAmazonSimpleSystemsManagement client, Amazon.SimpleSystemsManagement.Model.PutComplianceItemsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Systems Manager", "PutComplianceItems"); try { #if DESKTOP return(client.PutComplianceItems(request)); #elif CORECLR return(client.PutComplianceItemsAsync(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.SimpleSystemsManagement.Model.PutComplianceItemsRequest(); if (cmdletContext.ComplianceType != null) { request.ComplianceType = cmdletContext.ComplianceType; } // populate ExecutionSummary var requestExecutionSummaryIsNull = true; request.ExecutionSummary = new Amazon.SimpleSystemsManagement.Model.ComplianceExecutionSummary(); System.String requestExecutionSummary_executionSummary_ExecutionId = null; if (cmdletContext.ExecutionSummary_ExecutionId != null) { requestExecutionSummary_executionSummary_ExecutionId = cmdletContext.ExecutionSummary_ExecutionId; } if (requestExecutionSummary_executionSummary_ExecutionId != null) { request.ExecutionSummary.ExecutionId = requestExecutionSummary_executionSummary_ExecutionId; requestExecutionSummaryIsNull = false; } System.DateTime?requestExecutionSummary_executionSummary_ExecutionTime = null; if (cmdletContext.ExecutionSummary_ExecutionTime != null) { requestExecutionSummary_executionSummary_ExecutionTime = cmdletContext.ExecutionSummary_ExecutionTime.Value; } if (requestExecutionSummary_executionSummary_ExecutionTime != null) { request.ExecutionSummary.ExecutionTime = requestExecutionSummary_executionSummary_ExecutionTime.Value; requestExecutionSummaryIsNull = false; } System.String requestExecutionSummary_executionSummary_ExecutionType = null; if (cmdletContext.ExecutionSummary_ExecutionType != null) { requestExecutionSummary_executionSummary_ExecutionType = cmdletContext.ExecutionSummary_ExecutionType; } if (requestExecutionSummary_executionSummary_ExecutionType != null) { request.ExecutionSummary.ExecutionType = requestExecutionSummary_executionSummary_ExecutionType; requestExecutionSummaryIsNull = false; } // determine if request.ExecutionSummary should be set to null if (requestExecutionSummaryIsNull) { request.ExecutionSummary = null; } if (cmdletContext.ItemContentHash != null) { request.ItemContentHash = cmdletContext.ItemContentHash; } if (cmdletContext.Item != null) { request.Items = cmdletContext.Item; } if (cmdletContext.ResourceId != null) { request.ResourceId = cmdletContext.ResourceId; } if (cmdletContext.ResourceType != null) { request.ResourceType = cmdletContext.ResourceType; } 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); }