public void ModifyAckDeadline_RequestObject() { // Snippet: ModifyAckDeadline(ModifyAckDeadlineRequest,CallSettings) // Create client SubscriberClient subscriberClient = SubscriberClient.Create(); // Initialize request argument(s) ModifyAckDeadlineRequest request = new ModifyAckDeadlineRequest { SubscriptionAsSubscriptionName = new SubscriptionName("[PROJECT]", "[SUBSCRIPTION]"), AckIds = { }, AckDeadlineSeconds = 0, }; // Make the request subscriberClient.ModifyAckDeadline(request); // End snippet }
/// <summary> /// Modifies the Ack deadline for a message received from a pull request. /// Documentation https://developers.google.com/pubsub/v1beta1a/reference/subscriptions/modifyAckDeadline /// 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 Pubsub service.</param> /// <param name="body">A valid Pubsub v1beta1a body.</param> /// <returns>EmptyResponse</returns> public static Empty ModifyAckDeadline(PubsubService service, ModifyAckDeadlineRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Subscriptions.ModifyAckDeadline(body).Execute()); } catch (Exception ex) { throw new Exception("Request Subscriptions.ModifyAckDeadline failed.", ex); } }
protected override void PerformAction(IList<string> ackIds, string subscriptionName) { ModifyAckDeadlineRequest requestBody = new ModifyAckDeadlineRequest() { AckDeadlineSeconds = AckDeadline, AckIds = ackIds }; try { ProjectsResource.SubscriptionsResource.ModifyAckDeadlineRequest request = Service.Projects.Subscriptions.ModifyAckDeadline(requestBody, subscriptionName); request.Execute(); } catch (GoogleApiException ex) when (ex.HttpStatusCode == HttpStatusCode.NotFound) { WriteResourceMissingError( exceptionMessage: $"Subscription '{subscriptionName}' does not exist in project '{Project}'.", errorId: "SubscriptionNotFound", targetObject: subscriptionName); return; } }