github.com/argoproj/argo-cd/v3@v3.2.1/ui/src/app/shared/services/repocreds-service.ts (about) 1 import * as models from '../models'; 2 import requests from './requests'; 3 4 export interface HTTPSCreds { 5 url: string; 6 username: string; 7 password: string; 8 bearerToken: string; 9 tlsClientCertData: string; 10 tlsClientCertKey: string; 11 type: string; 12 proxy: string; 13 noProxy: string; 14 enableOCI: boolean; 15 insecureOCIForceHttp: boolean; 16 } 17 18 export interface SSHCreds { 19 url: string; 20 sshPrivateKey: string; 21 } 22 23 export interface GitHubAppCreds { 24 url: string; 25 githubAppPrivateKey: string; 26 githubAppId: bigint; 27 githubAppInstallationId: bigint; 28 githubAppEnterpriseBaseURL: string; 29 tlsClientCertData: string; 30 tlsClientCertKey: string; 31 proxy: string; 32 noProxy: string; 33 } 34 35 export interface GoogleCloudSourceCreds { 36 url: string; 37 gcpServiceAccountKey: string; 38 } 39 40 export class RepoCredsService { 41 public list(): Promise<models.RepoCreds[]> { 42 return requests 43 .get('/repocreds') 44 .then(res => res.body as models.RepoCredsList) 45 .then(list => list.items || []); 46 } 47 48 public listWrite(): Promise<models.RepoCreds[]> { 49 return requests 50 .get('/write-repocreds') 51 .then(res => res.body as models.RepoCredsList) 52 .then(list => list.items || []); 53 } 54 55 public createHTTPS(creds: HTTPSCreds): Promise<models.RepoCreds> { 56 return requests 57 .post('/repocreds') 58 .send(creds) 59 .then(res => res.body as models.RepoCreds); 60 } 61 62 public createHTTPSWrite(creds: HTTPSCreds): Promise<models.RepoCreds> { 63 return requests 64 .post('/write-repocreds') 65 .send(creds) 66 .then(res => res.body as models.RepoCreds); 67 } 68 69 public createSSH(creds: SSHCreds): Promise<models.RepoCreds> { 70 return requests 71 .post('/repocreds') 72 .send(creds) 73 .then(res => res.body as models.RepoCreds); 74 } 75 76 public createSSHWrite(creds: SSHCreds): Promise<models.RepoCreds> { 77 return requests 78 .post('/write-repocreds') 79 .send(creds) 80 .then(res => res.body as models.RepoCreds); 81 } 82 83 public createGitHubApp(creds: GitHubAppCreds): Promise<models.RepoCreds> { 84 return requests 85 .post('/repocreds') 86 .send(creds) 87 .then(res => res.body as models.RepoCreds); 88 } 89 90 public createGitHubAppWrite(creds: GitHubAppCreds): Promise<models.RepoCreds> { 91 return requests 92 .post('/write-repocreds') 93 .send(creds) 94 .then(res => res.body as models.RepoCreds); 95 } 96 97 public createGoogleCloudSource(creds: GoogleCloudSourceCreds): Promise<models.RepoCreds> { 98 return requests 99 .post('/repocreds') 100 .send(creds) 101 .then(res => res.body as models.RepoCreds); 102 } 103 104 public createGoogleCloudSourceWrite(creds: GoogleCloudSourceCreds): Promise<models.RepoCreds> { 105 return requests 106 .post('/write-repocreds') 107 .send(creds) 108 .then(res => res.body as models.RepoCreds); 109 } 110 111 public delete(url: string): Promise<models.RepoCreds> { 112 return requests 113 .delete(`/repocreds/${encodeURIComponent(url)}`) 114 .send() 115 .then(res => res.body as models.RepoCreds); 116 } 117 118 public deleteWrite(url: string): Promise<models.RepoCreds> { 119 return requests 120 .delete(`/write-repocreds/${encodeURIComponent(url)}`) 121 .send() 122 .then(res => res.body as models.RepoCreds); 123 } 124 }