toolframe-object-store-s3 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toolframe_object_store_s3/__init__.py +0 -0
- toolframe_object_store_s3/plugin.py +186 -0
- toolframe_object_store_s3-0.1.0.dist-info/METADATA +118 -0
- toolframe_object_store_s3-0.1.0.dist-info/RECORD +8 -0
- toolframe_object_store_s3-0.1.0.dist-info/WHEEL +4 -0
- toolframe_object_store_s3-0.1.0.dist-info/entry_points.txt +2 -0
- toolframe_object_store_s3-0.1.0.dist-info/licenses/LICENSE +202 -0
- toolframe_object_store_s3-0.1.0.dist-info/licenses/NOTICE +2 -0
|
File without changes
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""Private S3 objects partitioned by application and owning plugin."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from urllib.parse import urlsplit
|
|
7
|
+
|
|
8
|
+
import boto3
|
|
9
|
+
from botocore.config import Config
|
|
10
|
+
from botocore.exceptions import BotoCoreError, ClientError
|
|
11
|
+
from toolframe_sdk import AuthorizationSpec, PluginDefinition, PluginError
|
|
12
|
+
from toolframe_sdk.object_store import (
|
|
13
|
+
MAX_OBJECT_BYTES,
|
|
14
|
+
OBJECT_STORE_SERVICE,
|
|
15
|
+
object_store_service,
|
|
16
|
+
)
|
|
17
|
+
from toolframe_sdk.object_store_provider import ObjectStoreProvider, check_key
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class S3ObjectStore(ObjectStoreProvider):
|
|
21
|
+
def open_backend(self):
|
|
22
|
+
config = self.context.config
|
|
23
|
+
endpoint = config.get("endpoint_url")
|
|
24
|
+
if endpoint:
|
|
25
|
+
parsed = urlsplit(endpoint)
|
|
26
|
+
if (
|
|
27
|
+
parsed.scheme not in {"https", "http"}
|
|
28
|
+
or not parsed.hostname
|
|
29
|
+
or parsed.username
|
|
30
|
+
or parsed.password
|
|
31
|
+
or parsed.query
|
|
32
|
+
or parsed.fragment
|
|
33
|
+
or parsed.path not in {"", "/"}
|
|
34
|
+
):
|
|
35
|
+
raise PluginError(
|
|
36
|
+
"invalid_endpoint",
|
|
37
|
+
"S3 endpoint must be an HTTP(S) origin without credentials",
|
|
38
|
+
)
|
|
39
|
+
self.prefix = config.get("prefix", "toolframe").strip("/")
|
|
40
|
+
check_key(self.prefix)
|
|
41
|
+
self.bucket = config["bucket"]
|
|
42
|
+
# Credentials come from the AWS chain, never serializable plugin config.
|
|
43
|
+
self.client = boto3.client(
|
|
44
|
+
"s3",
|
|
45
|
+
endpoint_url=endpoint,
|
|
46
|
+
region_name=config.get("region", "us-east-1"),
|
|
47
|
+
config=Config(
|
|
48
|
+
signature_version="s3v4",
|
|
49
|
+
connect_timeout=5,
|
|
50
|
+
read_timeout=15,
|
|
51
|
+
retries={"max_attempts": 2, "mode": "standard"},
|
|
52
|
+
s3={"addressing_style": config.get("addressing_style", "path")},
|
|
53
|
+
request_checksum_calculation="when_required",
|
|
54
|
+
response_checksum_validation="when_required",
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
try:
|
|
58
|
+
self.client.head_bucket(Bucket=self.bucket)
|
|
59
|
+
except BotoCoreError, ClientError:
|
|
60
|
+
self.client.close()
|
|
61
|
+
raise PluginError(
|
|
62
|
+
"object_store_unavailable", "Cannot access the configured S3 bucket"
|
|
63
|
+
) from None
|
|
64
|
+
|
|
65
|
+
def close_backend(self):
|
|
66
|
+
if hasattr(self, "client"):
|
|
67
|
+
self.client.close()
|
|
68
|
+
|
|
69
|
+
def key(self, namespace, key=""):
|
|
70
|
+
return f"{self.prefix}/{namespace}/{key}"
|
|
71
|
+
|
|
72
|
+
def request(self, method, **params):
|
|
73
|
+
try:
|
|
74
|
+
return getattr(self.client, method)(Bucket=self.bucket, **params)
|
|
75
|
+
except ClientError as error:
|
|
76
|
+
code = error.response.get("Error", {}).get("Code")
|
|
77
|
+
if code in {"NoSuchKey", "NotFound", "404"}:
|
|
78
|
+
raise PluginError("object_missing", "Object does not exist") from None
|
|
79
|
+
if code in {"PreconditionFailed", "412"}:
|
|
80
|
+
raise PluginError(
|
|
81
|
+
"object_changed", "Object changed; read its metadata again"
|
|
82
|
+
) from None
|
|
83
|
+
raise PluginError("object_store_unavailable", "S3 request failed") from None
|
|
84
|
+
|
|
85
|
+
def put(self, namespace, metadata, stream):
|
|
86
|
+
self.request(
|
|
87
|
+
"put_object",
|
|
88
|
+
Key=self.key(namespace, metadata["key"]),
|
|
89
|
+
Body=stream,
|
|
90
|
+
ContentLength=metadata["size"],
|
|
91
|
+
ContentType=metadata["content_type"],
|
|
92
|
+
Metadata={
|
|
93
|
+
"sha256": metadata["etag"],
|
|
94
|
+
"modified-at": str(metadata["modified_at"]),
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def metadata(self, key, response):
|
|
99
|
+
etag = response.get("Metadata", {}).get("sha256", "")
|
|
100
|
+
if not re.fullmatch(r"[a-f0-9]{64}", etag):
|
|
101
|
+
raise PluginError(
|
|
102
|
+
"object_corrupt", "Object is missing Toolframe checksum metadata"
|
|
103
|
+
)
|
|
104
|
+
return {
|
|
105
|
+
"key": key,
|
|
106
|
+
"size": response["ContentLength"],
|
|
107
|
+
"content_type": response.get("ContentType", "application/octet-stream"),
|
|
108
|
+
"etag": etag,
|
|
109
|
+
"modified_at": float(response["Metadata"]["modified-at"]),
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
def head(self, namespace, key):
|
|
113
|
+
return self.metadata(
|
|
114
|
+
key, self.request("head_object", Key=self.key(namespace, key))
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def read(self, namespace, key, offset, length, etag):
|
|
118
|
+
response = self.request("head_object", Key=self.key(namespace, key))
|
|
119
|
+
metadata = self.metadata(key, response)
|
|
120
|
+
if metadata["etag"] != etag:
|
|
121
|
+
raise PluginError(
|
|
122
|
+
"object_changed", "Object changed; read its metadata again"
|
|
123
|
+
)
|
|
124
|
+
if offset > metadata["size"]:
|
|
125
|
+
raise PluginError("invalid_range", "Offset exceeds the object size")
|
|
126
|
+
if offset == metadata["size"]:
|
|
127
|
+
return b""
|
|
128
|
+
result = self.request(
|
|
129
|
+
"get_object",
|
|
130
|
+
Key=self.key(namespace, key),
|
|
131
|
+
IfMatch=response["ETag"],
|
|
132
|
+
Range=f"bytes={offset}-{min(offset + length, metadata['size']) - 1}",
|
|
133
|
+
)
|
|
134
|
+
try:
|
|
135
|
+
return result["Body"].read(length)
|
|
136
|
+
finally:
|
|
137
|
+
result["Body"].close()
|
|
138
|
+
|
|
139
|
+
def list(self, namespace, prefix, after, limit):
|
|
140
|
+
base = self.key(namespace)
|
|
141
|
+
result = self.request(
|
|
142
|
+
"list_objects_v2",
|
|
143
|
+
Prefix=base + prefix,
|
|
144
|
+
StartAfter=base + after,
|
|
145
|
+
MaxKeys=limit + 1,
|
|
146
|
+
)
|
|
147
|
+
entries = result.get("Contents", [])
|
|
148
|
+
items = [
|
|
149
|
+
self.head(namespace, item["Key"][len(base) :]) for item in entries[:limit]
|
|
150
|
+
]
|
|
151
|
+
more = len(entries) > limit or result.get("IsTruncated", False)
|
|
152
|
+
return {
|
|
153
|
+
"objects": items,
|
|
154
|
+
"next_after": items[-1]["key"] if more and items else None,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
def delete(self, namespace, key):
|
|
158
|
+
self.request("delete_object", Key=self.key(namespace, key))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
plugin = PluginDefinition(
|
|
162
|
+
id="object-store-s3",
|
|
163
|
+
kind="provider",
|
|
164
|
+
provider_kind="object-store",
|
|
165
|
+
factory="toolframe_object_store_s3.plugin:S3ObjectStore",
|
|
166
|
+
authorization=AuthorizationSpec(),
|
|
167
|
+
runtime_validation="separate_application",
|
|
168
|
+
config_schema={
|
|
169
|
+
"type": "object",
|
|
170
|
+
"additionalProperties": False,
|
|
171
|
+
"required": ["bucket"],
|
|
172
|
+
"properties": {
|
|
173
|
+
"bucket": {"type": "string", "minLength": 3, "maxLength": 63},
|
|
174
|
+
"endpoint_url": {"type": "string", "maxLength": 2048},
|
|
175
|
+
"region": {"type": "string", "minLength": 1, "maxLength": 64},
|
|
176
|
+
"prefix": {"type": "string", "minLength": 1, "maxLength": 128},
|
|
177
|
+
"addressing_style": {"enum": ["path", "virtual", "auto"]},
|
|
178
|
+
"max_object_bytes": {
|
|
179
|
+
"type": "integer",
|
|
180
|
+
"minimum": 1,
|
|
181
|
+
"maximum": MAX_OBJECT_BYTES,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
services={OBJECT_STORE_SERVICE: object_store_service()},
|
|
186
|
+
)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: toolframe-object-store-s3
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: S3-compatible object storage for Toolframe plugins
|
|
5
|
+
Project-URL: Homepage, https://github.com/toolframe/toolframe-object-store-s3
|
|
6
|
+
Project-URL: Repository, https://github.com/toolframe/toolframe-object-store-s3
|
|
7
|
+
Project-URL: Documentation, https://github.com/toolframe/toolframe-object-store-s3#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/toolframe/toolframe-object-store-s3/issues
|
|
9
|
+
Author-email: byfb <62798989+byfb@users.noreply.github.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Requires-Python: >=3.14
|
|
14
|
+
Requires-Dist: boto3<2,>=1.42
|
|
15
|
+
Requires-Dist: toolframe-sdk==0.3.0
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Toolframe S3 object storage
|
|
19
|
+
|
|
20
|
+
`object-store-s3` keeps private Toolframe files in an existing S3-compatible bucket.
|
|
21
|
+
It implements `toolframe.object_store` v1, matching the local provider's SDK client
|
|
22
|
+
and Dashboard image workflow. RustFS is the local integration target.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
Use Toolframe Core 0.6.2 and SDK 0.3.0 with object-storage support.
|
|
27
|
+
Create a private bucket first. Supply credentials through the standard AWS chain
|
|
28
|
+
in the environment that starts Core (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`,
|
|
29
|
+
optional `AWS_SESSION_TOKEN`, or a supported AWS profile/role).
|
|
30
|
+
|
|
31
|
+
With the plugin installed but disabled, set its configuration in `toolframe.toml`:
|
|
32
|
+
|
|
33
|
+
```toml
|
|
34
|
+
[plugins.object-store-s3]
|
|
35
|
+
source = "pypi:toolframe-object-store-s3==0.1.0"
|
|
36
|
+
enabled = false
|
|
37
|
+
|
|
38
|
+
[plugins.object-store-s3.config]
|
|
39
|
+
bucket = "toolframe-images"
|
|
40
|
+
endpoint_url = "http://127.0.0.1:9000"
|
|
41
|
+
region = "us-east-1"
|
|
42
|
+
prefix = "toolframe"
|
|
43
|
+
addressing_style = "path"
|
|
44
|
+
max_object_bytes = 67108864
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Core downloads the pinned package from PyPI when applying this configuration.
|
|
48
|
+
Omit `endpoint_url` for AWS S3. TLS verification stays enabled for HTTPS endpoints.
|
|
49
|
+
Use `addressing_style = "virtual"` when required by your service. Do not put access
|
|
50
|
+
keys, secrets or URL credentials in plugin configuration.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
toolframe-core --home APP plugin enable object-store-s3
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Disable the local object-store provider before enabling S3; each application
|
|
57
|
+
selects one provider. Existing local files do not migrate automatically.
|
|
58
|
+
Business code continues to use `self.context.object_store()` unchanged.
|
|
59
|
+
|
|
60
|
+
## Storage and permissions
|
|
61
|
+
|
|
62
|
+
Objects live under `<prefix>/<sha256(application-id)>/<plugin-id>/<key>`. The
|
|
63
|
+
provider only accesses the existing bucket; it never creates buckets, changes
|
|
64
|
+
ACLs or enables public access. Grant ListBucket on the configured prefix and
|
|
65
|
+
GetObject, PutObject and DeleteObject for its objects. Keep application IDs and
|
|
66
|
+
prefixes stable across restarts. Use bucket backup/versioning policies for recovery.
|
|
67
|
+
|
|
68
|
+
Core inherits the AWS environment into trusted workers. Use an application-scoped
|
|
69
|
+
credential/profile; this is not a credential sandbox between untrusted plugins.
|
|
70
|
+
`head_bucket` checks access during activation. Service errors do not return SDK
|
|
71
|
+
exception text, credentials or endpoints to callers.
|
|
72
|
+
|
|
73
|
+
Uploads stage in bounded local temporary files before one atomic `PutObject`.
|
|
74
|
+
Content type and SHA-256 metadata are retained. Range reads use S3 conditional
|
|
75
|
+
requests to reject concurrent replacement. The common limit is 64 MiB per object,
|
|
76
|
+
256 KiB per wire chunk, 32 unfinished uploads and 256 MiB staging per worker;
|
|
77
|
+
`max_object_bytes` may lower the object limit. Sessions expire after ten minutes.
|
|
78
|
+
Completed data survives plugin removal; unfinished uploads do not survive restart.
|
|
79
|
+
There is no cross-resource transaction, durable upload resumption, presigned URL,
|
|
80
|
+
public download endpoint or automatic migration in this version.
|
|
81
|
+
|
|
82
|
+
## Test with RustFS
|
|
83
|
+
|
|
84
|
+
Follow the official [RustFS container instructions](https://docs.rustfs.com/en/installation/container).
|
|
85
|
+
Use a dedicated test bucket and credentials. Example local-only container:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
# rustfs.env contains private RUSTFS_ACCESS_KEY and RUSTFS_SECRET_KEY values.
|
|
89
|
+
docker run -d --name toolframe-rustfs --env-file ./rustfs.env \
|
|
90
|
+
-p 127.0.0.1:9000:9000 -p 127.0.0.1:9001:9001 \
|
|
91
|
+
-v toolframe-rustfs-data:/data -v toolframe-rustfs-logs:/logs \
|
|
92
|
+
rustfs/rustfs:latest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For sibling development checkouts with the matching SDK:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
uv sync --group dev
|
|
99
|
+
uv run pytest -q # stub tests; live test explicitly skips
|
|
100
|
+
export TOOLFRAME_TEST_S3_ENDPOINT=http://127.0.0.1:9000
|
|
101
|
+
export TOOLFRAME_TEST_S3_BUCKET=toolframe-test
|
|
102
|
+
# Set AWS credentials separately, then create this dedicated bucket once.
|
|
103
|
+
uv run pytest -q # includes the live integration test
|
|
104
|
+
uv run ruff check src tests
|
|
105
|
+
uv build --no-sources
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The integration test uses a unique prefix and removes only the objects it created.
|
|
109
|
+
It checks a >1 MiB upload, exact download, empty files, restart, application
|
|
110
|
+
isolation, replacement detection, pagination and deletion. Record the container
|
|
111
|
+
image digest with acceptance evidence. Runtime validation requires a separate
|
|
112
|
+
application because a scratch home does not isolate the remote bucket.
|
|
113
|
+
AWS S3 and other compatible services require their own acceptance run; RustFS
|
|
114
|
+
coverage does not establish compatibility with every S3 extension.
|
|
115
|
+
|
|
116
|
+
Licensed under Apache-2.0; see [LICENSE](LICENSE).
|
|
117
|
+
|
|
118
|
+
For release validation and Trusted Publisher setup, see [releasing](docs/releasing.md).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
toolframe_object_store_s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
toolframe_object_store_s3/plugin.py,sha256=5aLn9e3J5HREOM91sqr3DyFz0x-S4YHRwIc69SJO8_E,6898
|
|
3
|
+
toolframe_object_store_s3-0.1.0.dist-info/METADATA,sha256=7YAF434T5GMkiTiTZuwEApU9Aeq4vup3bUhoXyPw9bk,5278
|
|
4
|
+
toolframe_object_store_s3-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
5
|
+
toolframe_object_store_s3-0.1.0.dist-info/entry_points.txt,sha256=BIiWFZoPbD9I7ManLSzsAfeeVymQ_HzrFWuhVEZk4r0,78
|
|
6
|
+
toolframe_object_store_s3-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
7
|
+
toolframe_object_store_s3-0.1.0.dist-info/licenses/NOTICE,sha256=ul1rv24we4KKVQWRRg9fjEFtmvZ8k0zk7ACr380mPXo,48
|
|
8
|
+
toolframe_object_store_s3-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|