Skip to content

Commit b4a8e3f

Browse files
Loading server.properties into S3BucketConfig
1 parent 7ada19b commit b4a8e3f

File tree

5 files changed

+104
-1
lines changed

5 files changed

+104
-1
lines changed

docs/cli/UnityCatalogCli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Personal access token (PAT) to authorize requests
1010

11-
When specified, `UnityCatalogCli` [creates an ApiClient](#getApiClient) that adds `authorization` header with `Bearer [pat]` to every request.
11+
When specified, `UnityCatalogCli` [creates an ApiClient](#getApiClient) that adds the bearer token in the HTTP `Authorization` header to every request.
1212

1313
```text
1414
authorization: Bearer [pat]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
11
# PropertiesUtil
2+
3+
`PropertiesUtil` is a system-wide [configuration of S3 buckets](#loadProperties)
4+
5+
## Loading S3 Bucket Configuration { #loadProperties }
6+
7+
```java
8+
void loadProperties()
9+
```
10+
11+
`loadProperties` loads the key-value pairs from `etc/conf/server.properties` file into the [Properties](#properties).
12+
13+
`loadProperties` prints out the following DEBUG message to the logs:
14+
15+
```text
16+
Properties loaded successfully
17+
```
18+
19+
`loadProperties` creates a [S3BucketConfig](S3BucketConfig.md) for every tuple of the following properties:
20+
21+
* `s3.bucketPath.[n]`
22+
* `s3.accessKey.[n]`
23+
* `s3.secretKey.[n]`
24+
* `s3.sessionToken.[n]`
25+
26+
!!! note
27+
`loadProperties` silently skips processing a tuple if any of the properties is undefined (`null`).
28+
29+
In the end, `loadProperties` registers the `S3BucketConfig`s by `s3.bucketPath`.
30+
31+
---
32+
33+
`loadProperties` is used when:
34+
35+
* `PropertiesUtil` is created
36+
37+
## Looking Up S3BucketConfig by S3 Path { #getS3BucketConfig }
38+
39+
```java
40+
S3BucketConfig getS3BucketConfig(
41+
String s3Path)
42+
```
43+
44+
`getS3BucketConfig` creates a URI for the given `s3Path`.
45+
46+
`getS3BucketConfig` creates a bucket path for the following URI parts (separated using `://`):
47+
48+
* Scheme
49+
* Host
50+
51+
`getS3BucketConfig` uses the bucket path (`scheme://host`) to look up the `S3BucketConfig` in the [Properties](#properties).
52+
53+
---
54+
55+
`getS3BucketConfig` is used when:
56+
57+
* `TemporaryCredentialUtils` is requested to [find a S3 bucket config](../server/TemporaryCredentialUtils.md#findS3BucketConfig)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# S3BucketConfig
2+
3+
`S3BucketConfig` is a S3 bucket configuration.
4+
5+
`S3BucketConfig` is used when:
6+
7+
* `TemporaryCredentialUtils` is requested to [findS3BucketConfig](../server/TemporaryCredentialUtils.md#findS3BucketConfig)
8+
* `PropertiesUtil` is requested to [getS3BucketConfig](PropertiesUtil.md#getS3BucketConfig)
9+
10+
## Creating Instance
11+
12+
`S3BucketConfig` takes the following to be created:
13+
14+
* <span id="bucketPath"> `bucketPath`
15+
* <span id="accessKey"> `accessKey`
16+
* <span id="secretKey"> `secretKey`
17+
* <span id="sessionToken"> `sessionToken`
18+
19+
`S3BucketConfig` is created when:
20+
21+
* `PropertiesUtil` is requested to [loadProperties](PropertiesUtil.md#loadProperties)

docs/server/AwsCredentials.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# AwsCredentials
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# TemporaryCredentialUtils
2+
3+
## Looking Up AwsCredentials for S3 Storage Location { #findS3BucketConfig }
4+
5+
```java
6+
AwsCredentials findS3BucketConfig(
7+
String storageLocation)
8+
```
9+
10+
`findS3BucketConfig` requests the system-wide [PropertiesUtil](../persistent-storage/PropertiesUtil.md#instance) instance for [getS3BucketConfig](../persistent-storage/PropertiesUtil.md#getS3BucketConfig).
11+
12+
`findS3BucketConfig` creates a [AwsCredentials](../server/AwsCredentials.md).
13+
14+
Property | Value
15+
-|-
16+
[accessKeyId](../server/AwsCredentials.md#accessKeyId) | [accessKey](../persistent-storage/S3BucketConfig.md#accessKey)
17+
[secretAccessKey](../server/AwsCredentials.md#secretAccessKey) | [secretKey](../persistent-storage/S3BucketConfig.md#secretKey)
18+
[sessionToken](../server/AwsCredentials.md#sessionToken) | [sessionToken](../persistent-storage/S3BucketConfig.md#sessionToken)
19+
20+
---
21+
22+
`findS3BucketConfig` is used when:
23+
24+
* `TemporaryTableCredentialsService` is requested to [generateTemporaryTableCredential](TemporaryTableCredentialsService.md#generateTemporaryTableCredential)
25+
* `TemporaryVolumeCredentialsService` is requested to [generateTemporaryTableCredential](TemporaryVolumeCredentialsService.md#generateTemporaryTableCredential)

0 commit comments

Comments
 (0)