|
3 | 3 | ==================================== |
4 | 4 | API: openeo.extra.artifacts |
5 | 5 | ==================================== |
| 6 | +.. versionadded:: 0.45.0 |
6 | 7 |
|
7 | 8 | .. warning:: |
8 | 9 | This is a new experimental API, subject to change. |
|
46 | 47 | to limit the time window in which the URI can be used. |
47 | 48 |
|
48 | 49 | * The openEO backend must expose additional metadata in its capabilities doc to make this possible. Implementers of a |
49 | | - backend can check the extra documentation :ref:`advertising-capabilities`. |
| 50 | + backend can check the extra documentation :ref:`for-backend-providers`. |
50 | 51 |
|
51 | 52 |
|
52 | 53 | User facing API |
@@ -79,101 +80,16 @@ How does it work ? |
79 | 80 | support handling of internal references. presigned URLs should work in any tool). |
80 | 81 |
|
81 | 82 |
|
82 | | -Documentation for backend providers |
83 | | -=================================== |
84 | | - |
85 | | -This section and its subsection is for engineers who operate an openEO backend. If you are a user of an openEO platform |
86 | | -this is unlikely to be of value to you. |
87 | | - |
88 | | -.. _advertising-capabilities: |
89 | | - |
90 | | -Advertising capabilities from the backend |
91 | | ------------------------------------------ |
92 | | - |
93 | | -It is expected that the backend advertises in its capabilities a section on artifacts. The following is an example |
94 | | -for the S3STSConfig (of the :py:mod:`openeo.extra.artifacts._s3sts` package). |
95 | | - |
96 | | -.. code-block:: json |
97 | | -
|
98 | | - { |
99 | | - // ... |
100 | | - "artifacts": { |
101 | | - "providers": [ |
102 | | - { |
103 | | - // This id is a logical name |
104 | | - "id": "s3", |
105 | | - // The config type of the ArtifactHelper |
106 | | - "type": "S3STSConfig" |
107 | | - // The config block its keys can differ for other config types |
108 | | - "config": { |
109 | | - // The bucket where the artifacts will be stored |
110 | | - "bucket": "openeo-artifacts", |
111 | | - // The role that will be assumed via STS |
112 | | - "role": "arn:aws:iam::000000000000:role/S3Access", |
113 | | - // Where S3 API calls are sent |
114 | | - "s3_endpoint": "https://my.s3.test", |
115 | | - // Where STS API calls are sent |
116 | | - "sts_endpoint": "https://my.sts.test" |
117 | | - }, |
118 | | - } |
119 | | - ] |
120 | | - }, |
121 | | - // ... |
122 | | - } |
123 | | -
|
124 | | -
|
125 | | -Extending support for other types of artifacts |
126 | | ----------------------------------------------- |
| 83 | +.. _for-backend-providers: |
127 | 84 |
|
128 | | -.. warning:: |
129 | | - This is a section for developers of the `openeo-python-client` Python package. If you want to walk this road it is |
130 | | - best to create an issue on github and detail what support you are planning to add to get input on feasibility and |
131 | | - whether it will be mergeable early on. |
132 | | - |
133 | | -Ideally the user-interface is simple and stable. Unfortunately implementations themselves come with more complexity. |
134 | | -This section explains what is needed to provide support for additional types of artifacts. Below the steps we show |
135 | | -the API that is involved. |
136 | | - |
137 | | -1. Create another internal package for the implementation. The following steps should be done inside that package. |
138 | | - This package resides under :py:mod:`openeo.extra.artifacts` |
139 | | -2. Create a config implementation which extends :py:class:`openeo.extra.artifacts._config.ArtifactsStorageConfigABC` |
140 | | - and should be a frozen dataclass. This class implements the logic to determine the configuration used by the |
141 | | - implementation `_load_connection_provided_config(self, provider_config: ProviderConfig) -> None` is used for that. |
142 | | - |
143 | | - When this method is called explicit config is already put in place and if not provided default config is put in |
144 | | - place. |
145 | | - Because frozen dataclasses are used for config `object.__setattr__(self, ...)` must be used to manipulate the |
146 | | - values. |
147 | | - |
148 | | - So per attribute the same pattern is used. For example an attribute `foo` which has a default `bar` that can be kept |
149 | | - constant would be: |
150 | | - |
151 | | - .. code-block:: python |
152 | | -
|
153 | | - if self.foo is None: |
154 | | - try: |
155 | | - object.__setattr__(self, "foo", provider_config["foo"]) |
156 | | - except NoDefaultConfig: |
157 | | - object.__setattr__(self, "foo", "bar") |
158 | | -
|
159 | | - Here we use :py:exc:`openeo.extra.artifacts.exceptions.NoDefaultConfig` |
| 85 | +For backend providers |
| 86 | +===================== |
160 | 87 |
|
161 | | -3. Create an implementation of :py:class:`openeo.extra.artifacts._uri.StorageURI` to model the internal URIs to the |
162 | | - stored artifact |
163 | | -4. Create an ArtifactHelper implementation which extends :py:class:`openeo.extra.artifacts._artifact_helper_abc.ArtifactHelperABC` |
164 | | -5. Add a key value pair to the :py:obj:`openeo.extra.artifacts.artifact_helper.config_to_helper` dictionary. The key is |
165 | | - the class created in 2 and the value is the class created in step 3 |
166 | | - |
167 | | -.. autoclass:: openeo.extra.artifacts._config.ArtifactsStorageConfigABC |
168 | | - :members: |
169 | | - :private-members: _load_connection_provided_config |
170 | | - |
171 | | -.. autoclass:: openeo.extra.artifacts._artifact_helper_abc.ArtifactHelperABC |
172 | | - :members: |
173 | | - :private-members: _get_default_storage_config, _from_openeo_connection |
| 88 | +.. warning:: |
| 89 | + Investigation is ongoing whether this would be a good fit for the workspace extension |
| 90 | + https://github.com/Open-EO/openeo-api/issues/566 which would mean a big overhaul for backend implementations. If you |
| 91 | + are a backend provider and interested in this feature please create an issue to allow collaboration. |
174 | 92 |
|
175 | | -.. autoclass:: openeo.extra.artifacts._uri.StorageURI |
176 | | - :members: |
177 | 93 |
|
178 | 94 |
|
179 | 95 | Artifacts exceptions |
|
0 commit comments