private Amazon.GuardDuty.Model.CreatePublishingDestinationResponse CallAWSServiceOperation(IAmazonGuardDuty client, Amazon.GuardDuty.Model.CreatePublishingDestinationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GuardDuty", "CreatePublishingDestination"); try { #if DESKTOP return(client.CreatePublishingDestination(request)); #elif CORECLR return(client.CreatePublishingDestinationAsync(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.GuardDuty.Model.CreatePublishingDestinationRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } // populate DestinationProperties var requestDestinationPropertiesIsNull = true; request.DestinationProperties = new Amazon.GuardDuty.Model.DestinationProperties(); System.String requestDestinationProperties_destinationProperties_DestinationArn = null; if (cmdletContext.DestinationProperties_DestinationArn != null) { requestDestinationProperties_destinationProperties_DestinationArn = cmdletContext.DestinationProperties_DestinationArn; } if (requestDestinationProperties_destinationProperties_DestinationArn != null) { request.DestinationProperties.DestinationArn = requestDestinationProperties_destinationProperties_DestinationArn; requestDestinationPropertiesIsNull = false; } System.String requestDestinationProperties_destinationProperties_KmsKeyArn = null; if (cmdletContext.DestinationProperties_KmsKeyArn != null) { requestDestinationProperties_destinationProperties_KmsKeyArn = cmdletContext.DestinationProperties_KmsKeyArn; } if (requestDestinationProperties_destinationProperties_KmsKeyArn != null) { request.DestinationProperties.KmsKeyArn = requestDestinationProperties_destinationProperties_KmsKeyArn; requestDestinationPropertiesIsNull = false; } // determine if request.DestinationProperties should be set to null if (requestDestinationPropertiesIsNull) { request.DestinationProperties = null; } if (cmdletContext.DestinationType != null) { request.DestinationType = cmdletContext.DestinationType; } if (cmdletContext.DetectorId != null) { request.DetectorId = cmdletContext.DetectorId; } 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); }