| 371 | return source_to_url_dict |
| 372 | |
| 373 | def _get_source_name(self, codeartifact_url, source_dict): |
| 374 | default_name = f'{self.domain}/{self.repository}' |
| 375 | |
| 376 | # Check if the CodeArtifact URL is already present in the |
| 377 | # NuGet.Config file. If the URL already exists, use the source name |
| 378 | # already assigned to the CodeArtifact URL. |
| 379 | for source_name, source_url in source_dict.items(): |
| 380 | if source_url == codeartifact_url: |
| 381 | return source_name, True |
| 382 | |
| 383 | # If the CodeArtifact URL is not present in the NuGet.Config file, |
| 384 | # check if the default source name already exists so we can know |
| 385 | # whether we need to add a new entry or update the existing entry. |
| 386 | for source_name in source_dict.keys(): |
| 387 | if source_name == default_name: |
| 388 | return source_name, True |
| 389 | |
| 390 | # If neither the source url nor the source name already exist in the |
| 391 | # NuGet.Config file, use the default source name. |
| 392 | return default_name, False |
| 393 | |
| 394 | def _get_tool_name(self): |
| 395 | raise NotImplementedError('_get_tool_name()') |