Class AwsIam

java.lang.Object
com.salesforce.multicloudj.iam.driver.AbstractIam
com.salesforce.multicloudj.iam.aws.AwsIam
All Implemented Interfaces:
Provider, SdkService, Identity, AutoCloseable

@AutoService(AbstractIam.class) public class AwsIam extends AbstractIam
  • Field Details

  • Constructor Details

    • AwsIam

      public AwsIam(AwsIam.Builder builder)
    • AwsIam

      public AwsIam()
  • Method Details

    • builder

      public Provider.Builder builder()
      Description copied from interface: Provider
      Creates and returns a new Builder instance for this provider.
      Returns:
      A Builder instance for constructing this provider.
    • mapException

      public SubstrateSdkException mapException(Throwable t)
      Description copied from interface: SdkService
      Maps a provider-specific Throwable to a fully-built SubstrateSdkException the caller can throw directly. The returned exception carries both the typed mapping (e.g. ResourceNotFoundException for HTTP 404) and an authoritative retryable flag derived from the native cloud SDK signal (e.g. AWS throttling, GCP ApiException.isRetryable(), status codes), or the type's default retryability when the SDK exposes no native signal.

      Callers throw the result; they do not inspect or transform it further:

      
       try {
         ...
       } catch (Throwable t) {
         throw provider.mapException(t);
       }
       

      Implementation contract: implementations should compute a typed exception class (typically via their per-service ErrorCodeMapping) and a retryable hint, then return ExceptionHandler.build(exceptionClass, t, retryableHint). Implementations do not need to short-circuit when t is already a SubstrateSdkException: ExceptionHandler.build preserves an already-mapped exception's concrete subtype and retryable flag.

      Parameters:
      t - the original throwable from the provider SDK
      Returns:
      a built SubstrateSdkException ready to throw
    • close

      public void close() throws Exception
      Throws:
      Exception
    • doCreateIdentity

      protected String doCreateIdentity(CreateIdentityRequest request)
      Create IAM Role with optional Trust Configuration and Create Options.
      Specified by:
      doCreateIdentity in class AbstractIam
      Parameters:
      request - the request containing identity name, description, tenant ID, region, trust config, and options.
      Returns:
      the IAM role ARN.
    • doAttachInlinePolicy

      protected void doAttachInlinePolicy(AttachInlinePolicyRequest request)
      Description copied from class: AbstractIam
      Attaches an inline policy to an identity. Provider-specific implementations should override this method.
      Specified by:
      doAttachInlinePolicy in class AbstractIam
      Parameters:
      request - the request containing policy document, tenant ID, region, and identity/role names
    • doGetInlinePolicyDetails

      protected String doGetInlinePolicyDetails(GetInlinePolicyDetailsRequest request)
      Get inline policy document attached to an IAM role.
      Specified by:
      doGetInlinePolicyDetails in class AbstractIam
      Parameters:
      request - the request containing relevant fields from identity name, policy name, role name, tenant ID, and region
      Returns:
      the inline policy document as a JSON string
    • doGetAttachedPolicies

      protected List<String> doGetAttachedPolicies(GetAttachedPoliciesRequest request)
      Lists all inline policies attached to an IAM role.
      Specified by:
      doGetAttachedPolicies in class AbstractIam
      Parameters:
      request - the request; AWS uses roleName only (IAM role to list policies for)
      Returns:
      a list of inline policy names attached to the role.
    • doRemovePolicy

      protected void doRemovePolicy(RemovePolicyRequest request)
      Removes an inline policy from an IAM role.
      Specified by:
      doRemovePolicy in class AbstractIam
      Parameters:
      request - the request containing identity name, policy name, tenant ID, and region.
    • doDeleteIdentity

      protected void doDeleteIdentity(DeleteIdentityRequest request)
      Delete IAM Role.
      Specified by:
      doDeleteIdentity in class AbstractIam
      Parameters:
      request - the request containing identity name, tenant ID, and region.
    • doGetIdentity

      protected String doGetIdentity(GetIdentityRequest request)
      Get IAM Role.
      Specified by:
      doGetIdentity in class AbstractIam
      Parameters:
      request - the request containing identity name, tenant ID, and region.
      Returns:
      the IAM role ARN.