Beispiel #1
0
 private Amazon.Inspector2.Model.UpdateOrganizationConfigurationResponse CallAWSServiceOperation(IAmazonInspector2 client, Amazon.Inspector2.Model.UpdateOrganizationConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Inspector2", "UpdateOrganizationConfiguration");
     try
     {
         #if DESKTOP
         return(client.UpdateOrganizationConfiguration(request));
         #elif CORECLR
         return(client.UpdateOrganizationConfigurationAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Inspector2.Model.UpdateOrganizationConfigurationRequest();


            // populate AutoEnable
            var requestAutoEnableIsNull = true;

            request.AutoEnable = new Amazon.Inspector2.Model.AutoEnable();
            System.Boolean?requestAutoEnable_autoEnable_Ec2 = null;
            if (cmdletContext.AutoEnable_Ec2 != null)
            {
                requestAutoEnable_autoEnable_Ec2 = cmdletContext.AutoEnable_Ec2.Value;
            }
            if (requestAutoEnable_autoEnable_Ec2 != null)
            {
                request.AutoEnable.Ec2  = requestAutoEnable_autoEnable_Ec2.Value;
                requestAutoEnableIsNull = false;
            }
            System.Boolean?requestAutoEnable_autoEnable_Ecr = null;
            if (cmdletContext.AutoEnable_Ecr != null)
            {
                requestAutoEnable_autoEnable_Ecr = cmdletContext.AutoEnable_Ecr.Value;
            }
            if (requestAutoEnable_autoEnable_Ecr != null)
            {
                request.AutoEnable.Ecr  = requestAutoEnable_autoEnable_Ecr.Value;
                requestAutoEnableIsNull = false;
            }
            // determine if request.AutoEnable should be set to null
            if (requestAutoEnableIsNull)
            {
                request.AutoEnable = 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);
        }