コード例 #1
0
 private Amazon.CloudWatchRUM.Model.PutRumEventsResponse CallAWSServiceOperation(IAmazonCloudWatchRUM client, Amazon.CloudWatchRUM.Model.PutRumEventsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "CloudWatch RUM", "PutRumEvents");
     try
     {
         #if DESKTOP
         return(client.PutRumEvents(request));
         #elif CORECLR
         return(client.PutRumEventsAsync(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.CloudWatchRUM.Model.PutRumEventsRequest();


            // populate AppMonitorDetails
            var requestAppMonitorDetailsIsNull = true;

            request.AppMonitorDetails = new Amazon.CloudWatchRUM.Model.AppMonitorDetails();
            System.String requestAppMonitorDetails_appMonitorDetails_Id = null;
            if (cmdletContext.AppMonitorDetails_Id != null)
            {
                requestAppMonitorDetails_appMonitorDetails_Id = cmdletContext.AppMonitorDetails_Id;
            }
            if (requestAppMonitorDetails_appMonitorDetails_Id != null)
            {
                request.AppMonitorDetails.Id   = requestAppMonitorDetails_appMonitorDetails_Id;
                requestAppMonitorDetailsIsNull = false;
            }
            System.String requestAppMonitorDetails_appMonitorDetails_Name = null;
            if (cmdletContext.AppMonitorDetails_Name != null)
            {
                requestAppMonitorDetails_appMonitorDetails_Name = cmdletContext.AppMonitorDetails_Name;
            }
            if (requestAppMonitorDetails_appMonitorDetails_Name != null)
            {
                request.AppMonitorDetails.Name = requestAppMonitorDetails_appMonitorDetails_Name;
                requestAppMonitorDetailsIsNull = false;
            }
            System.String requestAppMonitorDetails_appMonitorDetails_Version = null;
            if (cmdletContext.AppMonitorDetails_Version != null)
            {
                requestAppMonitorDetails_appMonitorDetails_Version = cmdletContext.AppMonitorDetails_Version;
            }
            if (requestAppMonitorDetails_appMonitorDetails_Version != null)
            {
                request.AppMonitorDetails.Version = requestAppMonitorDetails_appMonitorDetails_Version;
                requestAppMonitorDetailsIsNull    = false;
            }
            // determine if request.AppMonitorDetails should be set to null
            if (requestAppMonitorDetailsIsNull)
            {
                request.AppMonitorDetails = null;
            }
            if (cmdletContext.BatchId != null)
            {
                request.BatchId = cmdletContext.BatchId;
            }
            if (cmdletContext.Id != null)
            {
                request.Id = cmdletContext.Id;
            }
            if (cmdletContext.RumEvent != null)
            {
                request.RumEvents = cmdletContext.RumEvent;
            }

            // populate UserDetails
            var requestUserDetailsIsNull = true;

            request.UserDetails = new Amazon.CloudWatchRUM.Model.UserDetails();
            System.String requestUserDetails_userDetails_SessionId = null;
            if (cmdletContext.UserDetails_SessionId != null)
            {
                requestUserDetails_userDetails_SessionId = cmdletContext.UserDetails_SessionId;
            }
            if (requestUserDetails_userDetails_SessionId != null)
            {
                request.UserDetails.SessionId = requestUserDetails_userDetails_SessionId;
                requestUserDetailsIsNull      = false;
            }
            System.String requestUserDetails_userDetails_UserId = null;
            if (cmdletContext.UserDetails_UserId != null)
            {
                requestUserDetails_userDetails_UserId = cmdletContext.UserDetails_UserId;
            }
            if (requestUserDetails_userDetails_UserId != null)
            {
                request.UserDetails.UserId = requestUserDetails_userDetails_UserId;
                requestUserDetailsIsNull   = false;
            }
            // determine if request.UserDetails should be set to null
            if (requestUserDetailsIsNull)
            {
                request.UserDetails = 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);
        }