-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathFgaConstants.java
More file actions
104 lines (73 loc) · 3.71 KB
/
FgaConstants.java
File metadata and controls
104 lines (73 loc) · 3.71 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
/**
* Java SDK for OpenFGA
*
* API version: 1.x
* Website: https://openfga.dev
* Documentation: https://openfga.dev/docs
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/java-sdk/blob/main/LICENSE)
*
* NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
*/
package dev.openfga.sdk.constants;
import java.time.Duration;
/**
* Centralized constants for the OpenFGA Java SDK.
*/
public final class FgaConstants {
/** Version of the OpenFGA Java SDK. */
public static final String SDK_VERSION = "0.9.5";
/** User agent used in HTTP requests. */
public static final String USER_AGENT = "openfga-sdk java/" + SDK_VERSION;
/** Example API domain for documentation/tests. */
public static final String SAMPLE_BASE_DOMAIN = "fga.example";
/** API URL used for tests. */
public static final String TEST_API_URL = "https://api." + SAMPLE_BASE_DOMAIN;
/** API Token Issuer URL used for tests. */
public static final String TEST_ISSUER_URL = "https://issuer." + SAMPLE_BASE_DOMAIN;
/** Default API URL. */
public static final String DEFAULT_API_URL = "http://localhost:8080";
// Retry configuration
/** Maximum allowed number of retries for HTTP requests. */
public static final int RETRY_MAX_ALLOWED_NUMBER = 15;
/** Default maximum number of retries for HTTP requests. */
public static final int DEFAULT_MAX_RETRY = 3;
/** Default minimum wait time between retries in milliseconds. */
public static final Duration DEFAULT_MIN_WAIT_IN_MS = Duration.ofMillis(100);
/** Maximum backoff time in seconds. */
public static final int MAX_BACKOFF_TIME_IN_SEC = 120;
/** Maximum allowable duration for retry headers in seconds. */
public static final int RETRY_HEADER_MAX_ALLOWABLE_DURATION_IN_SEC = 1800;
/** Standard HTTP header for retry-after. */
public static final String RETRY_AFTER_HEADER_NAME = "Retry-After";
/** Rate limit reset header name. */
public static final String RATE_LIMIT_RESET_HEADER_NAME = "X-RateLimit-Reset";
/** Alternative rate limit reset header name. */
public static final String RATE_LIMIT_RESET_ALT_HEADER_NAME = "X-Rate-Limit-Reset";
// Client methods
/** Maximum number of parallel requests for a single method. */
public static final int CLIENT_MAX_METHOD_PARALLEL_REQUESTS = 10;
/** Maximum batch size for batch requests. */
public static final int CLIENT_MAX_BATCH_SIZE = 50;
/** Header used to identify the client method. */
public static final String CLIENT_METHOD_HEADER = "X-OpenFGA-Client-Method";
/** Header used to identify bulk requests. */
public static final String CLIENT_BULK_REQUEST_ID_HEADER = "X-OpenFGA-Client-Bulk-Request-Id";
// Connection options
/** Default timeout for HTTP requests in milliseconds. */
public static final Duration DEFAULT_REQUEST_TIMEOUT_IN_MS = Duration.ofMillis(10000);
/** Default connection timeout in milliseconds. */
public static final Duration DEFAULT_CONNECTION_TIMEOUT_IN_MS = Duration.ofMillis(10000);
// Token management
/** Buffer time in seconds before token expiry to consider it expired. */
public static final int TOKEN_EXPIRY_THRESHOLD_BUFFER_IN_SEC = 300;
/** Jitter time in seconds to add randomness to token expiry checks. */
public static final int TOKEN_EXPIRY_JITTER_IN_SEC = 300;
// FGA Response Headers
/** Response header name for query duration in milliseconds. */
public static final String QUERY_DURATION_HEADER_NAME = "fga-query-duration-ms";
/** Prevent instantiation. */
private FgaConstants() {
throw new AssertionError("Do not instantiate.");
}
}