generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨add synchronization with configmanager
- Loading branch information
1 parent
c7c7c2c
commit 66670fa
Showing
9 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
controlpanel/cad/src/app/services/api/configmanager-api.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { lastValueFrom } from 'rxjs'; | ||
import { ApiResponse } from '../../models/api-response'; | ||
import { GlobalStateService } from '../global-state.service'; | ||
import { Decoy } from '../../models/decoy'; | ||
import { Config } from '../../models/config'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ConfigmanagerApiService { | ||
|
||
constructor(private http: HttpClient, private globalState: GlobalStateService) { } | ||
|
||
async updateConfigmanagerDecoys(namespace: string, application: string, decoys: Decoy[]) { | ||
try { | ||
return await lastValueFrom(this.http.put<ApiResponse>(`${this.globalState.API_URL}/configmanager/decoys/${namespace}/${application}`, decoys)); | ||
} catch (e) { | ||
console.error(e); | ||
return { message: 'Cannot synchronize decoys with configmanager', type: 'error' }; | ||
} | ||
} | ||
async updateConfigmanagerConfig(namespace: string, application: string, config: Config) { | ||
try { | ||
return await lastValueFrom(this.http.put<ApiResponse>(`${this.globalState.API_URL}/configmanager/config/${namespace}/${application}`, config)); | ||
} catch (e) { | ||
console.error(e); | ||
return { message: 'Cannot synchronize config with configmanager', type: 'error' }; | ||
} | ||
} | ||
async getConfigmanagerDecoys(namespace: string, application: string) { | ||
try { | ||
return await lastValueFrom(this.http.get<ApiResponse>(`${this.globalState.API_URL}/configmanager/decoys/${namespace}/${application}`)); | ||
} catch (e) { | ||
console.error(e); | ||
return { message: 'Cannot synchronize config with configmanager', type: 'error' }; | ||
} | ||
} | ||
|
||
} |