bxt.command.cognitoidentity.Module Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bxt Show documentation
Show all versions of bxt Show documentation
Command-line tools for Amazon Web Services
The newest version!
package bxt.command.cognitoidentity;
import bxt.annotation.Interactive;
import bxt.command.CommandInfo;
import bxt.command.CommandInfoBuilder;
import bxt.util.Prompts;
import com.amazonaws.services.cognitoidentity.model.CreateIdentityPoolRequest;
import com.amazonaws.services.cognitoidentity.model.ListIdentityPoolsRequest;
import com.google.common.collect.ImmutableCollection;
import dagger.Provides;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
@dagger.Module
public final class Module {
@Provides
@Singleton
@Named("cognitoidentity")
ImmutableCollection extends CommandInfo> provideCommands(
CreateIdentityPool createIdentityPool,
ListIdentityPools listIdentityPools,
@Interactive Provider createIdentityPoolInteractively) {
return new CommandInfoBuilder()
.add(
createIdentityPool,
new bxt.request.cli.cognitoidentity.CreateIdentityPool(),
createIdentityPoolInteractively)
.add(
listIdentityPools,
new bxt.request.cli.cognitoidentity.ListIdentityPools(),
() -> new ListIdentityPoolsRequest().withMaxResults(60))
.build();
}
@Provides
@Interactive
CreateIdentityPoolRequest createIdentityPool() {
String name = Prompts.input("pool name:").get();
boolean allowUnauthenticatedIdentities = Prompts.yesNo("allow unauthenticated identities?");
return new CreateIdentityPoolRequest()
.withIdentityPoolName(name)
.withAllowUnauthenticatedIdentities(allowUnauthenticatedIdentities);
}
}