forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated batch to support batch account creation with fluent pattern.
- Loading branch information
1 parent
8424341
commit 3ffdf38
Showing
29 changed files
with
1,004 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212 changes: 212 additions & 0 deletions
212
azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
|
||
package com.microsoft.azure.management.batch; | ||
|
||
import com.microsoft.azure.CloudException; | ||
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.Creatable; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Updatable; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; | ||
import com.microsoft.azure.management.resources.fluentcore.model.Appliable; | ||
import com.microsoft.azure.management.storage.StorageAccount; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* An immutable client-side representation of an Azure batch account. | ||
*/ | ||
public interface BatchAccount extends | ||
GroupableResource, | ||
Refreshable<BatchAccount>, | ||
Updatable<BatchAccount.Update>, | ||
Wrapper<AccountResourceInner> { | ||
|
||
/** | ||
* @return the provisioned state of the resource. Possible values include: | ||
* 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' | ||
*/ | ||
AccountProvisioningState provisioningState(); | ||
|
||
/** | ||
* @return Get the accountEndpoint value. | ||
*/ | ||
String accountEndpoint(); | ||
|
||
/** | ||
* @return the properties and status of any auto storage account associated with | ||
* the account | ||
*/ | ||
AutoStorageProperties autoStorage(); | ||
|
||
/** | ||
* @return the core quota for this BatchAccount account | ||
*/ | ||
int coreQuota(); | ||
|
||
/** | ||
* @return the pool quota for this BatchAccount account | ||
*/ | ||
int poolQuota(); | ||
|
||
/** | ||
* @return the active job and job schedule quota for this BatchAccount account | ||
*/ | ||
int activeJobAndJobScheduleQuota(); | ||
|
||
/** | ||
* @return the access keys for this batch account | ||
* | ||
* @throws CloudException exception thrown from REST call | ||
* @throws IOException exception thrown from serialization/deserialization | ||
*/ | ||
BatchAccountKeys keys() throws CloudException, IOException; | ||
|
||
/** | ||
* @return the access keys for this batch account | ||
* | ||
* @throws CloudException exception thrown from REST call | ||
* @throws IOException exception thrown from serialization/deserialization | ||
*/ | ||
BatchAccountKeys refreshKeys() throws CloudException, IOException; | ||
|
||
/** | ||
* Regenerates the access keys for batch account. | ||
* | ||
* @param keyType either primary or secondary key to be regenerated | ||
* @return the access keys for this batch account | ||
* | ||
* @throws CloudException exception thrown from REST call | ||
* @throws IOException exception thrown from serialization/deserialization | ||
*/ | ||
BatchAccountKeys regenerateKeys(AccountKeyType keyType) throws CloudException, IOException; | ||
|
||
/** | ||
* Synchronize the storage account keys for batch account. | ||
* | ||
* @throws CloudException exception thrown from REST call | ||
* @throws IOException exception thrown from serialization/deserialization | ||
*/ | ||
void synchronizeAutoStorageKeys() throws CloudException, IOException; | ||
|
||
/************************************************************** | ||
* Fluent interfaces to provision a BatchAccount | ||
**************************************************************/ | ||
|
||
/** | ||
* Container interface for all the definitions that need to be implemented. | ||
*/ | ||
interface Definition extends | ||
DefinitionStages.Blank, | ||
DefinitionStages.WithGroup, | ||
DefinitionStages.WithCreate { | ||
} | ||
|
||
/** | ||
* Grouping of all the storage account definition stages. | ||
*/ | ||
interface DefinitionStages { | ||
/** | ||
* The first stage of the batch account definition. | ||
*/ | ||
interface Blank extends Resource.DefinitionWithRegion<WithGroup> { | ||
} | ||
|
||
/** | ||
* A batch account definition allowing resource group to be set. | ||
*/ | ||
interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithCreate> { | ||
} | ||
|
||
/** | ||
* A batch account definition with sufficient inputs to create a new | ||
* batch account in the cloud, but exposing additional optional inputs to | ||
* specify. | ||
*/ | ||
interface WithCreate extends | ||
Creatable<BatchAccount>, | ||
Resource.DefinitionWithTags<WithCreate> { | ||
|
||
/** | ||
* Specifies that an existing storage account to be attached with the batch account. | ||
* | ||
* @param storageAccount existing storage account to be used | ||
* @return the stage representing creatable batch account definition | ||
*/ | ||
DefinitionStages.WithCreate withStorageAccount(StorageAccount storageAccount); | ||
|
||
/** | ||
* Specifies that a storage account to be attached with the batch account. | ||
* | ||
* @param storageAccountCreatable storage account to be created along with and used in batch | ||
* @return the stage representing creatable batch account definition | ||
*/ | ||
DefinitionStages.WithCreate withNewStorageAccount(Creatable<StorageAccount> storageAccountCreatable); | ||
|
||
/** | ||
* Specifies that an existing storage account to be attached with the batch account. | ||
* | ||
* @param storageAccountName name of new storage account to be created and used in batch account | ||
* @return the stage representing creatable batch account definition | ||
*/ | ||
DefinitionStages.WithCreate withNewStorageAccount(String storageAccountName); | ||
|
||
} | ||
} | ||
/** | ||
* The template for a storage account update operation, containing all the settings that can be modified. | ||
*/ | ||
interface Update extends | ||
Appliable<BatchAccount>, | ||
Resource.UpdateWithTags<Update>, | ||
UpdateStages.WithStorageAccount { | ||
} | ||
|
||
/** | ||
* Grouping of all the storage account update stages. | ||
*/ | ||
interface UpdateStages { | ||
/** | ||
* The stage of the batch account update definition allowing to specify storage account. | ||
*/ | ||
interface WithStorageAccount { | ||
/** | ||
* Specifies that an existing storage account to be attached with the batch account. | ||
* | ||
* @param storageAccount existing storage account to be used | ||
* @return the stage representing updatable batch account definition | ||
*/ | ||
Update withStorageAccount(StorageAccount storageAccount); | ||
|
||
/** | ||
* Specifies that a storage account to be attached with the batch account. | ||
* | ||
* @param storageAccountCreatable storage account to be created along with and used in batch | ||
* @return the stage representing updatable batch account definition | ||
*/ | ||
Update withNewStorageAccount(Creatable<StorageAccount> storageAccountCreatable); | ||
|
||
/** | ||
* Specifies that an existing storage account to be attached with the batch account. | ||
* | ||
* @param storageAccountName name of new storage account to be created and used in batch account | ||
* @return the stage representing updatable batch account definition | ||
*/ | ||
Update withNewStorageAccount(String storageAccountName); | ||
|
||
/** | ||
* Specifies that storage account should be removed from the batch account. | ||
* | ||
* @return the stage representing updatable batch account definition | ||
*/ | ||
Update withoutStorageAccount(); | ||
} | ||
} | ||
} | ||
|
46 changes: 46 additions & 0 deletions
46
azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccountKeys.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.microsoft.azure.management.batch; | ||
|
||
/** | ||
* Created by ans on 9/13/2016. | ||
*/ | ||
public class BatchAccountKeys { | ||
/** | ||
* The primary key associated with the account. | ||
*/ | ||
private String primary; | ||
|
||
/** | ||
* The secondary key associated with the account. | ||
*/ | ||
private String secondary; | ||
|
||
/** | ||
* Constructor for the class. | ||
* | ||
* @param primaryKey primary key value for the batch account | ||
* @param secondaryKey secondary key value for the batch account | ||
*/ | ||
public BatchAccountKeys(String primaryKey, String secondaryKey) { | ||
primary = primaryKey; | ||
secondary = secondaryKey; | ||
} | ||
|
||
/** | ||
* Get the primary value. | ||
* | ||
* @return the primary value | ||
*/ | ||
public String primary() { | ||
return this.primary; | ||
} | ||
|
||
/** | ||
* Get the secondary value. | ||
* | ||
* @return the secondary value | ||
*/ | ||
public String secondary() { | ||
return this.secondary; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/BatchAccounts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.microsoft.azure.management.batch; | ||
|
||
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; | ||
import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByGroup; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsBatchCreation; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting; | ||
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; | ||
|
||
/** | ||
* Entry point to batch account management API. | ||
*/ | ||
public interface BatchAccounts extends | ||
SupportsCreating<BatchAccount.DefinitionStages.Blank>, | ||
SupportsListing<BatchAccount>, | ||
SupportsListingByGroup<BatchAccount>, | ||
SupportsGettingByGroup<BatchAccount>, | ||
SupportsGettingById<BatchAccount>, | ||
SupportsDeleting, | ||
SupportsDeletingByGroup, | ||
SupportsBatchCreation<BatchAccount> { | ||
} |
Oops, something went wrong.