IDocumentClient.ReplaceOfferAsync(Offer) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Replaces a Offer in the Azure Cosmos DB service as an asynchronous operation.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Offer>> ReplaceOfferAsync (Microsoft.Azure.Documents.Offer offer);
abstract member ReplaceOfferAsync : Microsoft.Azure.Documents.Offer -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Offer>>
Public Function ReplaceOfferAsync (offer As Offer) As Task(Of ResourceResponse(Of Offer))
Parameters
Returns
A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a Offer containing the updated resource record.
Exceptions
If offer
is not set.
This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:
StatusCode | Reason for exception |
---|---|
404 | NotFound - This means the resource you tried to delete did not exist. |
429 | TooManyRequests - The replace offer is throttled as the offer scale down operation is attempted within the idle timeout period of 4 hours. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation. |
Examples
//Fetch the resource to be updated
Offer offer = client.CreateOfferQuery()
.Where(r => r.ResourceLink == "collection selfLink")
.AsEnumerable()
.SingleOrDefault();
//Create a new offer with the changed throughput
OfferV2 newOffer = new OfferV2(offer, 5000);
//Now persist these changes to the database by replacing the original resource
Offer updated = await client.ReplaceOfferAsync(newOffer);
Applies to
See also
Azure SDK for .NET