Skip to content

Commit

Permalink
Added right annotations to the Batch code. Also fixed a bug in the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
anudeepsharma committed Sep 26, 2016
1 parent 09ded68 commit 7104fe9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
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.apigeneration.Fluent;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.implementation.ApplicationInner;
import com.microsoft.azure.management.resources.fluentcore.arm.models.ExternalChildResource;
import com.microsoft.azure.management.resources.fluentcore.model.Attachable;
Expand All @@ -18,7 +18,7 @@
/**
* An immutable client-side representation of an Azure batch account application.
*/
@Fluent
@LangDefinition()
public interface Application extends
ExternalChildResource<Application, BatchAccount>,
Wrapper<ApplicationInner> {
Expand Down Expand Up @@ -52,6 +52,7 @@ public interface Application extends
*
* @param <ParentT> the return type of the final {@link Attachable#attach()}
*/
@LangDefinition(ContainerName = "~/Application.Definition", ContainerFileName = "IDefinition")
interface Definition<ParentT> extends
DefinitionStages.Blank<ParentT>,
DefinitionStages.WithAttach<ParentT> {
Expand All @@ -60,6 +61,7 @@ interface Definition<ParentT> extends
/**
* Grouping of all the storage account definition stages.
*/
@LangDefinition(ContainerName = "~/Application.Definition", ContainerFileName = "IDefinition", IsContainerOnly = true)
interface DefinitionStages {
/**
* The first stage of a batch account application definition.
Expand Down Expand Up @@ -116,6 +118,7 @@ interface WithAttach<ParentT> extends
* The entirety of a application definition as a part of parent update.
* @param <ParentT> the return type of the final {@link Attachable#attach()}
*/
@LangDefinition(ContainerName = "~/Application.UpdateDefinition", ContainerFileName = "IUpdateDefinition")
interface UpdateDefinition<ParentT> extends
UpdateDefinitionStages.Blank<ParentT>,
UpdateDefinitionStages.WithAttach<ParentT> {
Expand All @@ -124,6 +127,7 @@ interface UpdateDefinition<ParentT> extends
/**
* Grouping of application definition stages as part of parent batch account update.
*/
@LangDefinition(ContainerName = "~/Application.UpdateDefinition", ContainerFileName = "IUpdateDefinition", IsContainerOnly = true)
interface UpdateDefinitionStages {
/**
* The first stage of a application definition.
Expand Down Expand Up @@ -180,6 +184,7 @@ interface WithAttach<ParentT> extends
/**
* Grouping of application update stages.
*/
@LangDefinition(ContainerName = "~/Application.Update", ContainerFileName = "IUpdate", IsContainerOnly = true)
interface UpdateStages {

/**
Expand Down Expand Up @@ -228,6 +233,7 @@ interface WithOptionalProperties {
/**
* The entirety of application update as a part of parent batch account update.
*/
@LangDefinition(ContainerName = "~/Application.Update", ContainerFileName = "IUpdate")
interface Update extends
Settable<BatchAccount.Update>,
UpdateStages.WithOptionalProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

package com.microsoft.azure.management.batch;

import com.microsoft.azure.management.apigeneration.Fluent;
import com.microsoft.azure.management.apigeneration.Method;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.implementation.BatchAccountInner;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
Expand All @@ -23,7 +22,7 @@
/**
* An immutable client-side representation of an Azure batch account.
*/
@Fluent
@LangDefinition()
public interface BatchAccount extends
GroupableResource,
Refreshable<BatchAccount>,
Expand Down Expand Up @@ -70,7 +69,6 @@ public interface BatchAccount extends
/**
* @return the access keys for this batch account
*/
@Method
BatchAccountKeys refreshKeys();

/**
Expand All @@ -79,13 +77,11 @@ public interface BatchAccount extends
* @param keyType either primary or secondary key to be regenerated
* @return the access keys for this batch account
*/
@Method
BatchAccountKeys regenerateKeys(AccountKeyType keyType);

/**
* Synchronize the storage account keys for batch account.
*/
@Method
void synchronizeAutoStorageKeys();

/**
Expand All @@ -100,6 +96,7 @@ public interface BatchAccount extends
/**
* Container interface for all the definitions that need to be implemented.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Definition", ContainerFileName = "IDefinition")
interface Definition extends
DefinitionStages.Blank,
DefinitionStages.WithGroup,
Expand All @@ -113,6 +110,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 @@ -195,6 +193,7 @@ interface WithCreate extends
/**
* The template for a storage account update operation, containing all the settings that can be modified.
*/
@LangDefinition(ContainerName = "~/BatchAccount.Update", ContainerFileName = "IUpdate")
interface Update extends
Appliable<BatchAccount>,
Resource.UpdateWithTags<Update>,
Expand All @@ -205,6 +204,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
Expand Up @@ -10,7 +10,6 @@
import com.microsoft.azure.management.batch.Application;
import com.microsoft.azure.management.batch.ApplicationPackage;
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl;
import rx.Observable;
import rx.functions.Func1;
Expand Down Expand Up @@ -106,13 +105,12 @@ public Application call(List<ApplicationPackageImpl> applications) {
public Observable<Application> updateAsync() {
final ApplicationImpl self = this;

String applicationId = ResourceUtils.nameFromResourceId(this.inner().id());
UpdateApplicationParametersInner updateParameter = new UpdateApplicationParametersInner();
updateParameter.withDisplayName(this.inner().displayName());
updateParameter.withAllowUpdates(this.inner().allowUpdates());

return this.client.updateAsync(this.parent().resourceGroupName(),
this.parent().name(), applicationId, updateParameter)
this.parent().name(), this.name(), updateParameter)
.map(new Func1<Void, Application>() {
@Override
public Application call(Void result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.microsoft.azure.management.batch.implementation;

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.Application;
import com.microsoft.azure.management.batch.ApplicationPackage;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesImpl;
Expand All @@ -17,8 +18,9 @@
import java.util.Collections;

/**
* Represents a applicationPackage collection associated with a virtual machine.
* Represents a applicationPackage collection associated with an application.
*/
@LangDefinition
class ApplicationPackagesImpl extends
ExternalChildResourcesImpl<ApplicationPackageImpl,
ApplicationPackage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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.Application;
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesImpl;
Expand All @@ -18,8 +19,9 @@
import java.util.Map;

/**
* Represents a application collection associated with a virtual machine.
* Represents a application collection associated with a batch account.
*/
@LangDefinition
class ApplicationsImpl extends
ExternalChildResourcesImpl<ApplicationImpl,
Application,
Expand Down

0 comments on commit 7104fe9

Please sign in to comment.