Aracılığıyla paylaş


Offer class

Mevcut Teklif kimliğe göre okumak veya değiştirmek için kullanın.

Tüm teklifleri sorgulamak veya okumak için bkz. Teklifler.

Özellikler

client
id
url

Kaynağa bir başvuru URL'si döndürür. İzinler'de bağlantı için kullanılır.

Yöntemler

read(RequestOptions)

Verilen Teklifiiçin OfferDefinition okuyun.

Örnek

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });

const { resource: offer } = await client.offer("<offer-id>").read();
replace(OfferDefinition, RequestOptions)

Verilen Teklifi belirtilen OfferDefinitionile değiştirin.

Örnek

Teklifi, güncelleştirilmiş aktarım hızına sahip yeni bir teklif tanımıyla değiştirin

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { resource: offer } = await client.offer("<offer-id>").read();
// @ts-preservewhitespace
offer.content.offerThroughput = 1000;
await client.offer("<offer-id>").replace(offer);

Özellik Ayrıntıları

client

client: CosmosClient

Özellik Değeri

id

id: string

Özellik Değeri

string

url

Kaynağa bir başvuru URL'si döndürür. İzinler'de bağlantı için kullanılır.

string url

Özellik Değeri

string

Yöntem Ayrıntıları

read(RequestOptions)

Verilen Teklifiiçin OfferDefinition okuyun.

Örnek

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });

const { resource: offer } = await client.offer("<offer-id>").read();
function read(options?: RequestOptions): Promise<OfferResponse>

Parametreler

options
RequestOptions

Döndürülenler

Promise<OfferResponse>

replace(OfferDefinition, RequestOptions)

Verilen Teklifi belirtilen OfferDefinitionile değiştirin.

Örnek

Teklifi, güncelleştirilmiş aktarım hızına sahip yeni bir teklif tanımıyla değiştirin

import { CosmosClient } from "@azure/cosmos";

const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { resource: offer } = await client.offer("<offer-id>").read();
// @ts-preservewhitespace
offer.content.offerThroughput = 1000;
await client.offer("<offer-id>").replace(offer);
function replace(body: OfferDefinition, options?: RequestOptions): Promise<OfferResponse>

Parametreler

options
RequestOptions

Döndürülenler

Promise<OfferResponse>