rustyrazorblade commented on code in PR #212:
URL: 
https://github.com/apache/cassandra-analytics/pull/212#discussion_r3319002594


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/transports/storage/IamStorageAuth.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cassandra.spark.transports.storage;
+
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
+
+/**
+ * {@link StorageAuth} implementation for IAM instance profile / IRSA / ECS 
task role authentication.
+ * Carries no static credentials; the AWS SDK resolves them automatically via 
its default provider chain.
+ * Use {@link #INSTANCE} — there is no per-instance state.
+ */
+public final class IamStorageAuth implements StorageAuth
+{
+    public static final IamStorageAuth INSTANCE = new IamStorageAuth();
+
+    private IamStorageAuth()
+    {
+    }
+
+    @Override
+    public AwsCredentialsProvider toAwsCredentialsProvider()
+    {
+        return DefaultCredentialsProvider.create();
+    }

Review Comment:
   Done.



##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkSourceRelation.java:
##########
@@ -478,12 +480,26 @@ private void 
createRestoreJobsOnAllClusters(TransportContext.CloudStorageTranspo
         });
     }
 
-    private CreateRestoreJobRequestPayload.Builder 
createJobPayloadBuilder(JobInfo job, RestoreJobSecrets secrets)
+    /**
+     * Builds {@link RestoreJobSecrets} appropriate for the given credential 
type.
+     * When {@code credentialTypeName} is {@code "IAM"} (case-insensitive), 
region-only secrets are produced
+     * and the sidecar will use the AWS default credential chain.
+     * Otherwise, full static credentials from the pair are used.
+     */
+    static RestoreJobSecrets buildRestoreJobSecrets(StorageCredentialPair pair,
+                                                    
@org.jetbrains.annotations.Nullable String credentialTypeName)
     {
-        return createJobPayloadBuilder(job, secrets, null);
+        if ("IAM".equalsIgnoreCase(credentialTypeName))

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to