private Amazon.AuditManager.Model.UpdateAssessmentResponse CallAWSServiceOperation(IAmazonAuditManager client, Amazon.AuditManager.Model.UpdateAssessmentRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Audit Manager", "UpdateAssessment"); try { #if DESKTOP return(client.UpdateAssessment(request)); #elif CORECLR return(client.UpdateAssessmentAsync(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.AuditManager.Model.UpdateAssessmentRequest(); if (cmdletContext.AssessmentDescription != null) { request.AssessmentDescription = cmdletContext.AssessmentDescription; } if (cmdletContext.AssessmentId != null) { request.AssessmentId = cmdletContext.AssessmentId; } if (cmdletContext.AssessmentName != null) { request.AssessmentName = cmdletContext.AssessmentName; } // populate AssessmentReportsDestination var requestAssessmentReportsDestinationIsNull = true; request.AssessmentReportsDestination = new Amazon.AuditManager.Model.AssessmentReportsDestination(); System.String requestAssessmentReportsDestination_assessmentReportsDestination_Destination = null; if (cmdletContext.AssessmentReportsDestination_Destination != null) { requestAssessmentReportsDestination_assessmentReportsDestination_Destination = cmdletContext.AssessmentReportsDestination_Destination; } if (requestAssessmentReportsDestination_assessmentReportsDestination_Destination != null) { request.AssessmentReportsDestination.Destination = requestAssessmentReportsDestination_assessmentReportsDestination_Destination; requestAssessmentReportsDestinationIsNull = false; } Amazon.AuditManager.AssessmentReportDestinationType requestAssessmentReportsDestination_assessmentReportsDestination_DestinationType = null; if (cmdletContext.AssessmentReportsDestination_DestinationType != null) { requestAssessmentReportsDestination_assessmentReportsDestination_DestinationType = cmdletContext.AssessmentReportsDestination_DestinationType; } if (requestAssessmentReportsDestination_assessmentReportsDestination_DestinationType != null) { request.AssessmentReportsDestination.DestinationType = requestAssessmentReportsDestination_assessmentReportsDestination_DestinationType; requestAssessmentReportsDestinationIsNull = false; } // determine if request.AssessmentReportsDestination should be set to null if (requestAssessmentReportsDestinationIsNull) { request.AssessmentReportsDestination = null; } if (cmdletContext.Role != null) { request.Roles = cmdletContext.Role; } // populate Scope var requestScopeIsNull = true; request.Scope = new Amazon.AuditManager.Model.Scope(); List <Amazon.AuditManager.Model.AWSAccount> requestScope_scope_AwsAccount = null; if (cmdletContext.Scope_AwsAccount != null) { requestScope_scope_AwsAccount = cmdletContext.Scope_AwsAccount; } if (requestScope_scope_AwsAccount != null) { request.Scope.AwsAccounts = requestScope_scope_AwsAccount; requestScopeIsNull = false; } List <Amazon.AuditManager.Model.AWSService> requestScope_scope_AwsService = null; if (cmdletContext.Scope_AwsService != null) { requestScope_scope_AwsService = cmdletContext.Scope_AwsService; } if (requestScope_scope_AwsService != null) { request.Scope.AwsServices = requestScope_scope_AwsService; requestScopeIsNull = false; } // determine if request.Scope should be set to null if (requestScopeIsNull) { request.Scope = 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); }