Class AccountManager
- java.lang.Object
-
- pl.wrzasq.lambda.cform.account.service.AccountManager
-
public class AccountManager extends Object
Organizations API implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private static long
DEFAULT_SLEEP_INTERVAL
Default sleep interval (1 minute).private org.slf4j.Logger
logger
Logger.private com.amazonaws.services.organizations.AWSOrganizations
organizations
AWS Organizations API client.private long
sleepInterval
Sleep interval for status change checks.
-
Constructor Summary
Constructors Constructor Description AccountManager(com.amazonaws.services.organizations.AWSOrganizations organizations)
Initializes object with given Organizations client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
createAccount(String email, String name, String roleName)
Creates plain, new account.pl.wrzasq.commons.aws.cloudformation.CustomResourceResponse<com.amazonaws.services.organizations.model.Account>
delete(AccountRequest input, String physicalResourceId)
Handles organization deletion.private String
initializeAccount(AccountRequest input)
Manages new account for organization.private String
inviteAccount(String accountId)
Invites existing account to organization.pl.wrzasq.commons.aws.cloudformation.CustomResourceResponse<com.amazonaws.services.organizations.model.Account>
provision(AccountRequest input, String physicalResourceId)
Handles account creation.private String
resolveExistingAccount(String accountId, AccountRequest input)
Resolves ID of existing resource.void
setSleepInterval(long sleepInterval)
Sleep interval for status change checks.private void
sleep()
Performs a wait.
-
-
-
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.
-
-
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.
-
-