private static void UnmarshallResult(XmlUnmarshallerContext context, CancelJobResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Success", targetDepth))
                    {
                        response.Success = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }



            return;
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();


            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("description", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Description = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("jobArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.JobArn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("jobId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.JobId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        /// <summary>
        /// <para> This operation cancels a specified job. Only the job owner can
        /// cancel it. The operation fails if the job has already started or is
        /// complete. </para>
        /// </summary>
        ///
        /// <param name="cancelJobRequest">Container for the necessary parameters
        ///           to execute the CancelJob service method on AmazonImportExport.</param>
        ///
        /// <returns>The response from the CancelJob service method, as returned
        ///         by AmazonImportExport.</returns>
        ///
        /// <exception cref="CanceledJobIdException"/>
        /// <exception cref="ExpiredJobIdException"/>
        /// <exception cref="InvalidAccessKeyIdException"/>
        /// <exception cref="InvalidJobIdException"/>
        /// <exception cref="UnableToCancelJobIdException"/>
        public CancelJobResponse CancelJob(CancelJobRequest cancelJobRequest)
        {
            IRequest <CancelJobRequest> request  = new CancelJobRequestMarshaller().Marshall(cancelJobRequest);
            CancelJobResponse           response = Invoke <CancelJobRequest, CancelJobResponse> (request, this.signer, CancelJobResponseUnmarshaller.GetInstance());

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();


            return response;
        }
Example #6
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("CancelJobResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Example #7
0
        public static CancelJobResponse Unmarshall(UnmarshallerContext context)
        {
            CancelJobResponse cancelJobResponse = new CancelJobResponse();

            cancelJobResponse.HttpResponse = context.HttpResponse;
            cancelJobResponse.RequestId    = context.StringValue("CancelJob.RequestId");
            cancelJobResponse.JobId        = context.StringValue("CancelJob.JobId");

            return(cancelJobResponse);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();

            context.Read();

            response.CancelJobResult = CancelJobResultUnmarshaller.GetInstance().Unmarshall(context);

            return(response);
        }
Example #9
0
        public void JobCancelJobRequest()
        {
            CreateJobResponse createResponse = Zencoder.CreateJob("s3://bucket-name/file-name.avi", null, null, null, true, false);

            Assert.IsTrue(createResponse.Success);

            CancelJobResponse cancelResponse = Zencoder.CancelJob(createResponse.Id);

            Assert.IsTrue(cancelResponse.Success);
        }
        public static CancelJobResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CancelJobResponse cancelJobResponse = new CancelJobResponse();

            cancelJobResponse.HttpResponse = _ctx.HttpResponse;
            cancelJobResponse.RequestId    = _ctx.StringValue("CancelJob.RequestId");
            cancelJobResponse.Success      = _ctx.BooleanValue("CancelJob.Success");
            cancelJobResponse.Code         = _ctx.StringValue("CancelJob.Code");
            cancelJobResponse.ErrorMessage = _ctx.StringValue("CancelJob.ErrorMessage");

            return(cancelJobResponse);
        }
Example #11
0
        private static void ConfigureCancelJobRequest(SimpleMapper mapper)
        {
            mapper.CreateMap <CancelJobRequest, IppRequestMessage>((src, map) =>
            {
                var dst = new IppRequestMessage {
                    IppOperation = IppOperation.CancelJob
                };
                mapper.Map <IIppJobRequest, IppRequestMessage>(src, dst);
                return(dst);
            });

            mapper.CreateMap <IppResponseMessage, CancelJobResponse>((src, map) =>
            {
                var dst = new CancelJobResponse();
                map.Map <IppResponseMessage, IIppResponseMessage>(src, dst);
                return(dst);
            });
        }
Example #12
0
        public void JobCancelJobRequest()
        {
            CreateJobResponse createResponse = Zencoder.CreateJob("s3://bucket-name/file-name.avi", null, null, null, true);

            Assert.IsTrue(createResponse.Success);

            CancelJobResponse cancelResponse = Zencoder.CancelJob(createResponse.Id);

            Assert.IsTrue(cancelResponse.Success);

            AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) };

            Zencoder.CancelJob(
                createResponse.Id,
                r =>
            {
                Assert.IsTrue(r.InConflict);
                handles[0].Set();
            });

            WaitHandle.WaitAll(handles);
        }
Example #13
0
        public void JobCancelJobRequestAsync()
        {
            CreateJobResponse createResponse = Zencoder.CreateJob("s3://bucket-name/file-name.avi", null, null, null, true, false);

            Assert.IsTrue(createResponse.Success);

            AutoResetEvent[] handles = new AutoResetEvent[] { new AutoResetEvent(false) };

            CancelJobResponse asyncResponse = null;

            Zencoder.CancelJob(
                createResponse.Id,
                r =>
            {
                asyncResponse = r;
                handles[0].Set();
            });

            WaitHandle.WaitAll(handles);
            Assert.IsNotNull(asyncResponse);
            Assert.IsTrue(asyncResponse.Success);
        }
Example #14
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CancelJobResponse response = new CancelJobResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("CancelJobResult", 2))
                    {
                        response.CancelJobResult = CancelJobResultUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }
 private static void UnmarshallResult(JsonUnmarshallerContext context, CancelJobResponse response)
 {
     return;
 }