Skip to content

Commit

Permalink
Merged from master
Browse files Browse the repository at this point in the history
  • Loading branch information
anudeepsharma committed Sep 20, 2016
2 parents 89807ae + c7756b1 commit 8143107
Show file tree
Hide file tree
Showing 64 changed files with 1,218 additions and 1,096 deletions.
2 changes: 1 addition & 1 deletion azure-mgmt-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<br />*/</code>]]></bottom>
</configuration>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package com.microsoft.azure.management.batch;

import com.microsoft.azure.management.batch.implementation.BatchAccountInner;
import com.microsoft.azure.management.batch.implementation.AccountResourceInner;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
import com.microsoft.azure.management.resources.fluentcore.model.Appliable;
Expand All @@ -19,6 +19,7 @@
/**
* An immutable client-side representation of an Azure batch account.
*/
@LangDefinition(ContainerName = "~/")
public interface BatchAccount extends
GroupableResource,
Refreshable<BatchAccount>,
Expand Down Expand Up @@ -60,11 +61,13 @@ public interface BatchAccount extends
/**
* @return the access keys for this batch account
*/
@LangMethodDefinition(AsType = LangMethodType.Method)
BatchAccountKeys keys();

/**
* @return the access keys for this batch account
*/
@LangMethodDefinition(AsType = LangMethodType.Method)
BatchAccountKeys refreshKeys();

/**
Expand All @@ -73,6 +76,7 @@ public interface BatchAccount extends
* @param keyType either primary or secondary key to be regenerated
* @return the access keys for this batch account
*/
@LangMethodDefinition(AsType = LangMethodType.Method)
BatchAccountKeys regenerateKeys(AccountKeyType keyType);

/**
Expand All @@ -87,6 +91,7 @@ public interface BatchAccount extends
/**
* Container interface for all the definitions that need to be implemented.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Definition")
interface Definition extends
DefinitionStages.Blank,
DefinitionStages.WithGroup,
Expand All @@ -96,6 +101,7 @@ interface Definition extends
/**
* Grouping of all the storage account definition stages.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Definition", ContainerFileName = "IDefinition", IsContainerOnly = true)
interface DefinitionStages {
/**
* The first stage of the batch account definition.
Expand Down Expand Up @@ -147,6 +153,7 @@ interface WithCreate extends
/**
* The template for a storage account update operation, containing all the settings that can be modified.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Update")
interface Update extends
Appliable<BatchAccount>,
Resource.UpdateWithTags<Update>,
Expand All @@ -156,6 +163,7 @@ interface Update extends
/**
* Grouping of all the storage account update stages.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Update", ContainerFileName = "IUpdate", IsContainerOnly = true)
interface UpdateStages {
/**
* The stage of the batch account update definition allowing to specify storage account.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.microsoft.azure.management.batch;

import com.microsoft.azure.management.apigeneration.LangDefinition;

/**
* Created by ans on 9/13/2016.
* This class represents the access keys for the batch account.
*/
@LangDefinition
public class BatchAccountKeys {
/**
* The primary key associated with the account.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.microsoft.azure.management.batch;

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById;
Expand All @@ -12,6 +13,7 @@
/**
* Entry point to batch account management API.
*/
@LangDefinition(ContainerName = "~/")
public interface BatchAccounts extends
SupportsCreating<BatchAccount.DefinitionStages.Blank>,
SupportsListing<BatchAccount>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/**
* Implementation for BatchAccount and its parent interfaces.
*/
@LangDefinition
public class BatchAccountImpl
extends
GroupableResourceImpl<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.microsoft.azure.management.batch.implementation;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.batch.BatchAccounts;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
Expand All @@ -10,6 +11,7 @@
/**
* Implementation for BatchAccounts and its parent interfaces.
*/
@LangDefinition
public class BatchAccountsImpl
extends GroupableResourcesImpl<BatchAccount, BatchAccountImpl, BatchAccountInner, BatchAccountsInner, BatchManager>
implements BatchAccounts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.microsoft.rest.credentials.ServiceClientCredentials;

/**
* Entry point to Azure batch account resource management.
* Entry point to Azure Batch Account resource management.
*/
public class BatchManager extends Manager<BatchManager, BatchManagementClientImpl> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@LangDefinition(ContainerName = "~/")
public interface VirtualMachineDataDisk extends
Wrapper<DataDisk>,
ChildResource {
ChildResource<VirtualMachine> {

// getters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
@LangDefinition
class DataDiskImpl
extends ChildResourceImpl<DataDisk, VirtualMachineImpl>
extends ChildResourceImpl<DataDisk, VirtualMachineImpl, VirtualMachine>
implements
VirtualMachineDataDisk,
VirtualMachineDataDisk.Definition<VirtualMachine.DefinitionStages.WithCreate>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.microsoft.azure.RequestIdHeaderInterceptor;
import com.microsoft.azure.RestClient;
import com.microsoft.azure.credentials.AzureTokenCredentials;
import com.microsoft.azure.management.graphrbac.ServicePrincipals;
import com.microsoft.azure.management.graphrbac.Users;
import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable;
Expand All @@ -18,6 +19,7 @@
* Entry point to Azure resource management.
*/
public final class GraphRbacManager {
private String tenantId;
// The sdk clients
private final GraphRbacManagementClientImpl graphRbacManagementClient;
// The collections
Expand All @@ -39,6 +41,20 @@ public static GraphRbacManager authenticate(ServiceClientCredentials credentials
.build(), tenantId);
}

/**
* Creates an instance of GraphRbacManager that exposes resource management API entry points.
*
* @param credentials the credentials to use
* @return the GraphRbacManager instance
*/
public static GraphRbacManager authenticate(AzureTokenCredentials credentials) {
return new GraphRbacManager(new RestClient.Builder()
.withBaseUrl("https://graph.windows.net")
.withInterceptor(new RequestIdHeaderInterceptor())
.withCredentials(credentials)
.build(), credentials.getDomain());
}

/**
* Creates an instance of GraphRbacManager that exposes resource management API entry points.
*
Expand Down Expand Up @@ -71,6 +87,14 @@ public interface Configurable extends AzureConfigurable<Configurable> {
* @return the interface exposing resource management API entry points that work across subscriptions
*/
GraphRbacManager authenticate(ServiceClientCredentials credentials, String tenantId);

/**
* Creates an instance of GraphRbacManager that exposes resource management API entry points.
*
* @param credentials the credentials to use
* @return the interface exposing resource management API entry points that work across subscriptions
*/
GraphRbacManager authenticate(AzureTokenCredentials credentials);
}

/**
Expand All @@ -86,10 +110,22 @@ protected ConfigurableImpl() {
public GraphRbacManager authenticate(ServiceClientCredentials credentials, String tenantId) {
return GraphRbacManager.authenticate(buildRestClient(credentials), tenantId);
}

public GraphRbacManager authenticate(AzureTokenCredentials credentials) {
return GraphRbacManager.authenticate(buildRestClient(credentials), credentials.getDomain());
}
}

private GraphRbacManager(RestClient restClient, String tenantId) {
this.graphRbacManagementClient = new GraphRbacManagementClientImpl(restClient).withTenantID(tenantId);
this.tenantId = tenantId;
}

/**
* @return the tenant ID the graph client is associated with
*/
public String tenantId() {
return tenantId;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ public ServicePrincipalImpl withAccountEnabled(boolean enabled) {

@Override
public ServicePrincipal refresh() {
return null;
setInner(client.list(String.format("servicePrincipalNames/any(c:c eq '%s')", name())).get(0));
return this;
}

@Override
public Observable<ServicePrincipal> createResourceAsync() {
return null;
throw new UnsupportedOperationException("not implemented yet");
}

@Override
public Observable<ServicePrincipal> applyAsync() {
return null;
throw new UnsupportedOperationException("not implemented yet");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,17 @@ public UserImpl withPassword(String password, boolean forceChangePasswordNextLog

@Override
public User refresh() {
return null;
setInner(client.get(name()));
return this;
}

@Override
public Observable<User> createResourceAsync() {
return null;
throw new UnsupportedOperationException("not implemented yet");
}

@Override
public Observable<User> applyAsync() {
return null;
throw new UnsupportedOperationException("not implemented yet");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,17 @@ public abstract class GraphRbacManagementTestBase {
protected static GraphRbacManager graphRbacManager;

protected static void createClients() {
// ApplicationTokenCredentials credentials = new ApplicationTokenCredentials(
// System.getenv("client-id"),
// System.getenv("domain"),
// System.getenv("secret"),
// "https://graph.windows.net",
// null);
UserTokenCredentials credentials = new UserTokenCredentials(
"1950a258-227b-4e31-a9cf-717495945fc2",
System.getenv("client-id"),
System.getenv("domain"),
System.getenv("username"),
System.getenv("password"),
"https://graph.windows.net",
"https://graph.windows.net",
AzureEnvironment.AZURE
);

graphRbacManager = GraphRbacManager
.configure()
.withLogLevel(HttpLoggingInterceptor.Level.BODY)
.authenticate(credentials, "myorganization");
.authenticate(credentials);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ public void canCRUDUser() throws Exception {
//LIST
List<User> userList = graphRbacManager.users().list();
Assert.assertNotNull(userList);
User user = graphRbacManager.users().define("jeffrolfnlu@hotmail.com")
User user = graphRbacManager.users().define("newuser")
.withDisplayName("Test User 309")
.withPassword("Pa$$w0rd")
.withMailNickname("")
.withMailNickname(null)
.create();
Assert.assertNotNull(user);
Assert.assertEquals("Test User 309", user.displayName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* An immutable client-side representation of a key vault access policy.
*/
public interface AccessPolicy extends
ChildResource,
ChildResource<Vault>,
Wrapper<AccessPolicyEntry> {
/**
* @return The Azure Active Directory tenant ID that should be used for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
class AccessPolicyImpl
extends ChildResourceImpl<
AccessPolicyEntry,
VaultImpl>
VaultImpl,
Vault>
implements
AccessPolicy,
AccessPolicy.Definition<Vault.DefinitionStages.WithCreate>,
Expand Down
Loading

0 comments on commit 8143107

Please sign in to comment.