Example #1
0
        /// <summary>
        /// Delete a task from a TaskQueue.
        /// Documentation https://developers.google.com/taskqueue/v1beta2/reference/tasks/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">The taskqueue to delete a task from.</param>
        /// <param name="task">The id of the task to delete.</param>
        public static void Delete(TaskqueueService service, string project, string taskqueue, string task)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }
                if (task == null)
                {
                    throw new ArgumentNullException(task);
                }

                // Make the request.
                service.Tasks.Delete(project, taskqueue, task).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Delete failed.", ex);
            }
        }
Example #2
0
        /// <summary>
        /// List Tasks in a TaskQueue
        /// Documentation https://developers.google.com/taskqueue/v1beta2/reference/tasks/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">The id of the taskqueue to list tasks from.</param>
        /// <returns>Tasks2Response</returns>
        public static Tasks2 List(TaskqueueService service, string project, string taskqueue)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }

                // Make the request.
                return(service.Tasks.List(project, taskqueue).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.List failed.", ex);
            }
        }
Example #3
0
        /// <summary>
        /// Get detailed information about a TaskQueue.
        /// Documentation https://developers.google.com/taskqueue/v1beta1/reference/taskqueues/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">The id of the taskqueue to get the properties of.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TaskQueueResponse</returns>
        public static TaskQueue Get(TaskqueueService service, string project, string taskqueue, TaskqueuesGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }

                // Building the initial request.
                var request = service.Taskqueues.Get(project, taskqueue);

                // Applying optional parameters to the request.
                request = (TaskqueuesResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Taskqueues.Get failed.", ex);
            }
        }
Example #4
0
        /// <summary>
        /// Lease 1 or more tasks from a TaskQueue.
        /// Documentation https://developers.google.com/taskqueue/v1beta1/reference/tasks/lease
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">The taskqueue to lease a task from.</param>
        /// <param name="numTasks">The number of tasks to lease.</param>
        /// <param name="leaseSecs">The lease in seconds.</param>
        /// <returns>TasksResponse</returns>
        public static Tasks Lease(TaskqueueService service, string project, string taskqueue, int?numTasks, int?leaseSecs)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }
                if (numTasks == null)
                {
                    throw new ArgumentNullException(numTasks);
                }
                if (leaseSecs == null)
                {
                    throw new ArgumentNullException(leaseSecs);
                }

                // Make the request.
                return(service.Tasks.Lease(project, taskqueue, numTasks, leaseSecs).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Lease failed.", ex);
            }
        }
Example #5
0
        /// <summary>
        /// Lease 1 or more tasks from a TaskQueue.
        /// Documentation https://developers.google.com/taskqueue/v1beta2/reference/tasks/lease
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">The taskqueue to lease a task from.</param>
        /// <param name="numTasks">The number of tasks to lease.</param>
        /// <param name="leaseSecs">The lease in seconds.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TasksResponse</returns>
        public static Tasks Lease(TaskqueueService service, string project, string taskqueue, int?numTasks, int?leaseSecs, TasksLeaseOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }
                if (numTasks == null)
                {
                    throw new ArgumentNullException(numTasks);
                }
                if (leaseSecs == null)
                {
                    throw new ArgumentNullException(leaseSecs);
                }

                // Building the initial request.
                var request = service.Tasks.Lease(project, taskqueue, numTasks, leaseSecs);

                // Applying optional parameters to the request.
                request = (TasksResource.LeaseRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Lease failed.", ex);
            }
        }
Example #6
0
        /// <summary>
        /// Update tasks that are leased out of a TaskQueue.
        /// Documentation https://developers.google.com/taskqueue/v1beta2/reference/tasks/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Taskqueue service.</param>
        /// <param name="project">The project under which the queue lies.</param>
        /// <param name="taskqueue">NA</param>
        /// <param name="task">NA</param>
        /// <param name="newLeaseSeconds">The new lease in seconds.</param>
        /// <param name="body">A valid Taskqueue v1beta2 body.</param>
        /// <returns>TaskResponse</returns>
        public static Task Update(TaskqueueService service, string project, string taskqueue, string task, int?newLeaseSeconds, Task body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (taskqueue == null)
                {
                    throw new ArgumentNullException(taskqueue);
                }
                if (task == null)
                {
                    throw new ArgumentNullException(task);
                }
                if (newLeaseSeconds == null)
                {
                    throw new ArgumentNullException(newLeaseSeconds);
                }

                // Make the request.
                return(service.Tasks.Update(body, project, taskqueue, task, newLeaseSeconds).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Tasks.Update failed.", ex);
            }
        }