@azure/arm-security
Version:
A generated SDK for SecurityCenter.
113 lines (106 loc) • 3.5 kB
text/typescript
/*
* 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 { AdvancedThreatProtection } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SecurityCenter } from "../securityCenter";
import {
AdvancedThreatProtectionGetOptionalParams,
AdvancedThreatProtectionGetResponse,
AdvancedThreatProtectionSetting,
AdvancedThreatProtectionCreateOptionalParams,
AdvancedThreatProtectionCreateResponse
} from "../models";
/** Class containing AdvancedThreatProtection operations. */
export class AdvancedThreatProtectionImpl implements AdvancedThreatProtection {
private readonly client: SecurityCenter;
/**
* Initialize a new instance of the class AdvancedThreatProtection class.
* @param client Reference to the service client
*/
constructor(client: SecurityCenter) {
this.client = client;
}
/**
* Gets the Advanced Threat Protection settings for the specified resource.
* @param resourceId The identifier of the resource.
* @param options The options parameters.
*/
get(
resourceId: string,
options?: AdvancedThreatProtectionGetOptionalParams
): Promise<AdvancedThreatProtectionGetResponse> {
return this.client.sendOperationRequest(
{ resourceId, options },
getOperationSpec
);
}
/**
* Creates or updates the Advanced Threat Protection settings on a specified resource.
* @param resourceId The identifier of the resource.
* @param advancedThreatProtectionSetting Advanced Threat Protection Settings
* @param options The options parameters.
*/
create(
resourceId: string,
advancedThreatProtectionSetting: AdvancedThreatProtectionSetting,
options?: AdvancedThreatProtectionCreateOptionalParams
): Promise<AdvancedThreatProtectionCreateResponse> {
return this.client.sendOperationRequest(
{ resourceId, advancedThreatProtectionSetting, options },
createOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path:
"/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AdvancedThreatProtectionSetting
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion4],
urlParameters: [
Parameters.$host,
Parameters.resourceId,
Parameters.settingName
],
headerParameters: [Parameters.accept],
serializer
};
const createOperationSpec: coreClient.OperationSpec = {
path:
"/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.AdvancedThreatProtectionSetting
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.advancedThreatProtectionSetting,
queryParameters: [Parameters.apiVersion4],
urlParameters: [
Parameters.$host,
Parameters.resourceId,
Parameters.settingName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};