@azure/arm-security
Version:
A generated SDK for SecurityCenter.
202 lines • 7.84 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 * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
/// <reference lib="esnext.asynciterable" />
/** Class containing InformationProtectionPolicies operations. */
export class InformationProtectionPoliciesImpl {
/**
* Initialize a new instance of the class InformationProtectionPolicies class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Information protection policies of a specific management group.
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param options The options parameters.
*/
list(scope, options) {
const iter = this.listPagingAll(scope, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(scope, options);
}
};
}
listPagingPage(scope, options) {
return __asyncGenerator(this, arguments, function* listPagingPage_1() {
let result = yield __await(this._list(scope, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listNext(scope, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listPagingAll(scope, options) {
return __asyncGenerator(this, arguments, function* listPagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listPagingPage(scope, 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; }
}
});
}
/**
* Details of the information protection policy.
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param informationProtectionPolicyName Name of the information protection policy.
* @param options The options parameters.
*/
get(scope, informationProtectionPolicyName, options) {
return this.client.sendOperationRequest({ scope, informationProtectionPolicyName, options }, getOperationSpec);
}
/**
* Details of the information protection policy.
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param informationProtectionPolicyName Name of the information protection policy.
* @param informationProtectionPolicy Information protection policy.
* @param options The options parameters.
*/
createOrUpdate(scope, informationProtectionPolicyName, informationProtectionPolicy, options) {
return this.client.sendOperationRequest({
scope,
informationProtectionPolicyName,
informationProtectionPolicy,
options
}, createOrUpdateOperationSpec);
}
/**
* Information protection policies of a specific management group.
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param options The options parameters.
*/
_list(scope, options) {
return this.client.sendOperationRequest({ scope, options }, listOperationSpec);
}
/**
* ListNext
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
_listNext(scope, nextLink, options) {
return this.client.sendOperationRequest({ scope, nextLink, options }, listNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.InformationProtectionPolicy
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion7],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.informationProtectionPolicyName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.InformationProtectionPolicy
},
201: {
bodyMapper: Mappers.InformationProtectionPolicy
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.informationProtectionPolicy,
queryParameters: [Parameters.apiVersion7],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.informationProtectionPolicyName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/informationProtectionPolicies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.InformationProtectionPolicyList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion7],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.InformationProtectionPolicyList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion7],
urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=informationProtectionPolicies.js.map