Skip to content

ENG-53576: Changing POST methods by PUT ones for update, enable and disable functions for aecontent api #850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/aecontent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@al/aecontent",
"version": "0.0.14",
"version": "0.0.15",
"license": "MIT",
"description": "A client for interacting with the Alert Logic Aecontent Public API",
"author": {
Expand Down
38 changes: 27 additions & 11 deletions packages/aecontent/src/aecontent-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ export class AecontentClientInstance {
});
}

/**
* Update Tuning rule
* PUT
*
* @param accountId string tuning rule's belonging account id
*
*/
public async updateRule(accountId: string, data: AlTuningRule): Promise<any> {
return this.client.put<any>({
data,
service_name: this.serviceName,
path: `${accountId}/tunings`,
version: 'v1'
});
}

/**
* delete Tuning rule
* DELETE
Expand All @@ -62,14 +78,14 @@ export class AecontentClientInstance {
* @param name string tuning rule's name
*
*/
public async deleteRule(accountId: string, name: string): Promise<void> {
public async deleteRule(accountId: string, uuid: string): Promise<void> {
return this.client.delete<void>({
service_name: this.serviceName,
path: `${accountId}/tunings`,
version: 'v1',
params: {
name: name
}
uuid: uuid
}
});
}

Expand Down Expand Up @@ -113,38 +129,38 @@ export class AecontentClientInstance {

/**
* enable a Tuning rule
* POST
* PUT
*
* @param accountId string tuning rule's belonging account id
* @param name name of the rule to enable
*
*/
public async enableRule(accountId: string, name: string): Promise<any> {
return this.client.post<any>({
public async enableRule(accountId: string, uuid: string): Promise<any> {
return this.client.put<any>({
service_name: this.serviceName,
path: `${accountId}/tunings/enable`,
version: 'v1',
params: {
name: name
uuid: uuid
}
});
}

/**
* disable a Tuning rule
* POST
* PUT
*
* @param accountId string tuning rule's belonging account id
* @param name name of the rule to disable
*
*/
public async disableRule(accountId: string, name: string): Promise<any> {
return this.client.post<any>({
public async disableRule(accountId: string, uuid: string): Promise<any> {
return this.client.put<any>({
service_name: this.serviceName,
path: `${accountId}/tunings/disable`,
version: 'v1',
params: {
name: name
uuid: uuid
}
});
}
Expand Down
5 changes: 4 additions & 1 deletion packages/aecontent/src/types/aecontent-client-tuning.type.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
export interface AlTuningRule {
name: string;
description?: string;
tuning: AlTuningDetails;
uuid?: string;
version?: string;
schema_version?: string;
}

export interface AlTuningDetails {
type: string;
selector: AlTuningSelectorDetails;
rules: AlTuningRulesDetails[];
actions: AlTuningActionsDetails[];
description?: string;
}

export interface AlTuningOptionDetails {
Expand Down