fetchCredentialsByType fetches credentials by name for a given forge type
(ctx context.Context, tx *gorm.DB, credentialsName string, forgeType params.EndpointType)
| 1147 | |
| 1148 | // fetchCredentialsByType fetches credentials by name for a given forge type |
| 1149 | func (s *sqlDatabase) fetchCredentialsByType(ctx context.Context, tx *gorm.DB, credentialsName string, forgeType params.EndpointType) (CredentialsGetter, error) { |
| 1150 | switch forgeType { |
| 1151 | case params.GithubEndpointType: |
| 1152 | return s.getGithubCredentialsByName(ctx, tx, credentialsName, false) |
| 1153 | case params.GiteaEndpointType: |
| 1154 | return s.getGiteaCredentialsByName(ctx, tx, credentialsName, false) |
| 1155 | default: |
| 1156 | return nil, runnerErrors.NewBadRequestError("unsupported endpoint type: %s", forgeType) |
| 1157 | } |
| 1158 | } |
| 1159 | |
| 1160 | // updateEntityCredentials fetches, validates, and assigns credentials to an entity |
| 1161 | func (s *sqlDatabase) updateEntityCredentials(ctx context.Context, tx *gorm.DB, entity ForgeEntity, credentialsName string, updates map[string]interface{}) error { |
no test coverage detected