示例#1
0
 private Amazon.Backup.Model.UpdateReportPlanResponse CallAWSServiceOperation(IAmazonBackup client, Amazon.Backup.Model.UpdateReportPlanRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Backup", "UpdateReportPlan");
     try
     {
         #if DESKTOP
         return(client.UpdateReportPlan(request));
         #elif CORECLR
         return(client.UpdateReportPlanAsync(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;
     }
 }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Backup.Model.UpdateReportPlanRequest();

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

            // populate ReportDeliveryChannel
            var requestReportDeliveryChannelIsNull = true;

            request.ReportDeliveryChannel = new Amazon.Backup.Model.ReportDeliveryChannel();
            List <System.String> requestReportDeliveryChannel_reportDeliveryChannel_Format = null;

            if (cmdletContext.ReportDeliveryChannel_Format != null)
            {
                requestReportDeliveryChannel_reportDeliveryChannel_Format = cmdletContext.ReportDeliveryChannel_Format;
            }
            if (requestReportDeliveryChannel_reportDeliveryChannel_Format != null)
            {
                request.ReportDeliveryChannel.Formats = requestReportDeliveryChannel_reportDeliveryChannel_Format;
                requestReportDeliveryChannelIsNull    = false;
            }
            System.String requestReportDeliveryChannel_reportDeliveryChannel_S3BucketName = null;
            if (cmdletContext.ReportDeliveryChannel_S3BucketName != null)
            {
                requestReportDeliveryChannel_reportDeliveryChannel_S3BucketName = cmdletContext.ReportDeliveryChannel_S3BucketName;
            }
            if (requestReportDeliveryChannel_reportDeliveryChannel_S3BucketName != null)
            {
                request.ReportDeliveryChannel.S3BucketName = requestReportDeliveryChannel_reportDeliveryChannel_S3BucketName;
                requestReportDeliveryChannelIsNull         = false;
            }
            System.String requestReportDeliveryChannel_reportDeliveryChannel_S3KeyPrefix = null;
            if (cmdletContext.ReportDeliveryChannel_S3KeyPrefix != null)
            {
                requestReportDeliveryChannel_reportDeliveryChannel_S3KeyPrefix = cmdletContext.ReportDeliveryChannel_S3KeyPrefix;
            }
            if (requestReportDeliveryChannel_reportDeliveryChannel_S3KeyPrefix != null)
            {
                request.ReportDeliveryChannel.S3KeyPrefix = requestReportDeliveryChannel_reportDeliveryChannel_S3KeyPrefix;
                requestReportDeliveryChannelIsNull        = false;
            }
            // determine if request.ReportDeliveryChannel should be set to null
            if (requestReportDeliveryChannelIsNull)
            {
                request.ReportDeliveryChannel = null;
            }
            if (cmdletContext.ReportPlanDescription != null)
            {
                request.ReportPlanDescription = cmdletContext.ReportPlanDescription;
            }
            if (cmdletContext.ReportPlanName != null)
            {
                request.ReportPlanName = cmdletContext.ReportPlanName;
            }

            // populate ReportSetting
            var requestReportSettingIsNull = true;

            request.ReportSetting = new Amazon.Backup.Model.ReportSetting();
            List <System.String> requestReportSetting_reportSetting_FrameworkArn = null;

            if (cmdletContext.ReportSetting_FrameworkArn != null)
            {
                requestReportSetting_reportSetting_FrameworkArn = cmdletContext.ReportSetting_FrameworkArn;
            }
            if (requestReportSetting_reportSetting_FrameworkArn != null)
            {
                request.ReportSetting.FrameworkArns = requestReportSetting_reportSetting_FrameworkArn;
                requestReportSettingIsNull          = false;
            }
            System.Int32?requestReportSetting_reportSetting_NumberOfFramework = null;
            if (cmdletContext.ReportSetting_NumberOfFramework != null)
            {
                requestReportSetting_reportSetting_NumberOfFramework = cmdletContext.ReportSetting_NumberOfFramework.Value;
            }
            if (requestReportSetting_reportSetting_NumberOfFramework != null)
            {
                request.ReportSetting.NumberOfFrameworks = requestReportSetting_reportSetting_NumberOfFramework.Value;
                requestReportSettingIsNull = false;
            }
            System.String requestReportSetting_reportSetting_ReportTemplate = null;
            if (cmdletContext.ReportSetting_ReportTemplate != null)
            {
                requestReportSetting_reportSetting_ReportTemplate = cmdletContext.ReportSetting_ReportTemplate;
            }
            if (requestReportSetting_reportSetting_ReportTemplate != null)
            {
                request.ReportSetting.ReportTemplate = requestReportSetting_reportSetting_ReportTemplate;
                requestReportSettingIsNull           = false;
            }
            // determine if request.ReportSetting should be set to null
            if (requestReportSettingIsNull)
            {
                request.ReportSetting = 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);
        }