@azure/arm-dns
Version:
A generated SDK for DnsManagementClient.
605 lines • 23.4 kB
JavaScript
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
import { setContinuationToken } from "../pagingHelper";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
/// <reference lib="esnext.asynciterable" />
/** Class containing RecordSets operations. */
export class RecordSetsImpl {
/**
* Initialize a new instance of the class RecordSets class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Lists the record sets of a specified type in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param options The options parameters.
*/
listByType(resourceGroupName, zoneName, recordType, options) {
const iter = this.listByTypePagingAll(resourceGroupName, zoneName, recordType, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByTypePagingPage(resourceGroupName, zoneName, recordType, options, settings);
}
};
}
listByTypePagingPage(resourceGroupName, zoneName, recordType, options, settings) {
return __asyncGenerator(this, arguments, function* listByTypePagingPage_1() {
let result;
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
if (!continuationToken) {
result = yield __await(this._listByType(resourceGroupName, zoneName, recordType, options));
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
while (continuationToken) {
result = yield __await(this._listByTypeNext(resourceGroupName, zoneName, recordType, continuationToken, options));
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
});
}
listByTypePagingAll(resourceGroupName, zoneName, recordType, options) {
return __asyncGenerator(this, arguments, function* listByTypePagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listByTypePagingPage(resourceGroupName, zoneName, recordType, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_1) throw e_1.error; }
}
});
}
/**
* Lists all record sets in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param options The options parameters.
*/
listByDnsZone(resourceGroupName, zoneName, options) {
const iter = this.listByDnsZonePagingAll(resourceGroupName, zoneName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByDnsZonePagingPage(resourceGroupName, zoneName, options, settings);
}
};
}
listByDnsZonePagingPage(resourceGroupName, zoneName, options, settings) {
return __asyncGenerator(this, arguments, function* listByDnsZonePagingPage_1() {
let result;
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
if (!continuationToken) {
result = yield __await(this._listByDnsZone(resourceGroupName, zoneName, options));
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
while (continuationToken) {
result = yield __await(this._listByDnsZoneNext(resourceGroupName, zoneName, continuationToken, options));
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
});
}
listByDnsZonePagingAll(resourceGroupName, zoneName, options) {
return __asyncGenerator(this, arguments, function* listByDnsZonePagingAll_1() {
var e_2, _a;
try {
for (var _b = __asyncValues(this.listByDnsZonePagingPage(resourceGroupName, zoneName, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_2) throw e_2.error; }
}
});
}
/**
* Lists all record sets in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param options The options parameters.
*/
listAllByDnsZone(resourceGroupName, zoneName, options) {
const iter = this.listAllByDnsZonePagingAll(resourceGroupName, zoneName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listAllByDnsZonePagingPage(resourceGroupName, zoneName, options, settings);
}
};
}
listAllByDnsZonePagingPage(resourceGroupName, zoneName, options, settings) {
return __asyncGenerator(this, arguments, function* listAllByDnsZonePagingPage_1() {
let result;
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
if (!continuationToken) {
result = yield __await(this._listAllByDnsZone(resourceGroupName, zoneName, options));
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
while (continuationToken) {
result = yield __await(this._listAllByDnsZoneNext(resourceGroupName, zoneName, continuationToken, options));
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield yield __await(page);
}
});
}
listAllByDnsZonePagingAll(resourceGroupName, zoneName, options) {
return __asyncGenerator(this, arguments, function* listAllByDnsZonePagingAll_1() {
var e_3, _a;
try {
for (var _b = __asyncValues(this.listAllByDnsZonePagingPage(resourceGroupName, zoneName, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
const page = _c.value;
yield __await(yield* __asyncDelegator(__asyncValues(page)));
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
}
finally { if (e_3) throw e_3.error; }
}
});
}
/**
* Updates a record set within a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Parameters supplied to the Update operation.
* @param options The options parameters.
*/
update(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) {
return this.client.sendOperationRequest({
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
parameters,
options
}, updateOperationSpec);
}
/**
* Creates or updates a record set within a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated
* but not created (they are created when the DNS zone is created).
* @param parameters Parameters supplied to the CreateOrUpdate operation.
* @param options The options parameters.
*/
createOrUpdate(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, options) {
return this.client.sendOperationRequest({
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
parameters,
options
}, createOrUpdateOperationSpec);
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be
* deleted (they are deleted when the DNS zone is deleted).
* @param options The options parameters.
*/
delete(resourceGroupName, zoneName, relativeRecordSetName, recordType, options) {
return this.client.sendOperationRequest({
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
options
}, deleteOperationSpec);
}
/**
* Gets a record set.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param options The options parameters.
*/
get(resourceGroupName, zoneName, relativeRecordSetName, recordType, options) {
return this.client.sendOperationRequest({
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
options
}, getOperationSpec);
}
/**
* Lists the record sets of a specified type in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param options The options parameters.
*/
_listByType(resourceGroupName, zoneName, recordType, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, recordType, options }, listByTypeOperationSpec);
}
/**
* Lists all record sets in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param options The options parameters.
*/
_listByDnsZone(resourceGroupName, zoneName, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, options }, listByDnsZoneOperationSpec);
}
/**
* Lists all record sets in a DNS zone.
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param options The options parameters.
*/
_listAllByDnsZone(resourceGroupName, zoneName, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, options }, listAllByDnsZoneOperationSpec);
}
/**
* ListByTypeNext
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param nextLink The nextLink from the previous successful call to the ListByType method.
* @param options The options parameters.
*/
_listByTypeNext(resourceGroupName, zoneName, recordType, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, recordType, nextLink, options }, listByTypeNextOperationSpec);
}
/**
* ListByDnsZoneNext
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param nextLink The nextLink from the previous successful call to the ListByDnsZone method.
* @param options The options parameters.
*/
_listByDnsZoneNext(resourceGroupName, zoneName, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, nextLink, options }, listByDnsZoneNextOperationSpec);
}
/**
* ListAllByDnsZoneNext
* @param resourceGroupName The name of the resource group.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param nextLink The nextLink from the previous successful call to the ListAllByDnsZone method.
* @param options The options parameters.
*/
_listAllByDnsZoneNext(resourceGroupName, zoneName, nextLink, options) {
return this.client.sendOperationRequest({ resourceGroupName, zoneName, nextLink, options }, listAllByDnsZoneNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const updateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.RecordSet
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.relativeRecordSetName,
Parameters.recordType,
Parameters.subscriptionId
],
headerParameters: [
Parameters.contentType,
Parameters.accept,
Parameters.ifMatch
],
mediaType: "json",
serializer
};
const createOrUpdateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.RecordSet
},
201: {
bodyMapper: Mappers.RecordSet
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.relativeRecordSetName,
Parameters.recordType,
Parameters.subscriptionId
],
headerParameters: [
Parameters.contentType,
Parameters.accept,
Parameters.ifMatch,
Parameters.ifNoneMatch
],
mediaType: "json",
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.relativeRecordSetName,
Parameters.recordType,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept, Parameters.ifMatch],
serializer
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSet
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.relativeRecordSetName,
Parameters.recordType,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listByTypeOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordsetnamesuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.recordType,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listByDnsZoneOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordsetnamesuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listAllByDnsZoneOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordSetNameSuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listByTypeNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordsetnamesuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.recordType,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listByDnsZoneNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordsetnamesuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listAllByDnsZoneNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.RecordSetListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [
Parameters.apiVersion,
Parameters.top,
Parameters.recordSetNameSuffix
],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.zoneName,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=recordSets.js.map