diff --git a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisionedResource.java b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisionedResource.java index 095d5343..2bd0a4af 100644 --- a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisionedResource.java +++ b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisionedResource.java @@ -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; /** @@ -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; } } diff --git a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisioner.java b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisioner.java index 58c7c585..b16320f5 100644 --- a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisioner.java +++ b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketProvisioner.java @@ -84,7 +84,8 @@ private StatusResult 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()); diff --git a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketResourceDefinition.java b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketResourceDefinition.java index 74f988ae..b199e646 100644 --- a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketResourceDefinition.java +++ b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3BucketResourceDefinition.java @@ -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() { } @@ -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 @@ -58,7 +63,8 @@ public Builder toBuilder() { .regionId(regionId) .bucketName(bucketName) .endpointOverride(endpointOverride) - .keyName(keyName); + .accessKeyId(accessKeyId) + .secretAccessKey(secretAccessKey); } @JsonPOJOBuilder(withPrefix = "") @@ -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; } diff --git a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3ConsumerResourceDefinitionGenerator.java b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3ConsumerResourceDefinitionGenerator.java index eb5b68b5..1b2efb9d 100644 --- a/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3ConsumerResourceDefinitionGenerator.java +++ b/policy/policy-02-provision/provision-aws-s3/src/main/java/org/eclipse/edc/connector/provision/aws/s3/S3ConsumerResourceDefinitionGenerator.java @@ -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. @@ -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(); }