共用方式為


Offer class

使用 以標識碼讀取或取代現有的 供應專案

請參閱 供應專案 查詢或讀取所有供應專案。

屬性

client
id
url

傳回資源的參考 URL。 用於在許可權中連結。

方法

read(RequestOptions)

閱讀指定 供應專案OfferDefinition

範例

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)

將指定的 供應項目 取代為指定的 OfferDefinition

範例

將 offer 替換為具有更新輸送量的新 offer 定義

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);

屬性詳細資料

client

client: CosmosClient

屬性值

id

id: string

屬性值

string

url

傳回資源的參考 URL。 用於在許可權中連結。

string url

屬性值

string

方法詳細資料

read(RequestOptions)

閱讀指定 供應專案OfferDefinition

範例

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>

參數

options
RequestOptions

傳回

Promise<OfferResponse>

replace(OfferDefinition, RequestOptions)

將指定的 供應項目 取代為指定的 OfferDefinition

範例

將 offer 替換為具有更新輸送量的新 offer 定義

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>

參數

options
RequestOptions

傳回

Promise<OfferResponse>