Codota Logo
GlobalAccountApi
Code IndexAdd Codota to your IDE (free)

How to use
GlobalAccountApi
in
org.jclouds.cloudstack.features

Best Java code snippets using org.jclouds.cloudstack.features.GlobalAccountApi (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: apache/jclouds

public static Account createTestAccount(CloudStackGlobalApi client, String prefix) {
 return client.getAccountApi().createAccount(prefix + "-account", Account.Type.USER, "dummy@example.com",
    "First", "Last", base16().lowerCase().encode(md5().hashString("password", UTF_8).asBytes()));
}
origin: io.brooklyn.networking/brooklyn-networking-cloudstack

public String findDomainIdForAccount(String accountName) {
  Set<Account> accounts = client.getAccountClient().listAccounts(ListAccountsOptions.Builder.name(accountName));
  Account account = Iterables.getOnlyElement(accounts, null);
  if (account == null) {
    throw new IllegalStateException("No account found in "+loc+"} with name "+accountName);
  }
  return account.getDomainId();
}
origin: apache/jclouds

@Test
public void testCreateAndRemoveAccount() {
 skipIfNotGlobalAdmin();
 Account account = null;
 try {
   account = createTestAccount(globalAdminClient, prefix);
   assertNotNull(account);
   assertEquals(account.getName(), prefix + "-account");
   assertEquals(account.getType(), Account.Type.USER);
   Account updated = globalAdminClient.getAccountApi().updateAccount(
    account.getName(), account.getDomainId(), prefix + "-account-2");
   assertNotNull(updated);
   assertEquals(updated.getName(), prefix + "-account-2");
 } finally {
   if (account != null) {
    globalAdminClient.getAccountApi().deleteAccount(account.getId());
   }
 }
}
origin: apache/jclouds

@Test
public void testEnableDisableAccount() {
 skipIfNotGlobalAdmin();
 Account testAccount = null;
 try {
   testAccount = createTestAccount(globalAdminClient, prefix);
      AsyncCreateResponse response = domainAdminClient.getAccountApi()
    .disableAccount(testAccount.getName(), testAccount.getDomainId(), false);
   assertNotNull(response);
   assertTrue(adminJobComplete.apply(response.getJobId()));
   AsyncJob<Account> job = domainAdminClient.getAsyncJobApi().getAsyncJob(response.getJobId());
   assertEquals(job.getResult().getState(), Account.State.DISABLED);
   Account updated = domainAdminClient.getAccountApi()
    .enableAccount(testAccount.getName(), testAccount.getDomainId());
   assertNotNull(updated);
   assertEquals(updated.getState(), Account.State.ENABLED);
 } finally {
   if (testAccount != null) {
    globalAdminClient.getAccountApi().deleteAccount(testAccount.getId());
   }
 }
}
origin: apache/jclouds

@Test
public void testCreateUser() {
 skipIfNotGlobalAdmin();
 Account testAccount = createTestAccount(globalAdminClient, prefix);
 User testUser = null;
 try {
   testUser = createTestUser(globalAdminClient, testAccount, prefix);
   assertNotNull(testUser);
   assertEquals(testUser.getName(), prefix + "-user");
   assertEquals(testUser.getAccount(), prefix + "-account");
   User updatedUser = globalAdminClient.getUserClient()
    .updateUser(testUser.getId(), userName(prefix + "-user-2"));
   assertNotNull(updatedUser);
   assertEquals(updatedUser.getName(), prefix + "-user-2");
   ApiKeyPair apiKeys = globalAdminClient.getUserClient()
    .registerUserKeys(updatedUser.getId());
   assertNotNull(apiKeys.getApiKey());
   assertNotNull(apiKeys.getSecretKey());
   checkAuthAsUser(apiKeys);
 } finally {
   if (testUser != null) {
    globalAdminClient.getUserClient().deleteUser(testUser.getId());
   }
   globalAdminClient.getAccountApi().deleteAccount(testAccount.getId());
 }
}
origin: apache/jclouds

globalAdminClient.getAccountApi().deleteAccount(testAccount.getId());
origin: apache/jclouds

@Test
public void testCreateContextUsingUserAndPasswordAuthentication() {
 skipIfNotGlobalAdmin();
 Account testAccount = null;
 User testUser = null;
 String prefix = this.prefix + "-session";
 try {
   testAccount = createTestAccount(globalAdminClient, prefix);
   testUser = createTestUser(globalAdminClient, testAccount, prefix);
   String expectedUsername = prefix + "-user";
   assertEquals(testUser.getName(), expectedUsername);
   checkLoginAsTheNewUser(expectedUsername);
   ApiKeyPair expected = globalAdminClient.getUserClient().registerUserKeys(testUser.getId());
   ApiKeyPair actual = ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair(
    URI.create(endpoint), prefix + "-user", "password", "");
   assertEquals(actual, expected);
 } finally {
   if (testUser != null)
    globalAdminClient.getUserClient().deleteUser(testUser.getId());
   if (testAccount != null)
    globalAdminClient.getAccountApi().deleteAccount(testAccount.getId());
 }
}
org.jclouds.cloudstack.featuresGlobalAccountApi

Javadoc

Provides synchronous access to CloudStack Account features available to Global Admin users.

Most used methods

  • createAccount
    Create a new Cloudstack account
  • deleteAccount
    Delete an account with the specified ID
  • listAccounts
  • updateAccount
    Update an existing account

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • orElseThrow (Optional)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now