Class AccountManager


  • public class AccountManager
    extends Object
    Organizations API implementation.
    • Field Detail

      • DEFAULT_SLEEP_INTERVAL

        private static final long DEFAULT_SLEEP_INTERVAL
        Default sleep interval (1 minute).
        See Also:
        Constant Field Values
      • logger

        private org.slf4j.Logger logger
        Logger.
      • organizations

        private com.amazonaws.services.organizations.AWSOrganizations organizations
        AWS Organizations API client.
      • sleepInterval

        private long sleepInterval
        Sleep interval for status change checks.
    • Constructor Detail

      • AccountManager

        public AccountManager​(com.amazonaws.services.organizations.AWSOrganizations organizations)
        Initializes object with given Organizations client.
        Parameters:
        organizations - AWS Organizations client.
    • Method Detail

      • provision

        public pl.wrzasq.commons.aws.cloudformation.CustomResourceResponse<com.amazonaws.services.organizations.model.Account> provision​(AccountRequest input,
                                                                                                                                         String physicalResourceId)
        Handles account creation.
        Parameters:
        input - Resource creation request.
        physicalResourceId - Physical ID of existing resource (in this case always null).
        Returns:
        Data about published version.
      • delete

        public pl.wrzasq.commons.aws.cloudformation.CustomResourceResponse<com.amazonaws.services.organizations.model.Account> delete​(AccountRequest input,
                                                                                                                                      String physicalResourceId)
        Handles organization deletion.
        Parameters:
        input - Resource delete request.
        physicalResourceId - Physical ID of existing resource (if present).
        Returns:
        Empty response.
      • initializeAccount

        private String initializeAccount​(AccountRequest input)
        Manages new account for organization.
        Parameters:
        input - Account specification.
        Returns:
        Account ID.
      • createAccount

        private String createAccount​(String email,
                                     String name,
                                     String roleName)
        Creates plain, new account.
        Parameters:
        email - E-mail address for root access.
        name - Account label.
        roleName - Administration role name.
        Returns:
        Account ID.
      • inviteAccount

        private String inviteAccount​(String accountId)
        Invites existing account to organization.
        Parameters:
        accountId - Existing account ID.
        Returns:
        Account ID.
      • resolveExistingAccount

        private String resolveExistingAccount​(String accountId,
                                              AccountRequest input)
        Resolves ID of existing resource.
        Parameters:
        accountId - Currently provisioned ID.
        input - Desired account specification.
        Returns:
        Resolved account ID.
      • sleep

        private void sleep()
        Performs a wait.
      • setSleepInterval

        public void setSleepInterval​(long sleepInterval)
        Sleep interval for status change checks.