abderrahim commented on code in PR #1911:
URL: https://github.com/apache/buildstream/pull/1911#discussion_r1566094373
##########
src/buildstream/downloadablefilesource.py:
##########
@@ -25,6 +25,64 @@
implementation.
+SourceMirror extra data "http-auth"
+--------------------------------------------
+The DownloadableFileSource, and consequently any :class:`Source
<buildstream.source.Source>`
+implementations which derive from DownloadableFileSource, support the
"http-auth"
+extra data returned by :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+through :func:`Source.translate_url()
<buildstream.source.Source.translate_url>`.
+
+This functionality is available **Since: 2.2**.
+
+This allows one to use :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+to add an authorization header to the ``GET`` requests.
+
+
+**Example:**
+
+.. code:: python
+
+ class MySourceMirror(SourceMirror):
+
+ def translate_url(
+ self,
+ *,
+ project_name: str,
+ alias: str,
+ alias_url: str,
+ alias_substitute_url: Optional[str],
+ source_url: str,
+ extra_data: Optional[Dict[str, Any]],
Review Comment:
```suggestion
alias: str,
alias_url: str,
source_url: str,
extra_data: Optional[Dict[str, Any]],
```
##########
src/buildstream/downloadablefilesource.py:
##########
@@ -25,6 +25,64 @@
implementation.
+SourceMirror extra data "http-auth"
+--------------------------------------------
+The DownloadableFileSource, and consequently any :class:`Source
<buildstream.source.Source>`
+implementations which derive from DownloadableFileSource, support the
"http-auth"
+extra data returned by :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+through :func:`Source.translate_url()
<buildstream.source.Source.translate_url>`.
+
+This functionality is available **Since: 2.2**.
+
+This allows one to use :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+to add an authorization header to the ``GET`` requests.
+
+
+**Example:**
+
+.. code:: python
+
+ class MySourceMirror(SourceMirror):
+
+ def translate_url(
+ self,
+ *,
+ project_name: str,
+ alias: str,
+ alias_url: str,
+ alias_substitute_url: Optional[str],
+ source_url: str,
+ extra_data: Optional[Dict[str, Any]],
+ ) -> str:
+
+ #
+ # Set the "http-auth" extra data
+ #
+ if extra_data is not None:
+ extra_data["http-auth"] = "bearer"
+
+ return alias_substitute_url + source_url
Review Comment:
I think we can just say here
```suggestion
# ...
```
`alias_substitute_url` is no longer a thing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]