Пример #1
0
 private Amazon.IoTSiteWise.Model.UpdatePortalResponse CallAWSServiceOperation(IAmazonIoTSiteWise client, Amazon.IoTSiteWise.Model.UpdatePortalRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT SiteWise", "UpdatePortal");
     try
     {
         #if DESKTOP
         return(client.UpdatePortal(request));
         #elif CORECLR
         return(client.UpdatePortalAsync(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)
        {
            System.IO.MemoryStream _File_DataStream = null;

            try
            {
                var cmdletContext = context as CmdletContext;
                // create request
                var request = new Amazon.IoTSiteWise.Model.UpdatePortalRequest();


                // populate Alarms
                var requestAlarmsIsNull = true;
                request.Alarms = new Amazon.IoTSiteWise.Model.Alarms();
                System.String requestAlarms_alarms_AlarmRoleArn = null;
                if (cmdletContext.Alarms_AlarmRoleArn != null)
                {
                    requestAlarms_alarms_AlarmRoleArn = cmdletContext.Alarms_AlarmRoleArn;
                }
                if (requestAlarms_alarms_AlarmRoleArn != null)
                {
                    request.Alarms.AlarmRoleArn = requestAlarms_alarms_AlarmRoleArn;
                    requestAlarmsIsNull         = false;
                }
                System.String requestAlarms_alarms_NotificationLambdaArn = null;
                if (cmdletContext.Alarms_NotificationLambdaArn != null)
                {
                    requestAlarms_alarms_NotificationLambdaArn = cmdletContext.Alarms_NotificationLambdaArn;
                }
                if (requestAlarms_alarms_NotificationLambdaArn != null)
                {
                    request.Alarms.NotificationLambdaArn = requestAlarms_alarms_NotificationLambdaArn;
                    requestAlarmsIsNull = false;
                }
                // determine if request.Alarms should be set to null
                if (requestAlarmsIsNull)
                {
                    request.Alarms = null;
                }
                if (cmdletContext.ClientToken != null)
                {
                    request.ClientToken = cmdletContext.ClientToken;
                }
                if (cmdletContext.NotificationSenderEmail != null)
                {
                    request.NotificationSenderEmail = cmdletContext.NotificationSenderEmail;
                }
                if (cmdletContext.PortalContactEmail != null)
                {
                    request.PortalContactEmail = cmdletContext.PortalContactEmail;
                }
                if (cmdletContext.PortalDescription != null)
                {
                    request.PortalDescription = cmdletContext.PortalDescription;
                }
                if (cmdletContext.PortalId != null)
                {
                    request.PortalId = cmdletContext.PortalId;
                }

                // populate PortalLogoImage
                var requestPortalLogoImageIsNull = true;
                request.PortalLogoImage = new Amazon.IoTSiteWise.Model.Image();
                System.String requestPortalLogoImage_portalLogoImage_Id = null;
                if (cmdletContext.PortalLogoImage_Id != null)
                {
                    requestPortalLogoImage_portalLogoImage_Id = cmdletContext.PortalLogoImage_Id;
                }
                if (requestPortalLogoImage_portalLogoImage_Id != null)
                {
                    request.PortalLogoImage.Id   = requestPortalLogoImage_portalLogoImage_Id;
                    requestPortalLogoImageIsNull = false;
                }
                Amazon.IoTSiteWise.Model.ImageFile requestPortalLogoImage_portalLogoImage_File = null;

                // populate File
                var requestPortalLogoImage_portalLogoImage_FileIsNull = true;
                requestPortalLogoImage_portalLogoImage_File = new Amazon.IoTSiteWise.Model.ImageFile();
                System.IO.MemoryStream requestPortalLogoImage_portalLogoImage_File_file_Data = null;
                if (cmdletContext.File_Data != null)
                {
                    _File_DataStream = new System.IO.MemoryStream(cmdletContext.File_Data);
                    requestPortalLogoImage_portalLogoImage_File_file_Data = _File_DataStream;
                }
                if (requestPortalLogoImage_portalLogoImage_File_file_Data != null)
                {
                    requestPortalLogoImage_portalLogoImage_File.Data  = requestPortalLogoImage_portalLogoImage_File_file_Data;
                    requestPortalLogoImage_portalLogoImage_FileIsNull = false;
                }
                Amazon.IoTSiteWise.ImageFileType requestPortalLogoImage_portalLogoImage_File_file_Type = null;
                if (cmdletContext.File_Type != null)
                {
                    requestPortalLogoImage_portalLogoImage_File_file_Type = cmdletContext.File_Type;
                }
                if (requestPortalLogoImage_portalLogoImage_File_file_Type != null)
                {
                    requestPortalLogoImage_portalLogoImage_File.Type  = requestPortalLogoImage_portalLogoImage_File_file_Type;
                    requestPortalLogoImage_portalLogoImage_FileIsNull = false;
                }
                // determine if requestPortalLogoImage_portalLogoImage_File should be set to null
                if (requestPortalLogoImage_portalLogoImage_FileIsNull)
                {
                    requestPortalLogoImage_portalLogoImage_File = null;
                }
                if (requestPortalLogoImage_portalLogoImage_File != null)
                {
                    request.PortalLogoImage.File = requestPortalLogoImage_portalLogoImage_File;
                    requestPortalLogoImageIsNull = false;
                }
                // determine if request.PortalLogoImage should be set to null
                if (requestPortalLogoImageIsNull)
                {
                    request.PortalLogoImage = null;
                }
                if (cmdletContext.PortalName != null)
                {
                    request.PortalName = cmdletContext.PortalName;
                }
                if (cmdletContext.RoleArn != null)
                {
                    request.RoleArn = cmdletContext.RoleArn;
                }

                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);
            }
            finally
            {
                if (_File_DataStream != null)
                {
                    _File_DataStream.Dispose();
                }
            }
        }