Exemple #1
0
 private Amazon.GuardDuty.Model.UpdatePublishingDestinationResponse CallAWSServiceOperation(IAmazonGuardDuty client, Amazon.GuardDuty.Model.UpdatePublishingDestinationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GuardDuty", "UpdatePublishingDestination");
     try
     {
         #if DESKTOP
         return(client.UpdatePublishingDestination(request));
         #elif CORECLR
         return(client.UpdatePublishingDestinationAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.GuardDuty.Model.UpdatePublishingDestinationRequest();

            if (cmdletContext.DestinationId != null)
            {
                request.DestinationId = cmdletContext.DestinationId;
            }

            // 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.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);
        }