Walter Johnson
09/07/2022, 2:35 PMimport {ListObjectsCommand, S3Client} from "@aws-sdk/client-s3";
import { fromIni } from "@aws-sdk/credential-providers";
const client = new S3Client({
credentials: fromIni({profile: 'local'}),
endpoint: "<http://localhost:8000>",
});
var input = {
Bucket:"call-center3"
};
const command = new ListObjectsCommand(input);
const response = await client.send(command);
console.log(response)
Itai Admi
09/07/2022, 2:38 PMlocal
profile in the file is pointing to lakeFS.
2. Unlike S3, lakeFS has branches. When you try to list objects from a repository you need to pass a prefix as well for the branch (must) and a prefix under the branch (optional).Walter Johnson
09/07/2022, 2:51 PMItai Admi
09/07/2022, 2:52 PM/
Walter Johnson
09/07/2022, 3:01 PMimport {ListObjectsCommand,ListObjectsV2Command,ListBucketsCommand, S3Client} from "@aws-sdk/client-s3";
import { fromIni } from "@aws-sdk/credential-providers";
const client = new S3Client({
credentials: fromIni({profile: 'local'}),
endpoint: "<http://localhost:8000>",
bucketEndpoint: false,
});
var input = {
Bucket:"call-center3",
Prefix:"main/"
};
const command = new ListBucketsCommand({});
const response = await client.send(command);
console.log(response)
{
'$metadata': {
httpStatusCode: 200,
requestId: undefined,
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
Buckets: [
{ Name: 'call-center', CreationDate: 2022-09-06T14:45:37.661Z },
{ Name: 'call-center2', CreationDate: 2022-09-06T14:51:10.171Z },
{ Name: 'call-center3', CreationDate: 2022-09-06T15:06:38.831Z }
],
Owner: { DisplayName: '', ID: '' }
}
Itai Admi
09/07/2022, 3:02 PMWalter Johnson
09/07/2022, 3:02 PMimport {ListObjectsCommand,ListObjectsV2Command,ListBucketsCommand, S3Client} from "@aws-sdk/client-s3";
import { fromIni } from "@aws-sdk/credential-providers";
const client = new S3Client({
credentials: fromIni({profile: 'local'}),
endpoint: "<http://localhost:8000>",
bucketEndpoint: false,
});
var input = {
Bucket:"call-center3",
Prefix:"main/"
};
const command = new ListObjectsV2Command(input);
const response = await client.send(command);
console.log(response)
Produces this response :
{
'$metadata': {
httpStatusCode: 200,
requestId: undefined,
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
}
}
Itai Admi
09/07/2022, 3:03 PMmain
branch?Walter Johnson
09/07/2022, 3:03 PMItai Admi
09/07/2022, 3:08 PMWalter Johnson
09/07/2022, 3:09 PMItai Admi
09/07/2022, 3:10 PMWalter Johnson
09/07/2022, 3:10 PMItai Admi
09/07/2022, 3:12 PMdocker logs <container_id>
Walter Johnson
09/07/2022, 3:16 PMItai Admi
09/07/2022, 3:19 PMlogging:
level: trace
Yes, container needs to restart. But not deleted.Walter Johnson
09/07/2022, 3:51 PMlogging:
format: json
level: TRACE
output: "-"
I then restarted my container and added a file through the UI. I don't see an increased level of logging. Do you have any idea what I have done wrong?Itai Admi
09/07/2022, 3:52 PMLAKEFS_LOGGING_LEVEL=TRACE
docker-compose
?Walter Johnson
09/07/2022, 3:56 PMItai Admi
09/07/2022, 3:57 PMWalter Johnson
09/07/2022, 4:59 PMtime="2022-09-07T16:56:23Z" level=debug msg="performing S3 action" func=pkg/gateway.EnrichWithOperation.func1.1 file="build/pkg/gateway/middleware.go:116" action=list_repos message_type=action
time="2022-09-07T16:56:23Z" level=debug msg="HTTP call ended" func=net/http.HandlerFunc.ServeHTTP file="usr/local/go/src/net/http/server.go:2047" host=localhost log_audit=API method=GET path=/ request_id=62baec00-fc16-444a-9042-1b8a0027e927 sent_bytes=529 service_name=s3_gateway status_code=200 took=25.8603ms user=admin
time="2022-09-07T16:56:23Z" level=debug msg="performing S3 action" func=pkg/gateway.EnrichWithOperation.func1.1 file="build/pkg/gateway/middleware.go:116" action=list_repos message_type=action
time="2022-09-07T16:56:23Z" level=debug msg="HTTP call ended" func=net/http.HandlerFunc.ServeHTTP file="usr/local/go/src/net/http/server.go:2047" host=call-center2.localhost log_audit=API method=GET path="/?prefix=main%2F" request_id=a98659cc-ae3a-44de-a5ef-ce01f248c4f4 sent_bytes=529 service_name=s3_gateway status_code=200 took=2.7925ms user=admin
Itai Admi
09/07/2022, 5:09 PMlist_repos
as lakeFS writes it)Walter Johnson
09/07/2022, 5:14 PMItai Admi
09/07/2022, 5:18 PMAmazonS3 s3client = AmazonS3Client.builder()
.withCredentials((new AWSStaticCredentialsProvider(credentials)))
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("host", "region"))
.withPathStyleAccessEnabled(true)
.build();
Walter Johnson
09/07/2022, 5:25 PMconst client = new S3Client({
credentials: fromIni({profile: 'local'}),
endpoint: "<http://localhost:8000>",
bucketEndpoint: false,
forcePathStyle:true
});
Itai Admi
09/07/2022, 5:26 PMWalter Johnson
09/07/2022, 5:27 PM