github.com/argoproj/argo-cd/v2@v2.10.9/ui/src/app/shared/services/repocreds-service.ts (about) 1 import * as models from '../models'; 2 import requests from './requests'; 3 4 export class RepoCredsService { 5 public list(): Promise<models.RepoCreds[]> { 6 return requests 7 .get('/repocreds') 8 .then(res => res.body as models.RepoCredsList) 9 .then(list => list.items || []); 10 } 11 12 public createHTTPS({ 13 url, 14 username, 15 password, 16 tlsClientCertData, 17 tlsClientCertKey, 18 proxy 19 }: { 20 url: string; 21 username: string; 22 password: string; 23 tlsClientCertData: string; 24 tlsClientCertKey: string; 25 proxy: string; 26 }): Promise<models.RepoCreds> { 27 return requests 28 .post('/repocreds') 29 .send({url, username, password, tlsClientCertData, tlsClientCertKey, proxy}) 30 .then(res => res.body as models.RepoCreds); 31 } 32 33 public createSSH({url, sshPrivateKey}: {url: string; sshPrivateKey: string}): Promise<models.RepoCreds> { 34 return requests 35 .post('/repocreds') 36 .send({url, sshPrivateKey}) 37 .then(res => res.body as models.RepoCreds); 38 } 39 40 public createGitHubApp({ 41 url, 42 githubAppPrivateKey, 43 githubAppId, 44 githubAppInstallationId, 45 githubAppEnterpriseBaseURL, 46 tlsClientCertData, 47 tlsClientCertKey, 48 proxy 49 }: { 50 url: string; 51 githubAppPrivateKey: string; 52 githubAppId: bigint; 53 githubAppInstallationId: bigint; 54 githubAppEnterpriseBaseURL: string; 55 tlsClientCertData: string; 56 tlsClientCertKey: string; 57 proxy: string; 58 }): Promise<models.RepoCreds> { 59 return requests 60 .post('/repocreds') 61 .send({url, githubAppPrivateKey, githubAppId, githubAppInstallationId, githubAppEnterpriseBaseURL, tlsClientCertData, tlsClientCertKey, proxy}) 62 .then(res => res.body as models.RepoCreds); 63 } 64 65 public createGoogleCloudSource({url, gcpServiceAccountKey}: {url: string; gcpServiceAccountKey: string}): Promise<models.RepoCreds> { 66 return requests 67 .post('/repocreds') 68 .send({url, gcpServiceAccountKey}) 69 .then(res => res.body as models.RepoCreds); 70 } 71 72 public delete(url: string): Promise<models.RepoCreds> { 73 return requests 74 .delete(`/repocreds/${encodeURIComponent(url)}`) 75 .send() 76 .then(res => res.body as models.RepoCreds); 77 } 78 }