Package org.jclouds.cloudstack

Examples of org.jclouds.cloudstack.CloudStackClient


         context =  ContextBuilder.newBuilder(new CloudStackApiMetadata())
               .endpoint(checkNotNull(endpoint, "endpoint").toASCIIString())
               .credentials(String.format("%s/%s", checkNotNull(domain, "domain"), checkNotNull(username, "username")), password)
               .overrides(overrides).build(CloudStackContext.class);

         CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi();
         Set<Account> listOfAccounts = client.getAccountClient().listAccounts();

         domain = (domain.equals("") || domain.equals("/")) ? "ROOT" : domain;
         for (Account account : listOfAccounts) {
            for (User user : account.getUsers()) {
               if (user.getName().equals(username) && user.getDomain().equals(domain)) {
View Full Code Here


   }

   private void checkAuthAsUser(ApiKeyPair keyPair) {
      ComputeServiceContext context = createView(credentialsAsProperties(keyPair), setupModules());

      CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi();
      Set<Account> accounts = client.getAccountClient().listAccounts();

      assert accounts.size() > 0;

      context.close();
   }
View Full Code Here

    }

    @Test
    public void testEnsureNetworkExistsWithProvidedExistingNetwork() throws Exception {
        final String networkId = "network-id-0123";
        final CloudStackClient mockClient = mock(CloudStackClient.class);
        final NetworkClient mockNetworkClient = mock(NetworkClient.class);
        final Network mockNetwork = mock(Network.class);
        final com.axemblr.provisionr.api.network.Network network = com.axemblr.provisionr.api.network.Network.builder()
            .option(NetworkOptions.EXISTING_NETWORK_ID, networkId).createNetwork();

        execution.setVariable(ProcessVariables.NETWORK_ID, networkId);

        when(pool.getNetwork()).thenReturn(network);
        when(mockClient.getNetworkClient()).thenReturn(mockNetworkClient);
        when(mockNetworkClient.getNetwork(networkId)).thenReturn(mockNetwork);
        when(mockNetwork.getId()).thenReturn(networkId);

        activity.execute(mockClient, pool, execution);
        assertThat(collector.getVariable(ProcessVariables.NETWORK_ID)).isEqualTo(networkId);
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.CloudStackClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.