次の方法で共有


Offer class

既存の オファー を ID で読み取ったり置き換えたりするために使用します。

すべてのプラン クエリまたは読み取りを行うプランの を参照してください。

プロパティ

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に置き換えます。

オファーを新しいオファー定義と置き換え、スループットが更新された

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に置き換えます。

オファーを新しいオファー定義と置き換え、スループットが更新された

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>

パラメーター

body
OfferDefinition

指定した OfferDefinition

options
RequestOptions

戻り値

Promise<OfferResponse>