forked from oras-project/oras-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConst.java
More file actions
237 lines (196 loc) · 6.47 KB
/
Copy pathConst.java
File metadata and controls
237 lines (196 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*-
* =LICENSE=
* ORAS Java SDK
* ===
* Copyright (C) 2024 - 2025 ORAS
* ===
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =LICENSEEND=
*/
package land.oras.utils;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import org.jspecify.annotations.NullMarked;
/**
* Constants used in the SDK.
*/
@NullMarked
public final class Const {
/**
* Hidden constructor
*/
private Const() {
// Private constructor
}
/**
* Default registry
*/
public static final String DEFAULT_REGISTRY = "docker.io";
/**
* Default tag
*/
public static final String DEFAULT_TAG = "latest";
/**
* Index file in OCI layout
*/
public static final String OCI_LAYOUT_INDEX = "index.json";
/**
* Layout folder in OCI layout
*/
public static final String OCI_LAYOUT_FILE = "oci-layout";
/**
* Blobs folder in OCI layout
*/
public static final String OCI_LAYOUT_BLOBS = "blobs";
/**
* The default blob directory media type
*/
public static final String DEFAULT_BLOB_DIR_MEDIA_TYPE = "application/vnd.oci.image.layer.v1.tar+gzip";
/**
* The blob directory media type for zstd compression
*/
public static final String BLOB_DIR_ZSTD_MEDIA_TYPE = "application/vnd.oci.image.layer.v1.tar+zstd";
/**
* The default artifact media type if not specified
*/
public static final String DEFAULT_ARTIFACT_MEDIA_TYPE = "application/vnd.unknown.artifact.v1";
/**
* The default blob media type if file type cannot be determined
*/
public static final String DEFAULT_BLOB_MEDIA_TYPE = "application/vnd.oci.image.layer.v1.tar";
/**
* The default descriptor media type
*/
public static final String DEFAULT_DESCRIPTOR_MEDIA_TYPE = "application/octet-stream";
/**
* The default JSON media type
*/
public static final String DEFAULT_JSON_MEDIA_TYPE = "application/json";
/**
* The default empty media type
*/
public static final String DEFAULT_EMPTY_MEDIA_TYPE = "application/vnd.oci.empty.v1+json";
/**
* Default index media type
*/
public static final String DEFAULT_INDEX_MEDIA_TYPE = "application/vnd.oci.image.index.v1+json";
/**
* The artifact manifest media type
*/
public static final String ARTIFACT_MANIFEST_MEDIA_TYPE = "application/vnd.oci.artifact.manifest.v1+json";
/**
* Docker distribution manifest type
*/
public static final String DOCKER_MANIFEST_MEDIA_TYPE = "application/vnd.docker.distribution.manifest.v2+json";
/**
* Docker index media type (manifest list or fat manifest)
*/
public static final String DOCKER_INDEX_MEDIA_TYPE = "application/vnd.docker.distribution.manifest.list.v2+json";
/**
* Docker legacy media type
*/
public static final String DOCKER_LEGACY_MEDIA_TYPE = "application/vnd.docker.distribution.manifest.v1+prettyjws";
/**
* The default manifest media type
*/
public static final String DEFAULT_MANIFEST_MEDIA_TYPE = "application/vnd.oci.image.manifest.v1+json";
/**
* The default accept type for the manifest
*/
public static final String MANIFEST_ACCEPT_TYPE = "%s, %s, %s, %s, %s"
.formatted(
DEFAULT_INDEX_MEDIA_TYPE,
DEFAULT_MANIFEST_MEDIA_TYPE,
ARTIFACT_MANIFEST_MEDIA_TYPE,
DOCKER_INDEX_MEDIA_TYPE,
DOCKER_MANIFEST_MEDIA_TYPE);
/**
* Annotation for the title
*/
public static final String ANNOTATION_TITLE = "org.opencontainers.image.title";
/**
* Annotation for the crated date
*/
public static final String ANNOTATION_CREATED = "org.opencontainers.image.created";
/**
* Annotation for the ref name
*/
public static final String ANNOTATION_REF = "org.opencontainers.image.ref.name";
/**
* Get the current timestamp for the created annotation
* @return The current timestamp
*/
public static String currentTimestamp() {
return Instant.now()
.truncatedTo(java.time.temporal.ChronoUnit.SECONDS)
.atOffset(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}
/**
* Annotation of the uncompressed dir content
*/
public static final String ANNOTATION_ORAS_CONTENT_DIGEST = "io.deis.oras.content.digest";
/**
* Annotation to unpack the content
*/
public static final String ANNOTATION_ORAS_UNPACK = "io.deis.oras.content.unpack";
/**
* Authorization header
*/
public static final String AUTHORIZATION_HEADER = "Authorization";
/**
* Content type header
*/
public static final String CONTENT_TYPE_HEADER = "Content-Type";
/**
* Content length header
*/
public static final String CONTENT_LENGTH_HEADER = "Content-Length";
/**
* The Docker content digest header
*/
public static final String DOCKER_CONTENT_DIGEST_HEADER = "Docker-Content-Digest";
/**
* OCI subject header
*/
public static final String OCI_SUBJECT_HEADER = "OCI-Subject";
/**
* Accept header
*/
public static final String ACCEPT_HEADER = "Accept";
/**
* Location header
*/
public static final String LOCATION_HEADER = "Location";
/**
* WWW-Authenticate header
*/
public static final String WWW_AUTHENTICATE_HEADER = "WWW-Authenticate";
/**
* Application octet stream header value
*/
public static final String APPLICATION_OCTET_STREAM_HEADER_VALUE = "application/octet-stream";
/**
* Content Range header
*/
public static final String CONTENT_RANGE_HEADER = "Content-Range";
/**
* Range header
*/
public static final String RANGE_HEADER = "Range";
/**
* OCI Chunk Minimum Length header
*/
public static final String OCI_CHUNK_MIN_LENGTH_HEADER = "OCI-Chunk-Min-Length";
}