private Amazon.SecurityHub.Model.BatchUpdateFindingsResponse CallAWSServiceOperation(IAmazonSecurityHub client, Amazon.SecurityHub.Model.BatchUpdateFindingsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Security Hub", "BatchUpdateFindings"); try { #if DESKTOP return(client.BatchUpdateFindings(request)); #elif CORECLR return(client.BatchUpdateFindingsAsync(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.SecurityHub.Model.BatchUpdateFindingsRequest(); if (cmdletContext.Confidence != null) { request.Confidence = cmdletContext.Confidence.Value; } if (cmdletContext.Criticality != null) { request.Criticality = cmdletContext.Criticality.Value; } if (cmdletContext.FindingIdentifier != null) { request.FindingIdentifiers = cmdletContext.FindingIdentifier; } // populate Note var requestNoteIsNull = true; request.Note = new Amazon.SecurityHub.Model.NoteUpdate(); System.String requestNote_note_Text = null; if (cmdletContext.Note_Text != null) { requestNote_note_Text = cmdletContext.Note_Text; } if (requestNote_note_Text != null) { request.Note.Text = requestNote_note_Text; requestNoteIsNull = false; } System.String requestNote_note_UpdatedBy = null; if (cmdletContext.Note_UpdatedBy != null) { requestNote_note_UpdatedBy = cmdletContext.Note_UpdatedBy; } if (requestNote_note_UpdatedBy != null) { request.Note.UpdatedBy = requestNote_note_UpdatedBy; requestNoteIsNull = false; } // determine if request.Note should be set to null if (requestNoteIsNull) { request.Note = null; } if (cmdletContext.RelatedFinding != null) { request.RelatedFindings = cmdletContext.RelatedFinding; } // populate Severity var requestSeverityIsNull = true; request.Severity = new Amazon.SecurityHub.Model.SeverityUpdate(); Amazon.SecurityHub.SeverityLabel requestSeverity_severity_Label = null; if (cmdletContext.Severity_Label != null) { requestSeverity_severity_Label = cmdletContext.Severity_Label; } if (requestSeverity_severity_Label != null) { request.Severity.Label = requestSeverity_severity_Label; requestSeverityIsNull = false; } System.Int32?requestSeverity_severity_Normalized = null; if (cmdletContext.Severity_Normalized != null) { requestSeverity_severity_Normalized = cmdletContext.Severity_Normalized.Value; } if (requestSeverity_severity_Normalized != null) { request.Severity.Normalized = requestSeverity_severity_Normalized.Value; requestSeverityIsNull = false; } System.Double?requestSeverity_severity_Product = null; if (cmdletContext.Severity_Product != null) { requestSeverity_severity_Product = cmdletContext.Severity_Product.Value; } if (requestSeverity_severity_Product != null) { request.Severity.Product = requestSeverity_severity_Product.Value; requestSeverityIsNull = false; } // determine if request.Severity should be set to null if (requestSeverityIsNull) { request.Severity = null; } if (cmdletContext.Type != null) { request.Types = cmdletContext.Type; } if (cmdletContext.UserDefinedField != null) { request.UserDefinedFields = cmdletContext.UserDefinedField; } if (cmdletContext.VerificationState != null) { request.VerificationState = cmdletContext.VerificationState; } // populate Workflow var requestWorkflowIsNull = true; request.Workflow = new Amazon.SecurityHub.Model.WorkflowUpdate(); Amazon.SecurityHub.WorkflowStatus requestWorkflow_workflow_Status = null; if (cmdletContext.Workflow_Status != null) { requestWorkflow_workflow_Status = cmdletContext.Workflow_Status; } if (requestWorkflow_workflow_Status != null) { request.Workflow.Status = requestWorkflow_workflow_Status; requestWorkflowIsNull = false; } // determine if request.Workflow should be set to null if (requestWorkflowIsNull) { request.Workflow = 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); }