@azure/app-configuration
Version:
An isomorphic client library for the Azure App Configuration service.
1,060 lines (1,059 loc) • 40.3 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var operations_exports = {};
__export(operations_exports, {
_checkKeyValueDeserialize: () => _checkKeyValueDeserialize,
_checkKeyValueSend: () => _checkKeyValueSend,
_checkKeyValuesDeserialize: () => _checkKeyValuesDeserialize,
_checkKeyValuesSend: () => _checkKeyValuesSend,
_checkKeysDeserialize: () => _checkKeysDeserialize,
_checkKeysSend: () => _checkKeysSend,
_checkLabelsDeserialize: () => _checkLabelsDeserialize,
_checkLabelsSend: () => _checkLabelsSend,
_checkRevisionsDeserialize: () => _checkRevisionsDeserialize,
_checkRevisionsSend: () => _checkRevisionsSend,
_checkSnapshotDeserialize: () => _checkSnapshotDeserialize,
_checkSnapshotSend: () => _checkSnapshotSend,
_checkSnapshotsDeserialize: () => _checkSnapshotsDeserialize,
_checkSnapshotsSend: () => _checkSnapshotsSend,
_createSnapshotDeserialize: () => _createSnapshotDeserialize,
_createSnapshotSend: () => _createSnapshotSend,
_deleteKeyValueDeserialize: () => _deleteKeyValueDeserialize,
_deleteKeyValueSend: () => _deleteKeyValueSend,
_deleteLockDeserialize: () => _deleteLockDeserialize,
_deleteLockSend: () => _deleteLockSend,
_getKeyValueDeserialize: () => _getKeyValueDeserialize,
_getKeyValueSend: () => _getKeyValueSend,
_getKeyValuesDeserialize: () => _getKeyValuesDeserialize,
_getKeyValuesSend: () => _getKeyValuesSend,
_getKeysDeserialize: () => _getKeysDeserialize,
_getKeysSend: () => _getKeysSend,
_getLabelsDeserialize: () => _getLabelsDeserialize,
_getLabelsSend: () => _getLabelsSend,
_getOperationDetailsDeserialize: () => _getOperationDetailsDeserialize,
_getOperationDetailsSend: () => _getOperationDetailsSend,
_getRevisionsDeserialize: () => _getRevisionsDeserialize,
_getRevisionsSend: () => _getRevisionsSend,
_getSnapshotDeserialize: () => _getSnapshotDeserialize,
_getSnapshotSend: () => _getSnapshotSend,
_getSnapshotsDeserialize: () => _getSnapshotsDeserialize,
_getSnapshotsSend: () => _getSnapshotsSend,
_putKeyValueDeserialize: () => _putKeyValueDeserialize,
_putKeyValueSend: () => _putKeyValueSend,
_putLockDeserialize: () => _putLockDeserialize,
_putLockSend: () => _putLockSend,
_updateSnapshotDeserialize: () => _updateSnapshotDeserialize,
_updateSnapshotSend: () => _updateSnapshotSend,
checkKeyValue: () => checkKeyValue,
checkKeyValues: () => checkKeyValues,
checkKeys: () => checkKeys,
checkLabels: () => checkLabels,
checkRevisions: () => checkRevisions,
checkSnapshot: () => checkSnapshot,
checkSnapshots: () => checkSnapshots,
createSnapshot: () => createSnapshot,
deleteKeyValue: () => deleteKeyValue,
deleteLock: () => deleteLock,
getKeyValue: () => getKeyValue,
getKeyValues: () => getKeyValues,
getKeys: () => getKeys,
getLabels: () => getLabels,
getOperationDetails: () => getOperationDetails,
getRevisions: () => getRevisions,
getSnapshot: () => getSnapshot,
getSnapshots: () => getSnapshots,
putKeyValue: () => putKeyValue,
putLock: () => putLock,
updateSnapshot: () => updateSnapshot
});
module.exports = __toCommonJS(operations_exports);
var import_models = require("../models/models.js");
var import_pagingHelpers = require("../static-helpers/pagingHelpers.js");
var import_pollingHelpers = require("../static-helpers/pollingHelpers.js");
var import_urlTemplate = require("../static-helpers/urlTemplate.js");
var import_core_client = require("@azure-rest/core-client");
function _checkRevisionsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/revisions{?api%2Dversion,key,label,After,%24Select,tags*}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
key: options?.key,
label: options?.label,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkRevisionsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkRevisions(context, options = { requestOptions: {} }) {
const result = await _checkRevisionsSend(context, options);
return _checkRevisionsDeserialize(result);
}
function _getRevisionsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/revisions{?api%2Dversion,key,label,After,%24Select,tags*}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
key: options?.key,
label: options?.label,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kvset+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getRevisionsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models._keyValueListResultDeserializer)(result.body);
}
function getRevisions(context, options = { requestOptions: {} }) {
return (0, import_pagingHelpers.buildPagedAsyncIterator)(
context,
() => _getRevisionsSend(context, options),
_getRevisionsDeserialize,
["200"],
{
itemName: "items",
nextLinkName: "@nextLink",
apiVersion: context.apiVersion ?? "2026-04-01"
}
);
}
function _deleteLockSend(context, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/locks/{key}{?api%2Dversion,label}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).delete({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _deleteLockDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.keyValueDeserializer)(result.body);
}
async function deleteLock(context, key, options = { requestOptions: {} }) {
const result = await _deleteLockSend(context, key, options);
return _deleteLockDeserialize(result);
}
function _putLockSend(context, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/locks/{key}{?api%2Dversion,label}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).put({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _putLockDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.keyValueDeserializer)(result.body);
}
async function putLock(context, key, options = { requestOptions: {} }) {
const result = await _putLockSend(context, key, options);
return _putLockDeserialize(result);
}
function _checkLabelsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/labels{?api%2Dversion,name,After,%24Select}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
name: options?.name,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkLabelsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkLabels(context, options = { requestOptions: {} }) {
const result = await _checkLabelsSend(context, options);
return _checkLabelsDeserialize(result);
}
function _getLabelsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/labels{?api%2Dversion,name,After,%24Select}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
name: options?.name,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.labelset+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getLabelsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models._labelListResultDeserializer)(result.body);
}
function getLabels(context, options = { requestOptions: {} }) {
return (0, import_pagingHelpers.buildPagedAsyncIterator)(
context,
() => _getLabelsSend(context, options),
_getLabelsDeserialize,
["200"],
{
itemName: "items",
nextLinkName: "@nextLink",
apiVersion: context.apiVersion ?? "2026-04-01"
}
);
}
function _checkSnapshotSend(context, name, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots/{name}{?api%2Dversion}",
{
name,
"api%2Dversion": context.apiVersion ?? "2026-04-01"
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkSnapshotDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkSnapshot(context, name, options = { requestOptions: {} }) {
const result = await _checkSnapshotSend(context, name, options);
return _checkSnapshotDeserialize(result);
}
function _updateSnapshotSend(context, contentType, name, entity, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots/{name}{?api%2Dversion}",
{
name,
"api%2Dversion": context.apiVersion ?? "2026-04-01"
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).patch({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
contentType,
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json",
...options.requestOptions?.headers
},
body: (0, import_models.snapshotUpdateParametersSerializer)(entity)
});
}
async function _updateSnapshotDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.configurationSnapshotDeserializer)(result.body);
}
async function updateSnapshot(context, contentType, name, entity, options = { requestOptions: {} }) {
const result = await _updateSnapshotSend(context, contentType, name, entity, options);
return _updateSnapshotDeserialize(result);
}
function _createSnapshotSend(context, contentType, name, entity, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots/{name}{?api%2Dversion}",
{
name,
"api%2Dversion": context.apiVersion ?? "2026-04-01"
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).put({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
contentType,
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
accept: "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json",
...options.requestOptions?.headers
},
body: (0, import_models.configurationSnapshotSerializer)(entity)
});
}
async function _createSnapshotDeserialize(result) {
const expectedStatuses = ["201", "200", "202"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.configurationSnapshotDeserializer)(result.body);
}
function createSnapshot(context, contentType, name, entity, options = { requestOptions: {} }) {
return (0, import_pollingHelpers.getLongRunningPoller)(context, _createSnapshotDeserialize, ["201", "200", "202"], {
updateIntervalInMs: options?.updateIntervalInMs,
abortSignal: options?.abortSignal,
getInitialResponse: () => _createSnapshotSend(context, contentType, name, entity, options),
resourceLocationConfig: "original-uri",
apiVersion: context.apiVersion ?? "2026-04-01"
});
}
function _getOperationDetailsSend(context, snapshot, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/operations{?api%2Dversion,snapshot}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
snapshot
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/json",
...options.requestOptions?.headers
}
});
}
async function _getOperationDetailsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.operationDetailsDeserializer)(result.body);
}
async function getOperationDetails(context, snapshot, options = { requestOptions: {} }) {
const result = await _getOperationDetailsSend(context, snapshot, options);
return _getOperationDetailsDeserialize(result);
}
function _getSnapshotSend(context, name, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots/{name}{?api%2Dversion,%24Select}",
{
name,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.snapshot+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getSnapshotDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.configurationSnapshotDeserializer)(result.body);
}
async function getSnapshot(context, name, options = { requestOptions: {} }) {
const result = await _getSnapshotSend(context, name, options);
return _getSnapshotDeserialize(result);
}
function _checkSnapshotsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots{?api%2Dversion,After}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
After: options?.after
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkSnapshotsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkSnapshots(context, options = { requestOptions: {} }) {
const result = await _checkSnapshotsSend(context, options);
return _checkSnapshotsDeserialize(result);
}
function _getSnapshotsSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/snapshots{?api%2Dversion,name,After,%24Select,status}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
name: options?.name,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
status: !options?.status ? options?.status : options?.status.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
accept: "application/vnd.microsoft.appconfig.snapshotset+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getSnapshotsDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models._snapshotListResultDeserializer)(result.body);
}
function getSnapshots(context, options = { requestOptions: {} }) {
return (0, import_pagingHelpers.buildPagedAsyncIterator)(
context,
() => _getSnapshotsSend(context, options),
_getSnapshotsDeserialize,
["200"],
{
itemName: "items",
nextLinkName: "@nextLink",
apiVersion: context.apiVersion ?? "2026-04-01"
}
);
}
function _checkKeyValueSend(context, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv/{key}{?api%2Dversion,label,%24Select,tags*}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkKeyValueDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkKeyValue(context, key, options = { requestOptions: {} }) {
const result = await _checkKeyValueSend(context, key, options);
return _checkKeyValueDeserialize(result);
}
function _deleteKeyValueSend(context, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv/{key}{?api%2Dversion,label}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).delete({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _deleteKeyValueDeserialize(result) {
const expectedStatuses = ["200", "204"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return result.body ? (0, import_models.keyValueDeserializer)(result.body) : void 0;
}
async function deleteKeyValue(context, key, options = { requestOptions: {} }) {
const result = await _deleteKeyValueSend(context, key, options);
return _deleteKeyValueDeserialize(result);
}
function _putKeyValueSend(context, contentType, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv/{key}{?api%2Dversion,label}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).put({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
contentType,
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
...options.requestOptions?.headers
},
body: !options?.entity ? options?.entity : (0, import_models.keyValueSerializer)(options?.entity)
});
}
async function _putKeyValueDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.keyValueDeserializer)(result.body);
}
async function putKeyValue(context, contentType, key, options = { requestOptions: {} }) {
const result = await _putKeyValueSend(context, contentType, key, options);
return _putKeyValueDeserialize(result);
}
function _getKeyValueSend(context, key, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv/{key}{?api%2Dversion,label,%24Select,tags*}",
{
key,
"api%2Dversion": context.apiVersion ?? "2026-04-01",
label: options?.label,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getKeyValueDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models.keyValueDeserializer)(result.body);
}
async function getKeyValue(context, key, options = { requestOptions: {} }) {
const result = await _getKeyValueSend(context, key, options);
return _getKeyValueDeserialize(result);
}
function _checkKeyValuesSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv{?api%2Dversion,key,label,After,%24Select,snapshot,tags*}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
key: options?.key,
label: options?.label,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
snapshot: options?.snapshot,
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkKeyValuesDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkKeyValues(context, options = { requestOptions: {} }) {
const result = await _checkKeyValuesSend(context, options);
return _checkKeyValuesDeserialize(result);
}
function _getKeyValuesSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/kv{?api%2Dversion,key,label,After,%24Select,snapshot,tags*}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
key: options?.key,
label: options?.label,
After: options?.after,
"%24Select": !options?.select ? options?.select : options?.select.map((p) => {
return p;
}),
snapshot: options?.snapshot,
tags: !options?.tags ? options?.tags : options?.tags.map((p) => {
return p;
})
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.ifMatch !== void 0 ? { "if-match": options?.ifMatch } : {},
...options?.ifNoneMatch !== void 0 ? { "if-none-match": options?.ifNoneMatch } : {},
accept: "application/vnd.microsoft.appconfig.kvset+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getKeyValuesDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models._keyValueListResultDeserializer)(result.body);
}
function getKeyValues(context, options = { requestOptions: {} }) {
return (0, import_pagingHelpers.buildPagedAsyncIterator)(
context,
() => _getKeyValuesSend(context, options),
_getKeyValuesDeserialize,
["200"],
{
itemName: "items",
nextLinkName: "@nextLink",
apiVersion: context.apiVersion ?? "2026-04-01"
}
);
}
function _checkKeysSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/keys{?api%2Dversion,name,After}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
name: options?.name,
After: options?.after
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).head({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
...options?.clientRequestId !== void 0 ? { "x-ms-client-request-id": options?.clientRequestId } : {},
...options.requestOptions?.headers
}
});
}
async function _checkKeysDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return;
}
async function checkKeys(context, options = { requestOptions: {} }) {
const result = await _checkKeysSend(context, options);
return _checkKeysDeserialize(result);
}
function _getKeysSend(context, options = { requestOptions: {} }) {
const path = (0, import_urlTemplate.expandUrlTemplate)(
"/keys{?api%2Dversion,name,After}",
{
"api%2Dversion": context.apiVersion ?? "2026-04-01",
name: options?.name,
After: options?.after
},
{
allowReserved: options?.requestOptions?.skipUrlEncoding
}
);
return context.path(path).get({
...(0, import_core_client.operationOptionsToRequestParameters)(options),
headers: {
...options?.syncToken !== void 0 ? { "sync-token": options?.syncToken } : {},
...options?.acceptDatetime !== void 0 ? { "accept-datetime": options?.acceptDatetime } : {},
accept: "application/vnd.microsoft.appconfig.keyset+json, application/problem+json",
...options.requestOptions?.headers
}
});
}
async function _getKeysDeserialize(result) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
const error = (0, import_core_client.createRestError)(result);
if (result.body) {
error.details = (0, import_models.errorDeserializer)(result.body);
}
throw error;
}
return (0, import_models._keyListResultDeserializer)(result.body);
}
function getKeys(context, options = { requestOptions: {} }) {
return (0, import_pagingHelpers.buildPagedAsyncIterator)(
context,
() => _getKeysSend(context, options),
_getKeysDeserialize,
["200"],
{
itemName: "items",
nextLinkName: "@nextLink",
apiVersion: context.apiVersion ?? "2026-04-01"
}
);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
_checkKeyValueDeserialize,
_checkKeyValueSend,
_checkKeyValuesDeserialize,
_checkKeyValuesSend,
_checkKeysDeserialize,
_checkKeysSend,
_checkLabelsDeserialize,
_checkLabelsSend,
_checkRevisionsDeserialize,
_checkRevisionsSend,
_checkSnapshotDeserialize,
_checkSnapshotSend,
_checkSnapshotsDeserialize,
_checkSnapshotsSend,
_createSnapshotDeserialize,
_createSnapshotSend,
_deleteKeyValueDeserialize,
_deleteKeyValueSend,
_deleteLockDeserialize,
_deleteLockSend,
_getKeyValueDeserialize,
_getKeyValueSend,
_getKeyValuesDeserialize,
_getKeyValuesSend,
_getKeysDeserialize,
_getKeysSend,
_getLabelsDeserialize,
_getLabelsSend,
_getOperationDetailsDeserialize,
_getOperationDetailsSend,
_getRevisionsDeserialize,
_getRevisionsSend,
_getSnapshotDeserialize,
_getSnapshotSend,
_getSnapshotsDeserialize,
_getSnapshotsSend,
_putKeyValueDeserialize,
_putKeyValueSend,
_putLockDeserialize,
_putLockSend,
_updateSnapshotDeserialize,
_updateSnapshotSend,
checkKeyValue,
checkKeyValues,
checkKeys,
checkLabels,
checkRevisions,
checkSnapshot,
checkSnapshots,
createSnapshot,
deleteKeyValue,
deleteLock,
getKeyValue,
getKeyValues,
getKeys,
getLabels,
getOperationDetails,
getRevisions,
getSnapshot,
getSnapshots,
putKeyValue,
putLock,
updateSnapshot
});
//# sourceMappingURL=operations.js.map