Skip to content

Commit

Permalink
fix: use key id and secret key
Browse files Browse the repository at this point in the history
  • Loading branch information
ronjaquensel committed Dec 4, 2024
1 parent fab4b96 commit f814df8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import org.eclipse.edc.aws.s3.spi.S3BucketSchema;
import org.eclipse.edc.connector.controlplane.transfer.spi.types.ProvisionedDataDestinationResource;

import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.ACCESS_KEY_ID;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.BUCKET_NAME;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.ENDPOINT_OVERRIDE;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.REGION;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.SECRET_ACCESS_KEY;


/**
Expand Down Expand Up @@ -82,8 +84,13 @@ public Builder endpointOverride(String endpointOverride) {
return this;
}

public Builder keyName(String keyName) {
dataAddressBuilder.keyName(keyName);
public Builder accessKeyId(String accessKeyId) {
dataAddressBuilder.property(ACCESS_KEY_ID, accessKeyId);
return this;
}

public Builder secretAccessKey(String secretAccessKey) {
dataAddressBuilder.property(SECRET_ACCESS_KEY, secretAccessKey);
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ private StatusResult<ProvisionResponse> provisionSucceeded(S3BucketResourceDefin
.transferProcessId(resourceDefinition.getTransferProcessId())
.resourceName(resourceDefinition.getBucketName())
.endpointOverride(resourceDefinition.getEndpointOverride())
.keyName(resourceDefinition.getKeyName())
.accessKeyId(resourceDefinition.getAccessKeyId())
.secretAccessKey(resourceDefinition.getSecretAccessKey())
.build();

monitor.debug("S3BucketProvisioner: Bucket created successfully: " + resourceDefinition.getBucketName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class S3BucketResourceDefinition extends ResourceDefinition {
private String regionId;
private String bucketName;
private String endpointOverride;
private String keyName;
private String accessKeyId;
private String secretAccessKey;

private S3BucketResourceDefinition() {
}
Expand All @@ -48,8 +49,12 @@ public String getEndpointOverride() {
return endpointOverride;
}

public String getKeyName() {
return keyName;
public String getAccessKeyId() {
return accessKeyId;
}

public String getSecretAccessKey() {
return secretAccessKey;
}

@Override
Expand All @@ -58,7 +63,8 @@ public Builder toBuilder() {
.regionId(regionId)
.bucketName(bucketName)
.endpointOverride(endpointOverride)
.keyName(keyName);
.accessKeyId(accessKeyId)
.secretAccessKey(secretAccessKey);
}

@JsonPOJOBuilder(withPrefix = "")
Expand Down Expand Up @@ -87,8 +93,13 @@ public Builder endpointOverride(String endpointOverride) {
return this;
}

public Builder keyName(String keyName) {
resourceDefinition.keyName = keyName;
public Builder accessKeyId(String accessKeyId) {
resourceDefinition.accessKeyId = accessKeyId;
return this;
}

public Builder secretAccessKey(String secretAccessKey) {
resourceDefinition.secretAccessKey = secretAccessKey;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import software.amazon.awssdk.regions.Region;

import static java.util.UUID.randomUUID;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.ACCESS_KEY_ID;
import static org.eclipse.edc.aws.s3.spi.S3BucketSchema.SECRET_ACCESS_KEY;

/**
* Generates S3 buckets on the consumer (requesting connector) that serve as data destinations.
Expand All @@ -44,7 +46,8 @@ public ResourceDefinition generate(TransferProcess transferProcess, Policy polic
.bucketName(dataDestination.getStringProperty(S3BucketSchema.BUCKET_NAME))
.regionId(dataDestination.getStringProperty(S3BucketSchema.REGION))
.endpointOverride(endpointOverride)
.keyName(transferProcess.getDataDestination().getKeyName())
.accessKeyId(transferProcess.getDataDestination().getStringProperty(ACCESS_KEY_ID))
.secretAccessKey(transferProcess.getDataDestination().getStringProperty(SECRET_ACCESS_KEY))
.build();
}

Expand Down

0 comments on commit f814df8

Please sign in to comment.