diff --git a/sdk/batch/mgmt-v2017_01_01/pom.xml b/sdk/batch/mgmt-v2017_01_01/pom.xml new file mode 100644 index 0000000000000..8d193378be1c0 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.batch.v2017_01_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-batch + 1.0.0-beta + jar + Microsoft Azure SDK for Batch Management + This package contains Microsoft Batch Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AccountKeyType.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AccountKeyType.java new file mode 100644 index 0000000000000..34293f98d4af3 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AccountKeyType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccountKeyType. + */ +public enum AccountKeyType { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"); + + /** The actual serialized value for a AccountKeyType instance. */ + private String value; + + AccountKeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccountKeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed AccountKeyType object, or null if unable to parse. + */ + @JsonCreator + public static AccountKeyType fromString(String value) { + AccountKeyType[] items = AccountKeyType.values(); + for (AccountKeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ActivateApplicationPackageParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ActivateApplicationPackageParameters.java new file mode 100644 index 0000000000000..b350dda179fd4 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ActivateApplicationPackageParameters.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for an ApplicationOperations.ActivateApplicationPackage request. + */ +public class ActivateApplicationPackageParameters { + /** + * The format of the application package binary file. + */ + @JsonProperty(value = "format", required = true) + private String format; + + /** + * Get the format of the application package binary file. + * + * @return the format value + */ + public String format() { + return this.format; + } + + /** + * Set the format of the application package binary file. + * + * @param format the format value to set + * @return the ActivateApplicationPackageParameters object itself. + */ + public ActivateApplicationPackageParameters withFormat(String format) { + this.format = format; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AddApplicationParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AddApplicationParameters.java new file mode 100644 index 0000000000000..f1b2f1576fa1a --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AddApplicationParameters.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for an ApplicationOperations.AddApplication request. + */ +public class AddApplicationParameters { + /** + * A value indicating whether packages within the application may be + * overwritten using the same version string. + */ + @JsonProperty(value = "allowUpdates") + private Boolean allowUpdates; + + /** + * The display name for the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get a value indicating whether packages within the application may be overwritten using the same version string. + * + * @return the allowUpdates value + */ + public Boolean allowUpdates() { + return this.allowUpdates; + } + + /** + * Set a value indicating whether packages within the application may be overwritten using the same version string. + * + * @param allowUpdates the allowUpdates value to set + * @return the AddApplicationParameters object itself. + */ + public AddApplicationParameters withAllowUpdates(Boolean allowUpdates) { + this.allowUpdates = allowUpdates; + return this; + } + + /** + * Get the display name for the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name for the application. + * + * @param displayName the displayName value to set + * @return the AddApplicationParameters object itself. + */ + public AddApplicationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Application.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Application.java new file mode 100644 index 0000000000000..d9432e0374052 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Application.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.ApplicationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchManager; +import java.util.List; + +/** + * Type representing Application. + */ +public interface Application extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the allowUpdates value. + */ + Boolean allowUpdates(); + + /** + * @return the defaultVersion value. + */ + String defaultVersion(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the packages value. + */ + List packages(); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackage.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackage.java new file mode 100644 index 0000000000000..b831b176ae3d6 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackage.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.ApplicationPackageInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchManager; +import org.joda.time.DateTime; + +/** + * Type representing ApplicationPackage. + */ +public interface ApplicationPackage extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the format value. + */ + String format(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastActivationTime value. + */ + DateTime lastActivationTime(); + + /** + * @return the state value. + */ + PackageState state(); + + /** + * @return the storageUrl value. + */ + String storageUrl(); + + /** + * @return the storageUrlExpiry value. + */ + DateTime storageUrlExpiry(); + + /** + * @return the version value. + */ + String version(); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackages.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackages.java new file mode 100644 index 0000000000000..e95bad85741dc --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ApplicationPackages.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.ApplicationPackagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ApplicationPackages. + */ +public interface ApplicationPackages extends HasInner { + /** + * Activates the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to activate. + * @param format The format of the application package binary file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format); + + /** + * Creates an application package record. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String accountName, String applicationId, String version); + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String applicationId, String version); + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String applicationId, String version); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Applications.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Applications.java new file mode 100644 index 0000000000000..d3eea680067af --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Applications.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.ApplicationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Applications. + */ +public interface Applications extends HasInner { + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String accountName, String applicationId); + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable updateAsync(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters); + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String applicationId); + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String accountName); + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String applicationId); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageBaseProperties.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageBaseProperties.java new file mode 100644 index 0000000000000..96c2ce3c344c8 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageBaseProperties.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties related to auto storage account. + */ +public class AutoStorageBaseProperties { + /** + * The resource ID of the storage account to be used for auto storage + * account. + */ + @JsonProperty(value = "storageAccountId", required = true) + private String storageAccountId; + + /** + * Get the resource ID of the storage account to be used for auto storage account. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource ID of the storage account to be used for auto storage account. + * + * @param storageAccountId the storageAccountId value to set + * @return the AutoStorageBaseProperties object itself. + */ + public AutoStorageBaseProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageProperties.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageProperties.java new file mode 100644 index 0000000000000..21c2052176dc5 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/AutoStorageProperties.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about the auto storage account associated with a Batch + * account. + */ +public class AutoStorageProperties { + /** + * The resource ID of the storage account to be used for auto storage + * account. + */ + @JsonProperty(value = "storageAccountId", required = true) + private String storageAccountId; + + /** + * The UTC time at which storage keys were last synchronized with the Batch + * account. + */ + @JsonProperty(value = "lastKeySync", required = true) + private DateTime lastKeySync; + + /** + * Get the resource ID of the storage account to be used for auto storage account. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource ID of the storage account to be used for auto storage account. + * + * @param storageAccountId the storageAccountId value to set + * @return the AutoStorageProperties object itself. + */ + public AutoStorageProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the UTC time at which storage keys were last synchronized with the Batch account. + * + * @return the lastKeySync value + */ + public DateTime lastKeySync() { + return this.lastKeySync; + } + + /** + * Set the UTC time at which storage keys were last synchronized with the Batch account. + * + * @param lastKeySync the lastKeySync value to set + * @return the AutoStorageProperties object itself. + */ + public AutoStorageProperties withLastKeySync(DateTime lastKeySync) { + this.lastKeySync = lastKeySync; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccount.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccount.java new file mode 100644 index 0000000000000..8b64080a9da34 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccount.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchAccountInner; + +/** + * Type representing BatchAccount. + */ +public interface BatchAccount extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the accountEndpoint value. + */ + String accountEndpoint(); + + /** + * @return the activeJobAndJobScheduleQuota value. + */ + int activeJobAndJobScheduleQuota(); + + /** + * @return the autoStorage value. + */ + AutoStorageProperties autoStorage(); + + /** + * @return the coreQuota value. + */ + int coreQuota(); + + /** + * @return the keyVaultReference value. + */ + KeyVaultReference keyVaultReference(); + + /** + * @return the poolAllocationMode value. + */ + PoolAllocationMode poolAllocationMode(); + + /** + * @return the poolQuota value. + */ + int poolQuota(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * The entirety of the BatchAccount definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of BatchAccount definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BatchAccount definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the BatchAccount definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the batchaccount definition allowing to specify AutoStorage. + */ + interface WithAutoStorage { + /** + * Specifies autoStorage. + * @param autoStorage The properties related to auto storage account + * @return the next definition stage + */ + WithCreate withAutoStorage(AutoStorageBaseProperties autoStorage); + } + + /** + * The stage of the batchaccount definition allowing to specify KeyVaultReference. + */ + interface WithKeyVaultReference { + /** + * Specifies keyVaultReference. + * @param keyVaultReference A reference to the Azure key vault associated with the Batch account + * @return the next definition stage + */ + WithCreate withKeyVaultReference(KeyVaultReference keyVaultReference); + } + + /** + * The stage of the batchaccount definition allowing to specify PoolAllocationMode. + */ + interface WithPoolAllocationMode { + /** + * Specifies poolAllocationMode. + * @param poolAllocationMode The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription' + * @return the next definition stage + */ + WithCreate withPoolAllocationMode(PoolAllocationMode poolAllocationMode); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutoStorage, DefinitionStages.WithKeyVaultReference, DefinitionStages.WithPoolAllocationMode { + } + } + /** + * The template for a BatchAccount update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAutoStorage { + } + + /** + * Grouping of BatchAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the batchaccount update allowing to specify AutoStorage. + */ + interface WithAutoStorage { + /** + * Specifies autoStorage. + * @param autoStorage The properties related to auto storage account + * @return the next update stage + */ + Update withAutoStorage(AutoStorageBaseProperties autoStorage); + } + + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateHeaders.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateHeaders.java new file mode 100644 index 0000000000000..3869e1ba0e9ce --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateHeaders.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Create operation. + */ +public class BatchAccountCreateHeaders { + /** + * The URL of the resource used to check the status of the asynchronous + * operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Suggested delay to check the status of the asynchronous operation. The + * value is an integer that represents the seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the URL of the resource used to check the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL of the resource used to check the status of the asynchronous operation. + * + * @param location the location value to set + * @return the BatchAccountCreateHeaders object itself. + */ + public BatchAccountCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BatchAccountCreateHeaders object itself. + */ + public BatchAccountCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateParameters.java new file mode 100644 index 0000000000000..37d7c46067f40 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountCreateParameters.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Create operation. + */ +@JsonFlatten +public class BatchAccountCreateParameters { + /** + * The region in which to create the account. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The user specified tags associated with the account. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The properties related to auto storage account. + */ + @JsonProperty(value = "properties.autoStorage") + private AutoStorageBaseProperties autoStorage; + + /** + * The allocation mode to use for creating pools in the Batch account. + * The pool allocation mode also affects how clients may authenticate to + * the Batch Service API. If the mode is BatchService, clients may + * authenticate using access keys or Azure Active Directory. If the mode is + * UserSubscription, clients must use Azure Active Directory. The default + * is BatchService. Possible values include: 'BatchService', + * 'UserSubscription'. + */ + @JsonProperty(value = "properties.poolAllocationMode") + private PoolAllocationMode poolAllocationMode; + + /** + * A reference to the Azure key vault associated with the Batch account. + */ + @JsonProperty(value = "properties.keyVaultReference") + private KeyVaultReference keyVaultReference; + + /** + * Get the region in which to create the account. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the region in which to create the account. + * + * @param location the location value to set + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the user specified tags associated with the account. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the user specified tags associated with the account. + * + * @param tags the tags value to set + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties related to auto storage account. + * + * @return the autoStorage value + */ + public AutoStorageBaseProperties autoStorage() { + return this.autoStorage; + } + + /** + * Set the properties related to auto storage account. + * + * @param autoStorage the autoStorage value to set + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withAutoStorage(AutoStorageBaseProperties autoStorage) { + this.autoStorage = autoStorage; + return this; + } + + /** + * Get the pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription'. + * + * @return the poolAllocationMode value + */ + public PoolAllocationMode poolAllocationMode() { + return this.poolAllocationMode; + } + + /** + * Set the pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription'. + * + * @param poolAllocationMode the poolAllocationMode value to set + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withPoolAllocationMode(PoolAllocationMode poolAllocationMode) { + this.poolAllocationMode = poolAllocationMode; + return this; + } + + /** + * Get a reference to the Azure key vault associated with the Batch account. + * + * @return the keyVaultReference value + */ + public KeyVaultReference keyVaultReference() { + return this.keyVaultReference; + } + + /** + * Set a reference to the Azure key vault associated with the Batch account. + * + * @param keyVaultReference the keyVaultReference value to set + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withKeyVaultReference(KeyVaultReference keyVaultReference) { + this.keyVaultReference = keyVaultReference; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountDeleteHeaders.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountDeleteHeaders.java new file mode 100644 index 0000000000000..b4ff46ff20176 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountDeleteHeaders.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Delete operation. + */ +public class BatchAccountDeleteHeaders { + /** + * The URL of the resource used to check the status of the asynchronous + * operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Suggested delay to check the status of the asynchronous operation. The + * value is an integer that represents the seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get the URL of the resource used to check the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL of the resource used to check the status of the asynchronous operation. + * + * @param location the location value to set + * @return the BatchAccountDeleteHeaders object itself. + */ + public BatchAccountDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BatchAccountDeleteHeaders object itself. + */ + public BatchAccountDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountKeys.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountKeys.java new file mode 100644 index 0000000000000..55b8f616550f9 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountKeys.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchAccountKeysInner; + +/** + * Type representing BatchAccountKeys. + */ +public interface BatchAccountKeys extends HasInner, HasManager { + /** + * @return the primary value. + */ + String primary(); + + /** + * @return the secondary value. + */ + String secondary(); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountRegenerateKeyParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..0d4881a837ab6 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountRegenerateKeyParameters.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters supplied to the RegenerateKey operation. + */ +public class BatchAccountRegenerateKeyParameters { + /** + * The type of account key to regenerate. Possible values include: + * 'Primary', 'Secondary'. + */ + @JsonProperty(value = "keyName", required = true) + private AccountKeyType keyName; + + /** + * Get the type of account key to regenerate. Possible values include: 'Primary', 'Secondary'. + * + * @return the keyName value + */ + public AccountKeyType keyName() { + return this.keyName; + } + + /** + * Set the type of account key to regenerate. Possible values include: 'Primary', 'Secondary'. + * + * @param keyName the keyName value to set + * @return the BatchAccountRegenerateKeyParameters object itself. + */ + public BatchAccountRegenerateKeyParameters withKeyName(AccountKeyType keyName) { + this.keyName = keyName; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountUpdateParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountUpdateParameters.java new file mode 100644 index 0000000000000..61c4d8a3e6288 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccountUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters supplied to the Update operation. + */ +@JsonFlatten +public class BatchAccountUpdateParameters { + /** + * The user specified tags associated with the account. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The properties related to auto storage account. + */ + @JsonProperty(value = "properties.autoStorage") + private AutoStorageBaseProperties autoStorage; + + /** + * Get the user specified tags associated with the account. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the user specified tags associated with the account. + * + * @param tags the tags value to set + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties related to auto storage account. + * + * @return the autoStorage value + */ + public AutoStorageBaseProperties autoStorage() { + return this.autoStorage; + } + + /** + * Set the properties related to auto storage account. + * + * @param autoStorage the autoStorage value to set + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withAutoStorage(AutoStorageBaseProperties autoStorage) { + this.autoStorage = autoStorage; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccounts.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccounts.java new file mode 100644 index 0000000000000..1c12693de170f --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchAccounts.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BatchAccounts. + */ +public interface BatchAccounts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Synchronizes access keys for the auto storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable synchronizeAutoStorageKeysAsync(String resourceGroupName, String accountName); + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeyAsync(String resourceGroupName, String accountName, AccountKeyType keyName); + + /** + * Gets the account keys for the specified Batch account. + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getKeysAsync(String resourceGroupName, String accountName); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchLocationQuota.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchLocationQuota.java new file mode 100644 index 0000000000000..091e404dd6411 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/BatchLocationQuota.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchManager; +import com.microsoft.azure.management.batch.v2017_01_01.implementation.BatchLocationQuotaInner; + +/** + * Type representing BatchLocationQuota. + */ +public interface BatchLocationQuota extends HasInner, HasManager { + /** + * @return the accountQuota value. + */ + Integer accountQuota(); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/KeyVaultReference.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/KeyVaultReference.java new file mode 100644 index 0000000000000..94606a0474f3f --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/KeyVaultReference.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identifies the Azure key vault associated with a Batch account. + */ +public class KeyVaultReference { + /** + * The resource ID of the Azure key vault associated with the Batch + * account. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The Url of the Azure key vault associated with the Batch account. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get the resource ID of the Azure key vault associated with the Batch account. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the resource ID of the Azure key vault associated with the Batch account. + * + * @param id the id value to set + * @return the KeyVaultReference object itself. + */ + public KeyVaultReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the Url of the Azure key vault associated with the Batch account. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the Url of the Azure key vault associated with the Batch account. + * + * @param url the url value to set + * @return the KeyVaultReference object itself. + */ + public KeyVaultReference withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Locations.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Locations.java new file mode 100644 index 0000000000000..7f9ddc8478648 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/Locations.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import rx.Observable; + +/** + * Type representing Locations. + */ +public interface Locations { + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The desired region for the quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getQuotasAsync(String locationName); + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PackageState.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PackageState.java new file mode 100644 index 0000000000000..ed47c800e20ca --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PackageState.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PackageState. + */ +public enum PackageState { + /** Enum value pending. */ + PENDING("pending"), + + /** Enum value active. */ + ACTIVE("active"), + + /** Enum value unmapped. */ + UNMAPPED("unmapped"); + + /** The actual serialized value for a PackageState instance. */ + private String value; + + PackageState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PackageState instance. + * + * @param value the serialized value to parse. + * @return the parsed PackageState object, or null if unable to parse. + */ + @JsonCreator + public static PackageState fromString(String value) { + PackageState[] items = PackageState.values(); + for (PackageState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PoolAllocationMode.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PoolAllocationMode.java new file mode 100644 index 0000000000000..d3d558b4605a6 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/PoolAllocationMode.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PoolAllocationMode. + */ +public enum PoolAllocationMode { + /** Enum value BatchService. */ + BATCH_SERVICE("BatchService"), + + /** Enum value UserSubscription. */ + USER_SUBSCRIPTION("UserSubscription"); + + /** The actual serialized value for a PoolAllocationMode instance. */ + private String value; + + PoolAllocationMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolAllocationMode instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolAllocationMode object, or null if unable to parse. + */ + @JsonCreator + public static PoolAllocationMode fromString(String value) { + PoolAllocationMode[] items = PoolAllocationMode.values(); + for (PoolAllocationMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ProvisioningState.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ProvisioningState.java new file mode 100644 index 0000000000000..84d4d022e5ab7 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/ProvisioningState.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningState. + */ +public enum ProvisioningState { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"); + + /** The actual serialized value for a ProvisioningState instance. */ + private String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/UpdateApplicationParameters.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/UpdateApplicationParameters.java new file mode 100644 index 0000000000000..75ab42eb0dae1 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/UpdateApplicationParameters.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for an ApplicationOperations.UpdateApplication request. + */ +public class UpdateApplicationParameters { + /** + * A value indicating whether packages within the application may be + * overwritten using the same version string. + */ + @JsonProperty(value = "allowUpdates") + private Boolean allowUpdates; + + /** + * The package to use if a client requests the application but does not + * specify a version. + */ + @JsonProperty(value = "defaultVersion") + private String defaultVersion; + + /** + * The display name for the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get a value indicating whether packages within the application may be overwritten using the same version string. + * + * @return the allowUpdates value + */ + public Boolean allowUpdates() { + return this.allowUpdates; + } + + /** + * Set a value indicating whether packages within the application may be overwritten using the same version string. + * + * @param allowUpdates the allowUpdates value to set + * @return the UpdateApplicationParameters object itself. + */ + public UpdateApplicationParameters withAllowUpdates(Boolean allowUpdates) { + this.allowUpdates = allowUpdates; + return this; + } + + /** + * Get the package to use if a client requests the application but does not specify a version. + * + * @return the defaultVersion value + */ + public String defaultVersion() { + return this.defaultVersion; + } + + /** + * Set the package to use if a client requests the application but does not specify a version. + * + * @param defaultVersion the defaultVersion value to set + * @return the UpdateApplicationParameters object itself. + */ + public UpdateApplicationParameters withDefaultVersion(String defaultVersion) { + this.defaultVersion = defaultVersion; + return this; + } + + /** + * Get the display name for the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name for the application. + * + * @param displayName the displayName value to set + * @return the UpdateApplicationParameters object itself. + */ + public UpdateApplicationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationImpl.java new file mode 100644 index 0000000000000..8a634b095b837 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationImpl.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.Application; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.ArrayList; +import com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackage; +import java.util.List; + +class ApplicationImpl extends IndexableRefreshableWrapperImpl implements Application { + private final BatchManager manager; + private String resourceGroupName; + private String accountName; + private String applicationId; + + ApplicationImpl(ApplicationInner inner, BatchManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "batchAccounts"); + this.applicationId = IdParsingUtils.getValueFromIdByName(inner.id(), "applications"); + } + + @Override + public BatchManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ApplicationsInner client = this.manager().inner().applications(); + return client.getAsync(this.resourceGroupName, this.accountName, this.applicationId); + } + + + + @Override + public Boolean allowUpdates() { + return this.inner().allowUpdates(); + } + + @Override + public String defaultVersion() { + return this.inner().defaultVersion(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List packages() { + List lst = new ArrayList(); + if (this.inner().packages() != null) { + for (ApplicationPackageInner inner : this.inner().packages()) { + lst.add( new ApplicationPackageImpl(inner, manager())); + } + } + return lst; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationInner.java new file mode 100644 index 0000000000000..97d58e1f39b05 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationInner.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about an application in a Batch account. + */ +public class ApplicationInner { + /** + * A string that uniquely identifies the application within the account. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The display name for the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The list of packages under this application. + */ + @JsonProperty(value = "packages") + private List packages; + + /** + * A value indicating whether packages within the application may be + * overwritten using the same version string. + */ + @JsonProperty(value = "allowUpdates") + private Boolean allowUpdates; + + /** + * The package to use if a client requests the application but does not + * specify a version. + */ + @JsonProperty(value = "defaultVersion") + private String defaultVersion; + + /** + * Get a string that uniquely identifies the application within the account. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set a string that uniquely identifies the application within the account. + * + * @param id the id value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the display name for the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name for the application. + * + * @param displayName the displayName value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the list of packages under this application. + * + * @return the packages value + */ + public List packages() { + return this.packages; + } + + /** + * Set the list of packages under this application. + * + * @param packages the packages value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withPackages(List packages) { + this.packages = packages; + return this; + } + + /** + * Get a value indicating whether packages within the application may be overwritten using the same version string. + * + * @return the allowUpdates value + */ + public Boolean allowUpdates() { + return this.allowUpdates; + } + + /** + * Set a value indicating whether packages within the application may be overwritten using the same version string. + * + * @param allowUpdates the allowUpdates value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAllowUpdates(Boolean allowUpdates) { + this.allowUpdates = allowUpdates; + return this; + } + + /** + * Get the package to use if a client requests the application but does not specify a version. + * + * @return the defaultVersion value + */ + public String defaultVersion() { + return this.defaultVersion; + } + + /** + * Set the package to use if a client requests the application but does not specify a version. + * + * @param defaultVersion the defaultVersion value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDefaultVersion(String defaultVersion) { + this.defaultVersion = defaultVersion; + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageImpl.java new file mode 100644 index 0000000000000..4ba66fd87670e --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageImpl.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackage; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.batch.v2017_01_01.PackageState; + +class ApplicationPackageImpl extends IndexableRefreshableWrapperImpl implements ApplicationPackage { + private final BatchManager manager; + private String resourceGroupName; + private String accountName; + private String applicationId; + private String version; + + ApplicationPackageImpl(ApplicationPackageInner inner, BatchManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "batchAccounts"); + this.applicationId = IdParsingUtils.getValueFromIdByName(inner.id(), "applications"); + this.version = IdParsingUtils.getValueFromIdByName(inner.id(), "versions"); + } + + @Override + public BatchManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ApplicationPackagesInner client = this.manager().inner().applicationPackages(); + return client.getAsync(this.resourceGroupName, this.accountName, this.applicationId, this.version); + } + + + + @Override + public String format() { + return this.inner().format(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastActivationTime() { + return this.inner().lastActivationTime(); + } + + @Override + public PackageState state() { + return this.inner().state(); + } + + @Override + public String storageUrl() { + return this.inner().storageUrl(); + } + + @Override + public DateTime storageUrlExpiry() { + return this.inner().storageUrlExpiry(); + } + + @Override + public String version() { + return this.inner().version(); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageInner.java new file mode 100644 index 0000000000000..90356653cf555 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackageInner.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.PackageState; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An application package which represents a particular version of an + * application. + */ +public class ApplicationPackageInner { + /** + * The ID of the application. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The version of the application package. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * The current state of the application package. Possible values include: + * 'pending', 'active', 'unmapped'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private PackageState state; + + /** + * The format of the application package, if the package is active. + */ + @JsonProperty(value = "format", access = JsonProperty.Access.WRITE_ONLY) + private String format; + + /** + * The storage URL at which the application package is stored. + */ + @JsonProperty(value = "storageUrl", access = JsonProperty.Access.WRITE_ONLY) + private String storageUrl; + + /** + * The UTC time at which the storage URL will expire. + */ + @JsonProperty(value = "storageUrlExpiry", access = JsonProperty.Access.WRITE_ONLY) + private DateTime storageUrlExpiry; + + /** + * The time at which the package was last activated, if the package is + * active. + */ + @JsonProperty(value = "lastActivationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastActivationTime; + + /** + * Get the ID of the application. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the version of the application package. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the current state of the application package. Possible values include: 'pending', 'active', 'unmapped'. + * + * @return the state value + */ + public PackageState state() { + return this.state; + } + + /** + * Get the format of the application package, if the package is active. + * + * @return the format value + */ + public String format() { + return this.format; + } + + /** + * Get the storage URL at which the application package is stored. + * + * @return the storageUrl value + */ + public String storageUrl() { + return this.storageUrl; + } + + /** + * Get the UTC time at which the storage URL will expire. + * + * @return the storageUrlExpiry value + */ + public DateTime storageUrlExpiry() { + return this.storageUrlExpiry; + } + + /** + * Get the time at which the package was last activated, if the package is active. + * + * @return the lastActivationTime value + */ + public DateTime lastActivationTime() { + return this.lastActivationTime; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesImpl.java new file mode 100644 index 0000000000000..a0a1793fe9a96 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackage; + +class ApplicationPackagesImpl extends WrapperImpl implements ApplicationPackages { + private final BatchManager manager; + + ApplicationPackagesImpl(BatchManager manager) { + super(manager.inner().applicationPackages()); + this.manager = manager; + } + + public BatchManager manager() { + return this.manager; + } + + private ApplicationPackageImpl wrapModel(ApplicationPackageInner inner) { + return new ApplicationPackageImpl(inner, manager()); + } + + @Override + public Completable activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format) { + ApplicationPackagesInner client = this.inner(); + return client.activateAsync(resourceGroupName, accountName, applicationId, version, format).toCompletable(); + } + + @Override + public Observable createAsync(String resourceGroupName, String accountName, String applicationId, String version) { + ApplicationPackagesInner client = this.inner(); + return client.createAsync(resourceGroupName, accountName, applicationId, version) + .map(new Func1() { + @Override + public ApplicationPackage call(ApplicationPackageInner inner) { + return new ApplicationPackageImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String applicationId, String version) { + ApplicationPackagesInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, applicationId, version) + .flatMap(new Func1>() { + @Override + public Observable call(ApplicationPackageInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ApplicationPackage)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String applicationId, String version) { + ApplicationPackagesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, applicationId, version).toCompletable(); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesInner.java new file mode 100644 index 0000000000000..541c62fc3b3a0 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationPackagesInner.java @@ -0,0 +1,484 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.batch.v2017_01_01.ActivateApplicationPackageParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ApplicationPackages. + */ +public class ApplicationPackagesInner { + /** The Retrofit service to perform REST calls. */ + private ApplicationPackagesService service; + /** The service client containing this operation class. */ + private BatchManagementClientImpl client; + + /** + * Initializes an instance of ApplicationPackagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApplicationPackagesInner(Retrofit retrofit, BatchManagementClientImpl client) { + this.service = retrofit.create(ApplicationPackagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ApplicationPackages to be + * used by Retrofit to perform actually REST calls. + */ + interface ApplicationPackagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages activate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}/activate") + Observable> activate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ActivateApplicationPackageParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("version") String version, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Activates the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to activate. + * @param format The format of the application package binary file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void activate(String resourceGroupName, String accountName, String applicationId, String version, String format) { + activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format).toBlocking().single().body(); + } + + /** + * Activates the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to activate. + * @param format The format of the application package binary file. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format), serviceCallback); + } + + /** + * Activates the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to activate. + * @param format The format of the application package binary file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable activateAsync(String resourceGroupName, String accountName, String applicationId, String version, String format) { + return activateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version, format).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Activates the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to activate. + * @param format The format of the application package binary file. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> activateWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version, String format) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (version == null) { + throw new IllegalArgumentException("Parameter version is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (format == null) { + throw new IllegalArgumentException("Parameter format is required and cannot be null."); + } + ActivateApplicationPackageParameters parameters = new ActivateApplicationPackageParameters(); + parameters.withFormat(format); + return service.activate(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = activateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse activateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates an application package record. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationPackageInner object if successful. + */ + public ApplicationPackageInner create(String resourceGroupName, String accountName, String applicationId, String version) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().body(); + } + + /** + * Creates an application package record. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback); + } + + /** + * Creates an application package record. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationPackageInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, String applicationId, String version) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, ApplicationPackageInner>() { + @Override + public ApplicationPackageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an application package record. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationPackageInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (version == null) { + throw new IllegalArgumentException("Parameter version is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.create(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String applicationId, String version) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().body(); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String applicationId, String version) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (version == null) { + throw new IllegalArgumentException("Parameter version is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationPackageInner object if successful. + */ + public ApplicationPackageInner get(String resourceGroupName, String accountName, String applicationId, String version) { + return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).toBlocking().single().body(); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String applicationId, String version, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version), serviceCallback); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationPackageInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String applicationId, String version) { + return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId, version).map(new Func1, ApplicationPackageInner>() { + @Override + public ApplicationPackageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param version The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationPackageInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, String version) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (version == null) { + throw new IllegalArgumentException("Parameter version is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, accountName, applicationId, version, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsImpl.java new file mode 100644 index 0000000000000..10c73f1a4a826 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsImpl.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.batch.v2017_01_01.Applications; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.batch.v2017_01_01.Application; +import com.microsoft.azure.management.batch.v2017_01_01.UpdateApplicationParameters; + +class ApplicationsImpl extends WrapperImpl implements Applications { + private final BatchManager manager; + + ApplicationsImpl(BatchManager manager) { + super(manager.inner().applications()); + this.manager = manager; + } + + public BatchManager manager() { + return this.manager; + } + + private ApplicationImpl wrapModel(ApplicationInner inner) { + return new ApplicationImpl(inner, manager()); + } + + @Override + public Observable createAsync(String resourceGroupName, String accountName, String applicationId) { + ApplicationsInner client = this.inner(); + return client.createAsync(resourceGroupName, accountName, applicationId) + .map(new Func1() { + @Override + public Application call(ApplicationInner inner) { + return new ApplicationImpl(inner, manager()); + } + }); + } + + @Override + public Completable updateAsync(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters) { + ApplicationsInner client = this.inner(); + return client.updateAsync(resourceGroupName, accountName, applicationId, parameters).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String accountName) { + ApplicationsInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Application call(ApplicationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String applicationId) { + ApplicationsInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, applicationId) + .flatMap(new Func1>() { + @Override + public Observable call(ApplicationInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Application)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String applicationId) { + ApplicationsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, applicationId).toCompletable(); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsInner.java new file mode 100644 index 0000000000000..738427de54d61 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/ApplicationsInner.java @@ -0,0 +1,919 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.batch.v2017_01_01.AddApplicationParameters; +import com.microsoft.azure.management.batch.v2017_01_01.UpdateApplicationParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Applications. + */ +public class ApplicationsInner { + /** The Retrofit service to perform REST calls. */ + private ApplicationsService service; + /** The service client containing this operation class. */ + private BatchManagementClientImpl client; + + /** + * Initializes an instance of ApplicationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApplicationsInner(Retrofit retrofit, BatchManagementClientImpl client) { + this.service = retrofit.create(ApplicationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Applications to be + * used by Retrofit to perform actually REST calls. + */ + interface ApplicationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("subscriptionId") String subscriptionId, @Body AddApplicationParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("applicationId") String applicationId, @Path("subscriptionId") String subscriptionId, @Body UpdateApplicationParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("maxresults") Integer maxresults, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Applications listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationInner object if successful. + */ + public ApplicationInner create(String resourceGroupName, String accountName, String applicationId) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId).toBlocking().single().body(); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String applicationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, applicationId), serviceCallback); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, String applicationId) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final AddApplicationParameters parameters = null; + return service.create(resourceGroupName, accountName, applicationId, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationInner object if successful. + */ + public ApplicationInner create(String resourceGroupName, String accountName, String applicationId, AddApplicationParameters parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters).toBlocking().single().body(); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String applicationId, AddApplicationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters), serviceCallback); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, String applicationId, AddApplicationParameters parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, AddApplicationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(resourceGroupName, accountName, applicationId, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String applicationId) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId).toBlocking().single().body(); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, String applicationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId), serviceCallback); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String applicationId) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, applicationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, accountName, applicationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationInner object if successful. + */ + public ApplicationInner get(String resourceGroupName, String accountName, String applicationId) { + return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId).toBlocking().single().body(); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String applicationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, applicationId), serviceCallback); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String applicationId) { + return getWithServiceResponseAsync(resourceGroupName, accountName, applicationId).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, accountName, applicationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters) { + updateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters).toBlocking().single().body(); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters), serviceCallback); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, applicationId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationId The ID of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String applicationId, UpdateApplicationParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (applicationId == null) { + throw new IllegalArgumentException("Parameter applicationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, accountName, applicationId, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApplicationInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String accountName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, accountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String accountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, accountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String accountName) { + return listSinglePageAsync(resourceGroupName, accountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer maxresults = null; + return service.list(resourceGroupName, accountName, this.client.subscriptionId(), maxresults, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApplicationInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String accountName, final Integer maxresults) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, accountName, maxresults).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String accountName, final Integer maxresults, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, accountName, maxresults), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String accountName, final Integer maxresults) { + return listWithServiceResponseAsync(resourceGroupName, accountName, maxresults) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String accountName, final Integer maxresults) { + return listSinglePageAsync(resourceGroupName, accountName, maxresults) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the Batch account. + ServiceResponse> * @param accountName The name of the Batch account. + ServiceResponse> * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String accountName, final Integer maxresults) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, accountName, this.client.subscriptionId(), maxresults, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the applications in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApplicationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the applications in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the applications in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the applications in the specified account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountImpl.java new file mode 100644 index 0000000000000..2ba693f480e3c --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountImpl.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccount; +import rx.Observable; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountUpdateParameters; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountCreateParameters; +import com.microsoft.azure.management.batch.v2017_01_01.AutoStorageProperties; +import com.microsoft.azure.management.batch.v2017_01_01.KeyVaultReference; +import com.microsoft.azure.management.batch.v2017_01_01.PoolAllocationMode; +import com.microsoft.azure.management.batch.v2017_01_01.ProvisioningState; +import com.microsoft.azure.management.batch.v2017_01_01.AutoStorageBaseProperties; +import rx.functions.Func1; + +class BatchAccountImpl extends GroupableResourceCoreImpl implements BatchAccount, BatchAccount.Definition, BatchAccount.Update { + private BatchAccountCreateParameters createParameter; + private BatchAccountUpdateParameters updateParameter; + BatchAccountImpl(String name, BatchAccountInner inner, BatchManager manager) { + super(name, inner, manager); + this.createParameter = new BatchAccountCreateParameters(); + this.updateParameter = new BatchAccountUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + BatchAccountsInner client = this.manager().inner().batchAccounts(); + this.createParameter.withLocation(inner().location()); + this.createParameter.withTags(inner().getTags()); + return client.createAsync(this.resourceGroupName(), this.name(), this.createParameter) + .map(new Func1() { + @Override + public BatchAccountInner call(BatchAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BatchAccountsInner client = this.manager().inner().batchAccounts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public BatchAccountInner call(BatchAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BatchAccountsInner client = this.manager().inner().batchAccounts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new BatchAccountCreateParameters(); + this.updateParameter = new BatchAccountUpdateParameters(); + } + + @Override + public String accountEndpoint() { + return this.inner().accountEndpoint(); + } + + @Override + public int activeJobAndJobScheduleQuota() { + return this.inner().activeJobAndJobScheduleQuota(); + } + + @Override + public AutoStorageProperties autoStorage() { + return this.inner().autoStorage(); + } + + @Override + public int coreQuota() { + return this.inner().coreQuota(); + } + + @Override + public KeyVaultReference keyVaultReference() { + return this.inner().keyVaultReference(); + } + + @Override + public PoolAllocationMode poolAllocationMode() { + return this.inner().poolAllocationMode(); + } + + @Override + public int poolQuota() { + return this.inner().poolQuota(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public BatchAccountImpl withKeyVaultReference(KeyVaultReference keyVaultReference) { + this.createParameter.withKeyVaultReference(keyVaultReference); + return this; + } + + @Override + public BatchAccountImpl withPoolAllocationMode(PoolAllocationMode poolAllocationMode) { + this.createParameter.withPoolAllocationMode(poolAllocationMode); + return this; + } + + @Override + public BatchAccountImpl withAutoStorage(AutoStorageBaseProperties autoStorage) { + if (isInCreateMode()) { + this.createParameter.withAutoStorage(autoStorage); + } else { + this.updateParameter.withAutoStorage(autoStorage); + } + return this; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountInner.java new file mode 100644 index 0000000000000..1f056738e4f89 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountInner.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.ProvisioningState; +import com.microsoft.azure.management.batch.v2017_01_01.PoolAllocationMode; +import com.microsoft.azure.management.batch.v2017_01_01.KeyVaultReference; +import com.microsoft.azure.management.batch.v2017_01_01.AutoStorageProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Contains information about an Azure Batch account. + */ +@JsonFlatten +@SkipParentValidation +public class BatchAccountInner extends Resource { + /** + * The endpoint used by this account to interact with the Batch services. + */ + @JsonProperty(value = "properties.accountEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String accountEndpoint; + + /** + * The provisioned state of the resource. Possible values include: + * 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The allocation mode to use for creating pools in the Batch account. + * Possible values include: 'BatchService', 'UserSubscription'. + */ + @JsonProperty(value = "properties.poolAllocationMode", access = JsonProperty.Access.WRITE_ONLY) + private PoolAllocationMode poolAllocationMode; + + /** + * A reference to the Azure key vault associated with the Batch account. + */ + @JsonProperty(value = "properties.keyVaultReference", access = JsonProperty.Access.WRITE_ONLY) + private KeyVaultReference keyVaultReference; + + /** + * The properties and status of any auto storage account associated with + * the Batch account. + */ + @JsonProperty(value = "properties.autoStorage", access = JsonProperty.Access.WRITE_ONLY) + private AutoStorageProperties autoStorage; + + /** + * The core quota for this Batch account. + */ + @JsonProperty(value = "properties.coreQuota", access = JsonProperty.Access.WRITE_ONLY) + private int coreQuota; + + /** + * The pool quota for this Batch account. + */ + @JsonProperty(value = "properties.poolQuota", access = JsonProperty.Access.WRITE_ONLY) + private int poolQuota; + + /** + * The active job and job schedule quota for this Batch account. + */ + @JsonProperty(value = "properties.activeJobAndJobScheduleQuota", access = JsonProperty.Access.WRITE_ONLY) + private int activeJobAndJobScheduleQuota; + + /** + * Get the endpoint used by this account to interact with the Batch services. + * + * @return the accountEndpoint value + */ + public String accountEndpoint() { + return this.accountEndpoint; + } + + /** + * Get the provisioned state of the resource. Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get possible values include: 'BatchService', 'UserSubscription'. + * + * @return the poolAllocationMode value + */ + public PoolAllocationMode poolAllocationMode() { + return this.poolAllocationMode; + } + + /** + * Get the keyVaultReference value. + * + * @return the keyVaultReference value + */ + public KeyVaultReference keyVaultReference() { + return this.keyVaultReference; + } + + /** + * Get the autoStorage value. + * + * @return the autoStorage value + */ + public AutoStorageProperties autoStorage() { + return this.autoStorage; + } + + /** + * Get the coreQuota value. + * + * @return the coreQuota value + */ + public int coreQuota() { + return this.coreQuota; + } + + /** + * Get the poolQuota value. + * + * @return the poolQuota value + */ + public int poolQuota() { + return this.poolQuota; + } + + /** + * Get the activeJobAndJobScheduleQuota value. + * + * @return the activeJobAndJobScheduleQuota value + */ + public int activeJobAndJobScheduleQuota() { + return this.activeJobAndJobScheduleQuota; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysImpl.java new file mode 100644 index 0000000000000..c6d5f89189d78 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class BatchAccountKeysImpl extends WrapperImpl implements BatchAccountKeys { + private final BatchManager manager; + BatchAccountKeysImpl(BatchAccountKeysInner inner, BatchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BatchManager manager() { + return this.manager; + } + + @Override + public String primary() { + return this.inner().primary(); + } + + @Override + public String secondary() { + return this.inner().secondary(); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysInner.java new file mode 100644 index 0000000000000..62e34fe17b8a9 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountKeysInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A set of Azure Batch account keys. + */ +public class BatchAccountKeysInner { + /** + * The primary key associated with the account. + */ + @JsonProperty(value = "primary", access = JsonProperty.Access.WRITE_ONLY) + private String primary; + + /** + * The secondary key associated with the account. + */ + @JsonProperty(value = "secondary", access = JsonProperty.Access.WRITE_ONLY) + private String secondary; + + /** + * Get the primary key associated with the account. + * + * @return the primary value + */ + public String primary() { + return this.primary; + } + + /** + * Get the secondary key associated with the account. + * + * @return the secondary value + */ + public String secondary() { + return this.secondary; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsImpl.java new file mode 100644 index 0000000000000..1aaecf78177dc --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsImpl.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccount; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountKeys; +import com.microsoft.azure.management.batch.v2017_01_01.AccountKeyType; + +class BatchAccountsImpl extends GroupableResourcesCoreImpl implements BatchAccounts { + protected BatchAccountsImpl(BatchManager manager) { + super(manager.inner().batchAccounts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + BatchAccountsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + BatchAccountsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + BatchAccountsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + BatchAccountsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BatchAccount call(BatchAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + BatchAccountsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + BatchAccountsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BatchAccount call(BatchAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public BatchAccountImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable synchronizeAutoStorageKeysAsync(String resourceGroupName, String accountName) { + BatchAccountsInner client = this.inner(); + return client.synchronizeAutoStorageKeysAsync(resourceGroupName, accountName).toCompletable(); + } + + @Override + public Observable regenerateKeyAsync(String resourceGroupName, String accountName, AccountKeyType keyName) { + BatchAccountsInner client = this.inner(); + return client.regenerateKeyAsync(resourceGroupName, accountName, keyName) + .map(new Func1() { + @Override + public BatchAccountKeys call(BatchAccountKeysInner inner) { + return new BatchAccountKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable getKeysAsync(String resourceGroupName, String accountName) { + BatchAccountsInner client = this.inner(); + return client.getKeysAsync(resourceGroupName, accountName) + .map(new Func1() { + @Override + public BatchAccountKeys call(BatchAccountKeysInner inner) { + return new BatchAccountKeysImpl(inner, manager()); + } + }); + } + + @Override + protected BatchAccountImpl wrapModel(BatchAccountInner inner) { + return new BatchAccountImpl(inner.name(), inner, manager()); + } + + @Override + protected BatchAccountImpl wrapModel(String name) { + return new BatchAccountImpl(name, new BatchAccountInner(), this.manager()); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsInner.java new file mode 100644 index 0000000000000..8ccb3134a56c7 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchAccountsInner.java @@ -0,0 +1,1350 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.batch.v2017_01_01.AccountKeyType; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountCreateHeaders; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountCreateParameters; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountDeleteHeaders; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountRegenerateKeyParameters; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccountUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BatchAccounts. + */ +public class BatchAccountsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private BatchAccountsService service; + /** The service client containing this operation class. */ + private BatchManagementClientImpl client; + + /** + * Initializes an instance of BatchAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BatchAccountsInner(Retrofit retrofit, BatchManagementClientImpl client) { + this.service = retrofit.create(BatchAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BatchAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface BatchAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body BatchAccountCreateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body BatchAccountCreateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body BatchAccountUpdateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts synchronizeAutoStorageKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys") + Observable> synchronizeAutoStorageKeys(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts regenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys") + Observable> regenerateKey(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BatchAccountRegenerateKeyParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts getKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys") + Observable> getKeys(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountInner object if successful. + */ + public BatchAccountInner create(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, BatchAccountInner>() { + @Override + public BatchAccountInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.create(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BatchAccountCreateHeaders.class); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountInner object if successful. + */ + public BatchAccountInner beginCreate(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, BatchAccountInner>() { + @Override + public BatchAccountInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the new Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreate(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BatchAccountCreateHeaders.class); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountInner object if successful. + */ + public BatchAccountInner update(String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param parameters Additional parameters for account update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, BatchAccountInner>() { + @Override + public BatchAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().last().body(); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BatchAccountDeleteHeaders.class); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account to be deleted. + * @param accountName The name of the account to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BatchAccountDeleteHeaders.class); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountInner object if successful. + */ + public BatchAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, BatchAccountInner>() { + @Override + public BatchAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BatchAccountInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BatchAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param resourceGroupName The name of the resource group whose Batch accounts to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BatchAccountInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param resourceGroupName The name of the resource group whose Batch accounts to list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param resourceGroupName The name of the resource group whose Batch accounts to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param resourceGroupName The name of the resource group whose Batch accounts to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group whose Batch accounts to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BatchAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Synchronizes access keys for the auto storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void synchronizeAutoStorageKeys(String resourceGroupName, String accountName) { + synchronizeAutoStorageKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Synchronizes access keys for the auto storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture synchronizeAutoStorageKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(synchronizeAutoStorageKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Synchronizes access keys for the auto storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable synchronizeAutoStorageKeysAsync(String resourceGroupName, String accountName) { + return synchronizeAutoStorageKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Synchronizes access keys for the auto storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> synchronizeAutoStorageKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.synchronizeAutoStorageKeys(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = synchronizeAutoStorageKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse synchronizeAutoStorageKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountKeysInner object if successful. + */ + public BatchAccountKeysInner regenerateKey(String resourceGroupName, String accountName, AccountKeyType keyName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body(); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeyAsync(String resourceGroupName, String accountName, AccountKeyType keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName), serviceCallback); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountKeysInner object + */ + public Observable regenerateKeyAsync(String resourceGroupName, String accountName, AccountKeyType keyName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).map(new Func1, BatchAccountKeysInner>() { + @Override + public BatchAccountKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountKeysInner object + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, AccountKeyType keyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyName == null) { + throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); + } + BatchAccountRegenerateKeyParameters parameters = new BatchAccountRegenerateKeyParameters(); + parameters.withKeyName(keyName); + return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the account keys for the specified Batch account. + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchAccountKeysInner object if successful. + */ + public BatchAccountKeysInner getKeys(String resourceGroupName, String accountName) { + return getKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Gets the account keys for the specified Batch account. + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Gets the account keys for the specified Batch account. + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountKeysInner object + */ + public Observable getKeysAsync(String resourceGroupName, String accountName) { + return getKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, BatchAccountKeysInner>() { + @Override + public BatchAccountKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the account keys for the specified Batch account. + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchAccountKeysInner object + */ + public Observable> getKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getKeys(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BatchAccountInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the Batch accounts associated with the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BatchAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BatchAccountInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BatchAccountInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the Batch accounts associated within the specified resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BatchAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaImpl.java new file mode 100644 index 0000000000000..844632a75e1f4 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.management.batch.v2017_01_01.BatchLocationQuota; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class BatchLocationQuotaImpl extends WrapperImpl implements BatchLocationQuota { + private final BatchManager manager; + BatchLocationQuotaImpl(BatchLocationQuotaInner inner, BatchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BatchManager manager() { + return this.manager; + } + + @Override + public Integer accountQuota() { + return this.inner().accountQuota(); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaInner.java new file mode 100644 index 0000000000000..bf0b79e55a41e --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchLocationQuotaInner.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Quotas associated with a Batch region for a particular subscription. + */ +public class BatchLocationQuotaInner { + /** + * The number of Batch accounts that may be created under the subscription + * in the specified region. + */ + @JsonProperty(value = "accountQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer accountQuota; + + /** + * Get the number of Batch accounts that may be created under the subscription in the specified region. + * + * @return the accountQuota value + */ + public Integer accountQuota() { + return this.accountQuota; + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManagementClientImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManagementClientImpl.java new file mode 100644 index 0000000000000..823e7e250c515 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the BatchManagementClientImpl class. + */ +public class BatchManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** A unique identifier of a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets A unique identifier of a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets A unique identifier of a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public BatchManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to be used with the HTTP request. */ + private String apiVersion; + + /** + * Gets The API version to be used with the HTTP request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public BatchManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public BatchManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public BatchManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The BatchAccountsInner object to access its operations. + */ + private BatchAccountsInner batchAccounts; + + /** + * Gets the BatchAccountsInner object to access its operations. + * @return the BatchAccountsInner object. + */ + public BatchAccountsInner batchAccounts() { + return this.batchAccounts; + } + + /** + * The ApplicationPackagesInner object to access its operations. + */ + private ApplicationPackagesInner applicationPackages; + + /** + * Gets the ApplicationPackagesInner object to access its operations. + * @return the ApplicationPackagesInner object. + */ + public ApplicationPackagesInner applicationPackages() { + return this.applicationPackages; + } + + /** + * The ApplicationsInner object to access its operations. + */ + private ApplicationsInner applications; + + /** + * Gets the ApplicationsInner object to access its operations. + * @return the ApplicationsInner object. + */ + public ApplicationsInner applications() { + return this.applications; + } + + /** + * The LocationsInner object to access its operations. + */ + private LocationsInner locations; + + /** + * Gets the LocationsInner object to access its operations. + * @return the LocationsInner object. + */ + public LocationsInner locations() { + return this.locations; + } + + /** + * Initializes an instance of BatchManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public BatchManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of BatchManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public BatchManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BatchManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BatchManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-01-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.batchAccounts = new BatchAccountsInner(restClient().retrofit(), this); + this.applicationPackages = new ApplicationPackagesInner(restClient().retrofit(), this); + this.applications = new ApplicationsInner(restClient().retrofit(), this); + this.locations = new LocationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "BatchManagementClient", "2017-01-01"); + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManager.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManager.java new file mode 100644 index 0000000000000..a47e592929b90 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/BatchManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.batch.v2017_01_01.BatchAccounts; +import com.microsoft.azure.management.batch.v2017_01_01.ApplicationPackages; +import com.microsoft.azure.management.batch.v2017_01_01.Applications; +import com.microsoft.azure.management.batch.v2017_01_01.Locations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Batch resource management. + */ +public final class BatchManager extends ManagerCore { + private BatchAccounts batchAccounts; + private ApplicationPackages applicationPackages; + private Applications applications; + private Locations locations; + /** + * Get a Configurable instance that can be used to create BatchManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new BatchManager.ConfigurableImpl(); + } + /** + * Creates an instance of BatchManager that exposes Batch resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the BatchManager + */ + public static BatchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new BatchManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of BatchManager that exposes Batch resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the BatchManager + */ + public static BatchManager authenticate(RestClient restClient, String subscriptionId) { + return new BatchManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of BatchManager that exposes Batch management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Batch management API entry points that work across subscriptions + */ + BatchManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage BatchAccounts. + */ + public BatchAccounts batchAccounts() { + if (this.batchAccounts == null) { + this.batchAccounts = new BatchAccountsImpl(this); + } + return this.batchAccounts; + } + + /** + * @return Entry point to manage ApplicationPackages. + */ + public ApplicationPackages applicationPackages() { + if (this.applicationPackages == null) { + this.applicationPackages = new ApplicationPackagesImpl(this); + } + return this.applicationPackages; + } + + /** + * @return Entry point to manage Applications. + */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(this); + } + return this.applications; + } + + /** + * @return Entry point to manage Locations. + */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(this); + } + return this.locations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public BatchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return BatchManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private BatchManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new BatchManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/IdParsingUtils.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..bbb311c77447d --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsImpl.java new file mode 100644 index 0000000000000..e5a06bfb00dd2 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.batch.v2017_01_01.Locations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.batch.v2017_01_01.BatchLocationQuota; + +class LocationsImpl extends WrapperImpl implements Locations { + private final BatchManager manager; + + LocationsImpl(BatchManager manager) { + super(manager.inner().locations()); + this.manager = manager; + } + + public BatchManager manager() { + return this.manager; + } + + @Override + public Observable getQuotasAsync(String locationName) { + LocationsInner client = this.inner(); + return client.getQuotasAsync(locationName) + .map(new Func1() { + @Override + public BatchLocationQuota call(BatchLocationQuotaInner inner) { + return new BatchLocationQuotaImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsInner.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsInner.java new file mode 100644 index 0000000000000..19893e4047d7d --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/LocationsInner.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Locations. + */ +public class LocationsInner { + /** The Retrofit service to perform REST calls. */ + private LocationsService service; + /** The service client containing this operation class. */ + private BatchManagementClientImpl client; + + /** + * Initializes an instance of LocationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LocationsInner(Retrofit retrofit, BatchManagementClientImpl client) { + this.service = retrofit.create(LocationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Locations to be + * used by Retrofit to perform actually REST calls. + */ + interface LocationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batch.v2017_01_01.Locations getQuotas" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas") + Observable> getQuotas(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The desired region for the quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BatchLocationQuotaInner object if successful. + */ + public BatchLocationQuotaInner getQuotas(String locationName) { + return getQuotasWithServiceResponseAsync(locationName).toBlocking().single().body(); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The desired region for the quotas. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getQuotasAsync(String locationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getQuotasWithServiceResponseAsync(locationName), serviceCallback); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The desired region for the quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchLocationQuotaInner object + */ + public Observable getQuotasAsync(String locationName) { + return getQuotasWithServiceResponseAsync(locationName).map(new Func1, BatchLocationQuotaInner>() { + @Override + public BatchLocationQuotaInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The desired region for the quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BatchLocationQuotaInner object + */ + public Observable> getQuotasWithServiceResponseAsync(String locationName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getQuotas(locationName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getQuotasDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getQuotasDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/PageImpl.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..cc4b4f48d8d90 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.batch.v2017_01_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/package-info.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/package-info.java new file mode 100644 index 0000000000000..f585b8d35c180 --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for BatchManagementClient. + */ +package com.microsoft.azure.management.batch.v2017_01_01.implementation; diff --git a/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/package-info.java b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/package-info.java new file mode 100644 index 0000000000000..e391f51f0e4db --- /dev/null +++ b/sdk/batch/mgmt-v2017_01_01/src/main/java/com/microsoft/azure/management/batch/v2017_01_01/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for BatchManagementClient. + */ +package com.microsoft.azure.management.batch.v2017_01_01;