github.com/argoproj/argo-cd/v2@v2.10.9/ui/src/app/shared/services/repo-service.ts (about)

     1  import * as models from '../models';
     2  import requests from './requests';
     3  
     4  export class RepositoriesService {
     5      public list(): Promise<models.Repository[]> {
     6          return requests
     7              .get(`/repositories`)
     8              .then(res => res.body as models.RepositoryList)
     9              .then(list => list.items || []);
    10      }
    11  
    12      public listNoCache(): Promise<models.Repository[]> {
    13          return requests
    14              .get(`/repositories?forceRefresh=true`)
    15              .then(res => res.body as models.RepositoryList)
    16              .then(list => list.items || []);
    17      }
    18  
    19      public createHTTPS({
    20          type,
    21          name,
    22          url,
    23          username,
    24          password,
    25          tlsClientCertData,
    26          tlsClientCertKey,
    27          insecure,
    28          enableLfs,
    29          proxy,
    30          project,
    31          forceHttpBasicAuth,
    32          enableOCI
    33      }: {
    34          type: string;
    35          name: string;
    36          url: string;
    37          username: string;
    38          password: string;
    39          tlsClientCertData: string;
    40          tlsClientCertKey: string;
    41          insecure: boolean;
    42          enableLfs: boolean;
    43          proxy: string;
    44          project?: string;
    45          forceHttpBasicAuth?: boolean;
    46          enableOCI: boolean;
    47      }): Promise<models.Repository> {
    48          return requests
    49              .post('/repositories')
    50              .send({type, name, repo: url, username, password, tlsClientCertData, tlsClientCertKey, insecure, enableLfs, proxy, project, forceHttpBasicAuth, enableOCI})
    51              .then(res => res.body as models.Repository);
    52      }
    53  
    54      public updateHTTPS({
    55          type,
    56          name,
    57          url,
    58          username,
    59          password,
    60          tlsClientCertData,
    61          tlsClientCertKey,
    62          insecure,
    63          enableLfs,
    64          proxy,
    65          project
    66      }: {
    67          type: string;
    68          name: string;
    69          url: string;
    70          username: string;
    71          password: string;
    72          tlsClientCertData: string;
    73          tlsClientCertKey: string;
    74          insecure: boolean;
    75          enableLfs: boolean;
    76          proxy: string;
    77          project?: string;
    78      }): Promise<models.Repository> {
    79          return requests
    80              .put(`/repositories/${encodeURIComponent(url)}`)
    81              .send({type, name, repo: url, username, password, tlsClientCertData, tlsClientCertKey, insecure, enableLfs, proxy, project})
    82              .then(res => res.body as models.Repository);
    83      }
    84  
    85      public createSSH({
    86          type,
    87          name,
    88          url,
    89          sshPrivateKey,
    90          insecure,
    91          enableLfs,
    92          proxy,
    93          project
    94      }: {
    95          type: string;
    96          name: string;
    97          url: string;
    98          sshPrivateKey: string;
    99          insecure: boolean;
   100          enableLfs: boolean;
   101          proxy: string;
   102          project?: string;
   103      }): Promise<models.Repository> {
   104          return requests
   105              .post('/repositories')
   106              .send({type, name, repo: url, sshPrivateKey, insecure, enableLfs, proxy, project})
   107              .then(res => res.body as models.Repository);
   108      }
   109  
   110      public createGitHubApp({
   111          type,
   112          name,
   113          url,
   114          githubAppPrivateKey,
   115          githubAppId,
   116          githubAppInstallationId,
   117          githubAppEnterpriseBaseURL,
   118          tlsClientCertData,
   119          tlsClientCertKey,
   120          insecure,
   121          enableLfs,
   122          proxy,
   123          project
   124      }: {
   125          type: string;
   126          name: string;
   127          url: string;
   128          githubAppPrivateKey: string;
   129          githubAppId: bigint;
   130          githubAppInstallationId: bigint;
   131          githubAppEnterpriseBaseURL: string;
   132          tlsClientCertData: string;
   133          tlsClientCertKey: string;
   134          insecure: boolean;
   135          enableLfs: boolean;
   136          proxy: string;
   137          project?: string;
   138      }): Promise<models.Repository> {
   139          return requests
   140              .post('/repositories')
   141              .send({
   142                  type,
   143                  name,
   144                  repo: url,
   145                  githubAppPrivateKey,
   146                  githubAppId,
   147                  githubAppInstallationId,
   148                  githubAppEnterpriseBaseURL,
   149                  tlsClientCertData,
   150                  tlsClientCertKey,
   151                  insecure,
   152                  enableLfs,
   153                  proxy,
   154                  project
   155              })
   156              .then(res => res.body as models.Repository);
   157      }
   158  
   159      public createGoogleCloudSource({
   160          type,
   161          name,
   162          url,
   163          gcpServiceAccountKey,
   164          proxy,
   165          project
   166      }: {
   167          type: string;
   168          name: string;
   169          url: string;
   170          gcpServiceAccountKey: string;
   171          proxy: string;
   172          project?: string;
   173      }): Promise<models.Repository> {
   174          return requests
   175              .post('/repositories')
   176              .send({
   177                  type,
   178                  name,
   179                  repo: url,
   180                  gcpServiceAccountKey,
   181                  proxy,
   182                  project
   183              })
   184              .then(res => res.body as models.Repository);
   185      }
   186  
   187      public delete(url: string): Promise<models.Repository> {
   188          return requests
   189              .delete(`/repositories/${encodeURIComponent(url)}`)
   190              .send()
   191              .then(res => res.body as models.Repository);
   192      }
   193  
   194      public async revisions(repo: string): Promise<models.RefsInfo> {
   195          return requests.get(`/repositories/${encodeURIComponent(repo)}/refs`).then(res => res.body as models.RefsInfo);
   196      }
   197  
   198      public apps(repo: string, revision: string, appName: string, appProject: string): Promise<models.AppInfo[]> {
   199          return requests
   200              .get(`/repositories/${encodeURIComponent(repo)}/apps`)
   201              .query({revision})
   202              .query({appName})
   203              .query({appProject})
   204              .then(res => (res.body.items as models.AppInfo[]) || []);
   205      }
   206  
   207      public charts(repo: string): Promise<models.HelmChart[]> {
   208          return requests.get(`/repositories/${encodeURIComponent(repo)}/helmcharts`).then(res => (res.body.items as models.HelmChart[]) || []);
   209      }
   210  
   211      public appDetails(source: models.ApplicationSource, appName: string, appProject: string): Promise<models.RepoAppDetails> {
   212          return requests
   213              .post(`/repositories/${encodeURIComponent(source.repoURL)}/appdetails`)
   214              .send({source, appName, appProject})
   215              .then(res => res.body as models.RepoAppDetails);
   216      }
   217  }